1 (function(e, a) { for(var i in a) e[i] = a[i]; if(a.__esModule) Object.defineProperty(e, "__esModule", { value: true }); }(exports,
2 /******/ (() => { // webpackBootstrap
4 /******/ var __webpack_modules__ = ([
6 /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
9 var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
10 function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
11 return new (P || (P = Promise))(function (resolve, reject) {
12 function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
13 function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
14 function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
15 step((generator = generator.apply(thisArg, _arguments || [])).next());
18 Object.defineProperty(exports, "__esModule", ({ value: true }));
19 exports.activate = void 0;
20 const coc_nvim_1 = __webpack_require__(1);
21 const customData_1 = __webpack_require__(2);
22 const vscode_languageserver_protocol_1 = __webpack_require__(4);
23 var CustomDataChangedNotification;
24 (function (CustomDataChangedNotification) {
25 CustomDataChangedNotification.type = new vscode_languageserver_protocol_1.NotificationType('css/customDataChanged');
26 })(CustomDataChangedNotification || (CustomDataChangedNotification = {}));
27 function activate(context) {
28 return __awaiter(this, void 0, void 0, function* () {
29 let { subscriptions } = context;
30 const config = coc_nvim_1.workspace.getConfiguration().get('css', {});
33 const file = context.asAbsolutePath('./lib/server.js');
34 const selector = ['css', 'less', 'scss', 'wxss'];
35 const customDataSource = customData_1.getCustomDataSource(context.subscriptions);
38 transport: coc_nvim_1.TransportKind.ipc,
40 cwd: coc_nvim_1.workspace.root,
41 execArgv: config.execArgv || []
45 documentSelector: selector,
47 configurationSection: ['css', 'less', 'scss', 'wxss']
49 outputChannelName: 'css',
50 initializationOptions: {
51 handledSchemas: ['file']
55 let client = new coc_nvim_1.LanguageClient('css', 'Css language server', serverOptions, clientOptions);
56 // tslint:disable-next-line: no-floating-promises
57 client.onReady().then(() => {
58 client.sendNotification(CustomDataChangedNotification.type, customDataSource.uris);
59 customDataSource.onDidChange(() => {
60 client.sendNotification(CustomDataChangedNotification.type, customDataSource.uris);
63 subscriptions.push(coc_nvim_1.services.registLanguageClient(client));
66 exports.activate = activate;
73 module.exports = require("coc.nvim");;
77 /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
80 /*---------------------------------------------------------------------------------------------
81 * Copyright (c) Microsoft Corporation. All rights reserved.
82 * Licensed under the MIT License. See License.txt in the project root for license information.
83 *--------------------------------------------------------------------------------------------*/
84 var __importDefault = (this && this.__importDefault) || function (mod) {
85 return (mod && mod.__esModule) ? mod : { "default": mod };
87 Object.defineProperty(exports, "__esModule", ({ value: true }));
88 exports.getCustomDataSource = void 0;
89 const coc_nvim_1 = __webpack_require__(1);
90 const path_1 = __importDefault(__webpack_require__(3));
91 const vscode_languageserver_protocol_1 = __webpack_require__(4);
92 const requests_1 = __webpack_require__(33);
93 function getCustomDataSource(toDispose) {
94 let pathsInWorkspace = getCustomDataPathsInAllWorkspaces();
95 let pathsInExtensions = getCustomDataPathsFromAllExtensions();
96 const onChange = new vscode_languageserver_protocol_1.Emitter();
97 toDispose.push(coc_nvim_1.extensions.onDidActiveExtension(_ => {
98 const newPathsInExtensions = getCustomDataPathsFromAllExtensions();
99 if (newPathsInExtensions.length !== pathsInExtensions.length || !newPathsInExtensions.every((val, idx) => val === pathsInExtensions[idx])) {
100 pathsInExtensions = newPathsInExtensions;
104 toDispose.push(coc_nvim_1.workspace.onDidChangeConfiguration(e => {
105 if (e.affectsConfiguration('css.customData')) {
106 pathsInWorkspace = getCustomDataPathsInAllWorkspaces();
112 return pathsInWorkspace.concat(pathsInExtensions);
115 return onChange.event;
119 exports.getCustomDataSource = getCustomDataSource;
120 function getCustomDataPathsInAllWorkspaces() {
121 const workspaceFolders = coc_nvim_1.workspace.workspaceFolders;
122 const dataPaths = [];
123 if (!workspaceFolders) {
126 const collect = (paths, rootFolder) => {
127 if (Array.isArray(paths)) {
128 for (const path of paths) {
129 if (typeof path === 'string') {
130 dataPaths.push(requests_1.resolvePath(rootFolder, path).toString());
135 for (let i = 0; i < workspaceFolders.length; i++) {
136 const folderUri = workspaceFolders[i].uri;
137 const allCssConfig = coc_nvim_1.workspace.getConfiguration('css', folderUri);
138 const customDataInspect = allCssConfig.inspect('customData');
139 if (customDataInspect) {
140 collect(customDataInspect.workspaceValue, coc_nvim_1.Uri.parse(folderUri));
142 collect(customDataInspect.globalValue, coc_nvim_1.Uri.parse(folderUri));
148 function getCustomDataPathsFromAllExtensions() {
150 const dataPaths = [];
151 for (const extension of coc_nvim_1.extensions.all) {
152 const customData = (_c = (_b = (_a = extension.packageJSON) === null || _a === void 0 ? void 0 : _a.contributes) === null || _b === void 0 ? void 0 : _b.css) === null || _c === void 0 ? void 0 : _c.customData;
153 if (Array.isArray(customData)) {
154 for (const rp of customData) {
155 dataPaths.push(path_1.default.join(extension.extensionPath, rp).toString());
167 module.exports = require("path");;
171 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
173 /* --------------------------------------------------------------------------------------------
\r
174 * Copyright (c) Microsoft Corporation. All rights reserved.
\r
175 * Licensed under the MIT License. See License.txt in the project root for license information.
\r
176 * ------------------------------------------------------------------------------------------ */
\r
178 function __export(m) {
\r
179 for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
\r
181 Object.defineProperty(exports, "__esModule", ({ value: true }));
\r
182 const vscode_jsonrpc_1 = __webpack_require__(5);
\r
183 exports.ErrorCodes = vscode_jsonrpc_1.ErrorCodes;
\r
184 exports.ResponseError = vscode_jsonrpc_1.ResponseError;
\r
185 exports.CancellationToken = vscode_jsonrpc_1.CancellationToken;
\r
186 exports.CancellationTokenSource = vscode_jsonrpc_1.CancellationTokenSource;
\r
187 exports.Disposable = vscode_jsonrpc_1.Disposable;
\r
188 exports.Event = vscode_jsonrpc_1.Event;
\r
189 exports.Emitter = vscode_jsonrpc_1.Emitter;
\r
190 exports.Trace = vscode_jsonrpc_1.Trace;
\r
191 exports.TraceFormat = vscode_jsonrpc_1.TraceFormat;
\r
192 exports.SetTraceNotification = vscode_jsonrpc_1.SetTraceNotification;
\r
193 exports.LogTraceNotification = vscode_jsonrpc_1.LogTraceNotification;
\r
194 exports.RequestType = vscode_jsonrpc_1.RequestType;
\r
195 exports.RequestType0 = vscode_jsonrpc_1.RequestType0;
\r
196 exports.NotificationType = vscode_jsonrpc_1.NotificationType;
\r
197 exports.NotificationType0 = vscode_jsonrpc_1.NotificationType0;
\r
198 exports.MessageReader = vscode_jsonrpc_1.MessageReader;
\r
199 exports.MessageWriter = vscode_jsonrpc_1.MessageWriter;
\r
200 exports.ConnectionStrategy = vscode_jsonrpc_1.ConnectionStrategy;
\r
201 exports.StreamMessageReader = vscode_jsonrpc_1.StreamMessageReader;
\r
202 exports.StreamMessageWriter = vscode_jsonrpc_1.StreamMessageWriter;
\r
203 exports.IPCMessageReader = vscode_jsonrpc_1.IPCMessageReader;
\r
204 exports.IPCMessageWriter = vscode_jsonrpc_1.IPCMessageWriter;
\r
205 exports.createClientPipeTransport = vscode_jsonrpc_1.createClientPipeTransport;
\r
206 exports.createServerPipeTransport = vscode_jsonrpc_1.createServerPipeTransport;
\r
207 exports.generateRandomPipeName = vscode_jsonrpc_1.generateRandomPipeName;
\r
208 exports.createClientSocketTransport = vscode_jsonrpc_1.createClientSocketTransport;
\r
209 exports.createServerSocketTransport = vscode_jsonrpc_1.createServerSocketTransport;
\r
210 exports.ProgressType = vscode_jsonrpc_1.ProgressType;
\r
211 __export(__webpack_require__(18));
\r
212 __export(__webpack_require__(19));
\r
213 const callHierarchy = __webpack_require__(31);
\r
214 const st = __webpack_require__(32);
\r
216 (function (Proposed) {
\r
217 let CallHierarchyPrepareRequest;
\r
218 (function (CallHierarchyPrepareRequest) {
\r
219 CallHierarchyPrepareRequest.method = callHierarchy.CallHierarchyPrepareRequest.method;
\r
220 CallHierarchyPrepareRequest.type = callHierarchy.CallHierarchyPrepareRequest.type;
\r
221 })(CallHierarchyPrepareRequest = Proposed.CallHierarchyPrepareRequest || (Proposed.CallHierarchyPrepareRequest = {}));
\r
222 let CallHierarchyIncomingCallsRequest;
\r
223 (function (CallHierarchyIncomingCallsRequest) {
\r
224 CallHierarchyIncomingCallsRequest.method = callHierarchy.CallHierarchyIncomingCallsRequest.method;
\r
225 CallHierarchyIncomingCallsRequest.type = callHierarchy.CallHierarchyIncomingCallsRequest.type;
\r
226 })(CallHierarchyIncomingCallsRequest = Proposed.CallHierarchyIncomingCallsRequest || (Proposed.CallHierarchyIncomingCallsRequest = {}));
\r
227 let CallHierarchyOutgoingCallsRequest;
\r
228 (function (CallHierarchyOutgoingCallsRequest) {
\r
229 CallHierarchyOutgoingCallsRequest.method = callHierarchy.CallHierarchyOutgoingCallsRequest.method;
\r
230 CallHierarchyOutgoingCallsRequest.type = callHierarchy.CallHierarchyOutgoingCallsRequest.type;
\r
231 })(CallHierarchyOutgoingCallsRequest = Proposed.CallHierarchyOutgoingCallsRequest || (Proposed.CallHierarchyOutgoingCallsRequest = {}));
\r
232 Proposed.SemanticTokenTypes = st.SemanticTokenTypes;
\r
233 Proposed.SemanticTokenModifiers = st.SemanticTokenModifiers;
\r
234 Proposed.SemanticTokens = st.SemanticTokens;
\r
235 let SemanticTokensRequest;
\r
236 (function (SemanticTokensRequest) {
\r
237 SemanticTokensRequest.method = st.SemanticTokensRequest.method;
\r
238 SemanticTokensRequest.type = st.SemanticTokensRequest.type;
\r
239 })(SemanticTokensRequest = Proposed.SemanticTokensRequest || (Proposed.SemanticTokensRequest = {}));
\r
240 let SemanticTokensEditsRequest;
\r
241 (function (SemanticTokensEditsRequest) {
\r
242 SemanticTokensEditsRequest.method = st.SemanticTokensEditsRequest.method;
\r
243 SemanticTokensEditsRequest.type = st.SemanticTokensEditsRequest.type;
\r
244 })(SemanticTokensEditsRequest = Proposed.SemanticTokensEditsRequest || (Proposed.SemanticTokensEditsRequest = {}));
\r
245 let SemanticTokensRangeRequest;
\r
246 (function (SemanticTokensRangeRequest) {
\r
247 SemanticTokensRangeRequest.method = st.SemanticTokensRangeRequest.method;
\r
248 SemanticTokensRangeRequest.type = st.SemanticTokensRangeRequest.type;
\r
249 })(SemanticTokensRangeRequest = Proposed.SemanticTokensRangeRequest || (Proposed.SemanticTokensRangeRequest = {}));
\r
250 })(Proposed = exports.Proposed || (exports.Proposed = {}));
\r
251 function createProtocolConnection(reader, writer, logger, strategy) {
\r
252 return vscode_jsonrpc_1.createMessageConnection(reader, writer, logger, strategy);
\r
254 exports.createProtocolConnection = createProtocolConnection;
\r
259 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
261 /* --------------------------------------------------------------------------------------------
\r
262 * Copyright (c) Microsoft Corporation. All rights reserved.
\r
263 * Licensed under the MIT License. See License.txt in the project root for license information.
\r
264 * ------------------------------------------------------------------------------------------ */
\r
265 /// <reference path="../typings/thenable.d.ts" />
\r
267 function __export(m) {
\r
268 for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
\r
270 Object.defineProperty(exports, "__esModule", ({ value: true }));
\r
271 const Is = __webpack_require__(6);
\r
272 const messages_1 = __webpack_require__(7);
\r
273 exports.RequestType = messages_1.RequestType;
\r
274 exports.RequestType0 = messages_1.RequestType0;
\r
275 exports.RequestType1 = messages_1.RequestType1;
\r
276 exports.RequestType2 = messages_1.RequestType2;
\r
277 exports.RequestType3 = messages_1.RequestType3;
\r
278 exports.RequestType4 = messages_1.RequestType4;
\r
279 exports.RequestType5 = messages_1.RequestType5;
\r
280 exports.RequestType6 = messages_1.RequestType6;
\r
281 exports.RequestType7 = messages_1.RequestType7;
\r
282 exports.RequestType8 = messages_1.RequestType8;
\r
283 exports.RequestType9 = messages_1.RequestType9;
\r
284 exports.ResponseError = messages_1.ResponseError;
\r
285 exports.ErrorCodes = messages_1.ErrorCodes;
\r
286 exports.NotificationType = messages_1.NotificationType;
\r
287 exports.NotificationType0 = messages_1.NotificationType0;
\r
288 exports.NotificationType1 = messages_1.NotificationType1;
\r
289 exports.NotificationType2 = messages_1.NotificationType2;
\r
290 exports.NotificationType3 = messages_1.NotificationType3;
\r
291 exports.NotificationType4 = messages_1.NotificationType4;
\r
292 exports.NotificationType5 = messages_1.NotificationType5;
\r
293 exports.NotificationType6 = messages_1.NotificationType6;
\r
294 exports.NotificationType7 = messages_1.NotificationType7;
\r
295 exports.NotificationType8 = messages_1.NotificationType8;
\r
296 exports.NotificationType9 = messages_1.NotificationType9;
\r
297 const messageReader_1 = __webpack_require__(8);
\r
298 exports.MessageReader = messageReader_1.MessageReader;
\r
299 exports.StreamMessageReader = messageReader_1.StreamMessageReader;
\r
300 exports.IPCMessageReader = messageReader_1.IPCMessageReader;
\r
301 exports.SocketMessageReader = messageReader_1.SocketMessageReader;
\r
302 const messageWriter_1 = __webpack_require__(10);
\r
303 exports.MessageWriter = messageWriter_1.MessageWriter;
\r
304 exports.StreamMessageWriter = messageWriter_1.StreamMessageWriter;
\r
305 exports.IPCMessageWriter = messageWriter_1.IPCMessageWriter;
\r
306 exports.SocketMessageWriter = messageWriter_1.SocketMessageWriter;
\r
307 const events_1 = __webpack_require__(9);
\r
308 exports.Disposable = events_1.Disposable;
\r
309 exports.Event = events_1.Event;
\r
310 exports.Emitter = events_1.Emitter;
\r
311 const cancellation_1 = __webpack_require__(11);
\r
312 exports.CancellationTokenSource = cancellation_1.CancellationTokenSource;
\r
313 exports.CancellationToken = cancellation_1.CancellationToken;
\r
314 const linkedMap_1 = __webpack_require__(12);
\r
315 __export(__webpack_require__(13));
\r
316 __export(__webpack_require__(17));
\r
317 var CancelNotification;
\r
318 (function (CancelNotification) {
\r
319 CancelNotification.type = new messages_1.NotificationType('$/cancelRequest');
\r
320 })(CancelNotification || (CancelNotification = {}));
\r
321 var ProgressNotification;
\r
322 (function (ProgressNotification) {
\r
323 ProgressNotification.type = new messages_1.NotificationType('$/progress');
\r
324 })(ProgressNotification || (ProgressNotification = {}));
\r
325 class ProgressType {
\r
329 exports.ProgressType = ProgressType;
\r
330 exports.NullLogger = Object.freeze({
\r
337 (function (Trace) {
\r
338 Trace[Trace["Off"] = 0] = "Off";
\r
339 Trace[Trace["Messages"] = 1] = "Messages";
\r
340 Trace[Trace["Verbose"] = 2] = "Verbose";
\r
341 })(Trace = exports.Trace || (exports.Trace = {}));
\r
342 (function (Trace) {
\r
343 function fromString(value) {
\r
344 if (!Is.string(value)) {
\r
347 value = value.toLowerCase();
\r
352 return Trace.Messages;
\r
354 return Trace.Verbose;
\r
359 Trace.fromString = fromString;
\r
360 function toString(value) {
\r
364 case Trace.Messages:
\r
366 case Trace.Verbose:
\r
372 Trace.toString = toString;
\r
373 })(Trace = exports.Trace || (exports.Trace = {}));
\r
375 (function (TraceFormat) {
\r
376 TraceFormat["Text"] = "text";
\r
377 TraceFormat["JSON"] = "json";
\r
378 })(TraceFormat = exports.TraceFormat || (exports.TraceFormat = {}));
\r
379 (function (TraceFormat) {
\r
380 function fromString(value) {
\r
381 value = value.toLowerCase();
\r
382 if (value === 'json') {
\r
383 return TraceFormat.JSON;
\r
386 return TraceFormat.Text;
\r
389 TraceFormat.fromString = fromString;
\r
390 })(TraceFormat = exports.TraceFormat || (exports.TraceFormat = {}));
\r
391 var SetTraceNotification;
\r
392 (function (SetTraceNotification) {
\r
393 SetTraceNotification.type = new messages_1.NotificationType('$/setTraceNotification');
\r
394 })(SetTraceNotification = exports.SetTraceNotification || (exports.SetTraceNotification = {}));
\r
395 var LogTraceNotification;
\r
396 (function (LogTraceNotification) {
\r
397 LogTraceNotification.type = new messages_1.NotificationType('$/logTraceNotification');
\r
398 })(LogTraceNotification = exports.LogTraceNotification || (exports.LogTraceNotification = {}));
\r
399 var ConnectionErrors;
\r
400 (function (ConnectionErrors) {
\r
402 * The connection is closed.
\r
404 ConnectionErrors[ConnectionErrors["Closed"] = 1] = "Closed";
\r
406 * The connection got disposed.
\r
408 ConnectionErrors[ConnectionErrors["Disposed"] = 2] = "Disposed";
\r
410 * The connection is already in listening mode.
\r
412 ConnectionErrors[ConnectionErrors["AlreadyListening"] = 3] = "AlreadyListening";
\r
413 })(ConnectionErrors = exports.ConnectionErrors || (exports.ConnectionErrors = {}));
\r
414 class ConnectionError extends Error {
\r
415 constructor(code, message) {
\r
418 Object.setPrototypeOf(this, ConnectionError.prototype);
\r
421 exports.ConnectionError = ConnectionError;
\r
422 var ConnectionStrategy;
\r
423 (function (ConnectionStrategy) {
\r
424 function is(value) {
\r
425 let candidate = value;
\r
426 return candidate && Is.func(candidate.cancelUndispatched);
\r
428 ConnectionStrategy.is = is;
\r
429 })(ConnectionStrategy = exports.ConnectionStrategy || (exports.ConnectionStrategy = {}));
\r
430 var ConnectionState;
\r
431 (function (ConnectionState) {
\r
432 ConnectionState[ConnectionState["New"] = 1] = "New";
\r
433 ConnectionState[ConnectionState["Listening"] = 2] = "Listening";
\r
434 ConnectionState[ConnectionState["Closed"] = 3] = "Closed";
\r
435 ConnectionState[ConnectionState["Disposed"] = 4] = "Disposed";
\r
436 })(ConnectionState || (ConnectionState = {}));
\r
437 function _createMessageConnection(messageReader, messageWriter, logger, strategy) {
\r
438 let sequenceNumber = 0;
\r
439 let notificationSquenceNumber = 0;
\r
440 let unknownResponseSquenceNumber = 0;
\r
441 const version = '2.0';
\r
442 let starRequestHandler = undefined;
\r
443 let requestHandlers = Object.create(null);
\r
444 let starNotificationHandler = undefined;
\r
445 let notificationHandlers = Object.create(null);
\r
446 let progressHandlers = new Map();
\r
448 let messageQueue = new linkedMap_1.LinkedMap();
\r
449 let responsePromises = Object.create(null);
\r
450 let requestTokens = Object.create(null);
\r
451 let trace = Trace.Off;
\r
452 let traceFormat = TraceFormat.Text;
\r
454 let state = ConnectionState.New;
\r
455 let errorEmitter = new events_1.Emitter();
\r
456 let closeEmitter = new events_1.Emitter();
\r
457 let unhandledNotificationEmitter = new events_1.Emitter();
\r
458 let unhandledProgressEmitter = new events_1.Emitter();
\r
459 let disposeEmitter = new events_1.Emitter();
\r
460 function createRequestQueueKey(id) {
\r
461 return 'req-' + id.toString();
\r
463 function createResponseQueueKey(id) {
\r
465 return 'res-unknown-' + (++unknownResponseSquenceNumber).toString();
\r
468 return 'res-' + id.toString();
\r
471 function createNotificationQueueKey() {
\r
472 return 'not-' + (++notificationSquenceNumber).toString();
\r
474 function addMessageToQueue(queue, message) {
\r
475 if (messages_1.isRequestMessage(message)) {
\r
476 queue.set(createRequestQueueKey(message.id), message);
\r
478 else if (messages_1.isResponseMessage(message)) {
\r
479 queue.set(createResponseQueueKey(message.id), message);
\r
482 queue.set(createNotificationQueueKey(), message);
\r
485 function cancelUndispatched(_message) {
\r
488 function isListening() {
\r
489 return state === ConnectionState.Listening;
\r
491 function isClosed() {
\r
492 return state === ConnectionState.Closed;
\r
494 function isDisposed() {
\r
495 return state === ConnectionState.Disposed;
\r
497 function closeHandler() {
\r
498 if (state === ConnectionState.New || state === ConnectionState.Listening) {
\r
499 state = ConnectionState.Closed;
\r
500 closeEmitter.fire(undefined);
\r
502 // If the connection is disposed don't sent close events.
\r
504 function readErrorHandler(error) {
\r
505 errorEmitter.fire([error, undefined, undefined]);
\r
507 function writeErrorHandler(data) {
\r
508 errorEmitter.fire(data);
\r
510 messageReader.onClose(closeHandler);
\r
511 messageReader.onError(readErrorHandler);
\r
512 messageWriter.onClose(closeHandler);
\r
513 messageWriter.onError(writeErrorHandler);
\r
514 function triggerMessageQueue() {
\r
515 if (timer || messageQueue.size === 0) {
\r
518 timer = setImmediate(() => {
\r
520 processMessageQueue();
\r
523 function processMessageQueue() {
\r
524 if (messageQueue.size === 0) {
\r
527 let message = messageQueue.shift();
\r
529 if (messages_1.isRequestMessage(message)) {
\r
530 handleRequest(message);
\r
532 else if (messages_1.isNotificationMessage(message)) {
\r
533 handleNotification(message);
\r
535 else if (messages_1.isResponseMessage(message)) {
\r
536 handleResponse(message);
\r
539 handleInvalidMessage(message);
\r
543 triggerMessageQueue();
\r
546 let callback = (message) => {
\r
548 // We have received a cancellation message. Check if the message is still in the queue
\r
549 // and cancel it if allowed to do so.
\r
550 if (messages_1.isNotificationMessage(message) && message.method === CancelNotification.type.method) {
\r
551 let key = createRequestQueueKey(message.params.id);
\r
552 let toCancel = messageQueue.get(key);
\r
553 if (messages_1.isRequestMessage(toCancel)) {
\r
554 let response = strategy && strategy.cancelUndispatched ? strategy.cancelUndispatched(toCancel, cancelUndispatched) : cancelUndispatched(toCancel);
\r
555 if (response && (response.error !== void 0 || response.result !== void 0)) {
\r
556 messageQueue.delete(key);
\r
557 response.id = toCancel.id;
\r
558 traceSendingResponse(response, message.method, Date.now());
\r
559 messageWriter.write(response);
\r
564 addMessageToQueue(messageQueue, message);
\r
567 triggerMessageQueue();
\r
570 function handleRequest(requestMessage) {
\r
571 if (isDisposed()) {
\r
572 // we return here silently since we fired an event when the
\r
573 // connection got disposed.
\r
576 function reply(resultOrError, method, startTime) {
\r
579 id: requestMessage.id
\r
581 if (resultOrError instanceof messages_1.ResponseError) {
\r
582 message.error = resultOrError.toJson();
\r
585 message.result = resultOrError === void 0 ? null : resultOrError;
\r
587 traceSendingResponse(message, method, startTime);
\r
588 messageWriter.write(message);
\r
590 function replyError(error, method, startTime) {
\r
593 id: requestMessage.id,
\r
594 error: error.toJson()
\r
596 traceSendingResponse(message, method, startTime);
\r
597 messageWriter.write(message);
\r
599 function replySuccess(result, method, startTime) {
\r
600 // The JSON RPC defines that a response must either have a result or an error
\r
601 // So we can't treat undefined as a valid response result.
\r
602 if (result === void 0) {
\r
607 id: requestMessage.id,
\r
610 traceSendingResponse(message, method, startTime);
\r
611 messageWriter.write(message);
\r
613 traceReceivedRequest(requestMessage);
\r
614 let element = requestHandlers[requestMessage.method];
\r
616 let requestHandler;
\r
618 type = element.type;
\r
619 requestHandler = element.handler;
\r
621 let startTime = Date.now();
\r
622 if (requestHandler || starRequestHandler) {
\r
623 let cancellationSource = new cancellation_1.CancellationTokenSource();
\r
624 let tokenKey = String(requestMessage.id);
\r
625 requestTokens[tokenKey] = cancellationSource;
\r
628 if (requestMessage.params === void 0 || (type !== void 0 && type.numberOfParams === 0)) {
\r
629 handlerResult = requestHandler
\r
630 ? requestHandler(cancellationSource.token)
\r
631 : starRequestHandler(requestMessage.method, cancellationSource.token);
\r
633 else if (Is.array(requestMessage.params) && (type === void 0 || type.numberOfParams > 1)) {
\r
634 handlerResult = requestHandler
\r
635 ? requestHandler(...requestMessage.params, cancellationSource.token)
\r
636 : starRequestHandler(requestMessage.method, ...requestMessage.params, cancellationSource.token);
\r
639 handlerResult = requestHandler
\r
640 ? requestHandler(requestMessage.params, cancellationSource.token)
\r
641 : starRequestHandler(requestMessage.method, requestMessage.params, cancellationSource.token);
\r
643 let promise = handlerResult;
\r
644 if (!handlerResult) {
\r
645 delete requestTokens[tokenKey];
\r
646 replySuccess(handlerResult, requestMessage.method, startTime);
\r
648 else if (promise.then) {
\r
649 promise.then((resultOrError) => {
\r
650 delete requestTokens[tokenKey];
\r
651 reply(resultOrError, requestMessage.method, startTime);
\r
653 delete requestTokens[tokenKey];
\r
654 if (error instanceof messages_1.ResponseError) {
\r
655 replyError(error, requestMessage.method, startTime);
\r
657 else if (error && Is.string(error.message)) {
\r
658 replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed with message: ${error.message}`), requestMessage.method, startTime);
\r
661 replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed unexpectedly without providing any details.`), requestMessage.method, startTime);
\r
666 delete requestTokens[tokenKey];
\r
667 reply(handlerResult, requestMessage.method, startTime);
\r
671 delete requestTokens[tokenKey];
\r
672 if (error instanceof messages_1.ResponseError) {
\r
673 reply(error, requestMessage.method, startTime);
\r
675 else if (error && Is.string(error.message)) {
\r
676 replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed with message: ${error.message}`), requestMessage.method, startTime);
\r
679 replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed unexpectedly without providing any details.`), requestMessage.method, startTime);
\r
684 replyError(new messages_1.ResponseError(messages_1.ErrorCodes.MethodNotFound, `Unhandled method ${requestMessage.method}`), requestMessage.method, startTime);
\r
687 function handleResponse(responseMessage) {
\r
688 if (isDisposed()) {
\r
689 // See handle request.
\r
692 if (responseMessage.id === null) {
\r
693 if (responseMessage.error) {
\r
694 logger.error(`Received response message without id: Error is: \n${JSON.stringify(responseMessage.error, undefined, 4)}`);
\r
697 logger.error(`Received response message without id. No further error information provided.`);
\r
701 let key = String(responseMessage.id);
\r
702 let responsePromise = responsePromises[key];
\r
703 traceReceivedResponse(responseMessage, responsePromise);
\r
704 if (responsePromise) {
\r
705 delete responsePromises[key];
\r
707 if (responseMessage.error) {
\r
708 let error = responseMessage.error;
\r
709 responsePromise.reject(new messages_1.ResponseError(error.code, error.message, error.data));
\r
711 else if (responseMessage.result !== void 0) {
\r
712 responsePromise.resolve(responseMessage.result);
\r
715 throw new Error('Should never happen.');
\r
719 if (error.message) {
\r
720 logger.error(`Response handler '${responsePromise.method}' failed with message: ${error.message}`);
\r
723 logger.error(`Response handler '${responsePromise.method}' failed unexpectedly.`);
\r
729 function handleNotification(message) {
\r
730 if (isDisposed()) {
\r
731 // See handle request.
\r
734 let type = undefined;
\r
735 let notificationHandler;
\r
736 if (message.method === CancelNotification.type.method) {
\r
737 notificationHandler = (params) => {
\r
738 let id = params.id;
\r
739 let source = requestTokens[String(id)];
\r
746 let element = notificationHandlers[message.method];
\r
748 notificationHandler = element.handler;
\r
749 type = element.type;
\r
752 if (notificationHandler || starNotificationHandler) {
\r
754 traceReceivedNotification(message);
\r
755 if (message.params === void 0 || (type !== void 0 && type.numberOfParams === 0)) {
\r
756 notificationHandler ? notificationHandler() : starNotificationHandler(message.method);
\r
758 else if (Is.array(message.params) && (type === void 0 || type.numberOfParams > 1)) {
\r
759 notificationHandler ? notificationHandler(...message.params) : starNotificationHandler(message.method, ...message.params);
\r
762 notificationHandler ? notificationHandler(message.params) : starNotificationHandler(message.method, message.params);
\r
766 if (error.message) {
\r
767 logger.error(`Notification handler '${message.method}' failed with message: ${error.message}`);
\r
770 logger.error(`Notification handler '${message.method}' failed unexpectedly.`);
\r
775 unhandledNotificationEmitter.fire(message);
\r
778 function handleInvalidMessage(message) {
\r
780 logger.error('Received empty message.');
\r
783 logger.error(`Received message which is neither a response nor a notification message:\n${JSON.stringify(message, null, 4)}`);
\r
784 // Test whether we find an id to reject the promise
\r
785 let responseMessage = message;
\r
786 if (Is.string(responseMessage.id) || Is.number(responseMessage.id)) {
\r
787 let key = String(responseMessage.id);
\r
788 let responseHandler = responsePromises[key];
\r
789 if (responseHandler) {
\r
790 responseHandler.reject(new Error('The received response has neither a result nor an error property.'));
\r
794 function traceSendingRequest(message) {
\r
795 if (trace === Trace.Off || !tracer) {
\r
798 if (traceFormat === TraceFormat.Text) {
\r
799 let data = undefined;
\r
800 if (trace === Trace.Verbose && message.params) {
\r
801 data = `Params: ${JSON.stringify(message.params, null, 4)}\n\n`;
\r
803 tracer.log(`Sending request '${message.method} - (${message.id})'.`, data);
\r
806 logLSPMessage('send-request', message);
\r
809 function traceSendingNotification(message) {
\r
810 if (trace === Trace.Off || !tracer) {
\r
813 if (traceFormat === TraceFormat.Text) {
\r
814 let data = undefined;
\r
815 if (trace === Trace.Verbose) {
\r
816 if (message.params) {
\r
817 data = `Params: ${JSON.stringify(message.params, null, 4)}\n\n`;
\r
820 data = 'No parameters provided.\n\n';
\r
823 tracer.log(`Sending notification '${message.method}'.`, data);
\r
826 logLSPMessage('send-notification', message);
\r
829 function traceSendingResponse(message, method, startTime) {
\r
830 if (trace === Trace.Off || !tracer) {
\r
833 if (traceFormat === TraceFormat.Text) {
\r
834 let data = undefined;
\r
835 if (trace === Trace.Verbose) {
\r
836 if (message.error && message.error.data) {
\r
837 data = `Error data: ${JSON.stringify(message.error.data, null, 4)}\n\n`;
\r
840 if (message.result) {
\r
841 data = `Result: ${JSON.stringify(message.result, null, 4)}\n\n`;
\r
843 else if (message.error === void 0) {
\r
844 data = 'No result returned.\n\n';
\r
848 tracer.log(`Sending response '${method} - (${message.id})'. Processing request took ${Date.now() - startTime}ms`, data);
\r
851 logLSPMessage('send-response', message);
\r
854 function traceReceivedRequest(message) {
\r
855 if (trace === Trace.Off || !tracer) {
\r
858 if (traceFormat === TraceFormat.Text) {
\r
859 let data = undefined;
\r
860 if (trace === Trace.Verbose && message.params) {
\r
861 data = `Params: ${JSON.stringify(message.params, null, 4)}\n\n`;
\r
863 tracer.log(`Received request '${message.method} - (${message.id})'.`, data);
\r
866 logLSPMessage('receive-request', message);
\r
869 function traceReceivedNotification(message) {
\r
870 if (trace === Trace.Off || !tracer || message.method === LogTraceNotification.type.method) {
\r
873 if (traceFormat === TraceFormat.Text) {
\r
874 let data = undefined;
\r
875 if (trace === Trace.Verbose) {
\r
876 if (message.params) {
\r
877 data = `Params: ${JSON.stringify(message.params, null, 4)}\n\n`;
\r
880 data = 'No parameters provided.\n\n';
\r
883 tracer.log(`Received notification '${message.method}'.`, data);
\r
886 logLSPMessage('receive-notification', message);
\r
889 function traceReceivedResponse(message, responsePromise) {
\r
890 if (trace === Trace.Off || !tracer) {
\r
893 if (traceFormat === TraceFormat.Text) {
\r
894 let data = undefined;
\r
895 if (trace === Trace.Verbose) {
\r
896 if (message.error && message.error.data) {
\r
897 data = `Error data: ${JSON.stringify(message.error.data, null, 4)}\n\n`;
\r
900 if (message.result) {
\r
901 data = `Result: ${JSON.stringify(message.result, null, 4)}\n\n`;
\r
903 else if (message.error === void 0) {
\r
904 data = 'No result returned.\n\n';
\r
908 if (responsePromise) {
\r
909 let error = message.error ? ` Request failed: ${message.error.message} (${message.error.code}).` : '';
\r
910 tracer.log(`Received response '${responsePromise.method} - (${message.id})' in ${Date.now() - responsePromise.timerStart}ms.${error}`, data);
\r
913 tracer.log(`Received response ${message.id} without active response promise.`, data);
\r
917 logLSPMessage('receive-response', message);
\r
920 function logLSPMessage(type, message) {
\r
921 if (!tracer || trace === Trace.Off) {
\r
924 const lspMessage = {
\r
925 isLSPMessage: true,
\r
928 timestamp: Date.now()
\r
930 tracer.log(lspMessage);
\r
932 function throwIfClosedOrDisposed() {
\r
934 throw new ConnectionError(ConnectionErrors.Closed, 'Connection is closed.');
\r
936 if (isDisposed()) {
\r
937 throw new ConnectionError(ConnectionErrors.Disposed, 'Connection is disposed.');
\r
940 function throwIfListening() {
\r
941 if (isListening()) {
\r
942 throw new ConnectionError(ConnectionErrors.AlreadyListening, 'Connection is already listening');
\r
945 function throwIfNotListening() {
\r
946 if (!isListening()) {
\r
947 throw new Error('Call listen() first.');
\r
950 function undefinedToNull(param) {
\r
951 if (param === void 0) {
\r
958 function computeMessageParams(type, params) {
\r
960 let numberOfParams = type.numberOfParams;
\r
961 switch (numberOfParams) {
\r
966 result = undefinedToNull(params[0]);
\r
970 for (let i = 0; i < params.length && i < numberOfParams; i++) {
\r
971 result.push(undefinedToNull(params[i]));
\r
973 if (params.length < numberOfParams) {
\r
974 for (let i = params.length; i < numberOfParams; i++) {
\r
983 sendNotification: (type, ...params) => {
\r
984 throwIfClosedOrDisposed();
\r
987 if (Is.string(type)) {
\r
989 switch (params.length) {
\r
991 messageParams = null;
\r
994 messageParams = params[0];
\r
997 messageParams = params;
\r
1002 method = type.method;
\r
1003 messageParams = computeMessageParams(type, params);
\r
1005 let notificationMessage = {
\r
1008 params: messageParams
\r
1010 traceSendingNotification(notificationMessage);
\r
1011 messageWriter.write(notificationMessage);
\r
1013 onNotification: (type, handler) => {
\r
1014 throwIfClosedOrDisposed();
\r
1015 if (Is.func(type)) {
\r
1016 starNotificationHandler = type;
\r
1018 else if (handler) {
\r
1019 if (Is.string(type)) {
\r
1020 notificationHandlers[type] = { type: undefined, handler };
\r
1023 notificationHandlers[type.method] = { type, handler };
\r
1027 onProgress: (_type, token, handler) => {
\r
1028 if (progressHandlers.has(token)) {
\r
1029 throw new Error(`Progress handler for token ${token} already registered`);
\r
1031 progressHandlers.set(token, handler);
\r
1034 progressHandlers.delete(token);
\r
1038 sendProgress: (_type, token, value) => {
\r
1039 connection.sendNotification(ProgressNotification.type, { token, value });
\r
1041 onUnhandledProgress: unhandledProgressEmitter.event,
\r
1042 sendRequest: (type, ...params) => {
\r
1043 throwIfClosedOrDisposed();
\r
1044 throwIfNotListening();
\r
1046 let messageParams;
\r
1047 let token = undefined;
\r
1048 if (Is.string(type)) {
\r
1050 switch (params.length) {
\r
1052 messageParams = null;
\r
1055 // The cancellation token is optional so it can also be undefined.
\r
1056 if (cancellation_1.CancellationToken.is(params[0])) {
\r
1057 messageParams = null;
\r
1058 token = params[0];
\r
1061 messageParams = undefinedToNull(params[0]);
\r
1065 const last = params.length - 1;
\r
1066 if (cancellation_1.CancellationToken.is(params[last])) {
\r
1067 token = params[last];
\r
1068 if (params.length === 2) {
\r
1069 messageParams = undefinedToNull(params[0]);
\r
1072 messageParams = params.slice(0, last).map(value => undefinedToNull(value));
\r
1076 messageParams = params.map(value => undefinedToNull(value));
\r
1082 method = type.method;
\r
1083 messageParams = computeMessageParams(type, params);
\r
1084 let numberOfParams = type.numberOfParams;
\r
1085 token = cancellation_1.CancellationToken.is(params[numberOfParams]) ? params[numberOfParams] : undefined;
\r
1087 let id = sequenceNumber++;
\r
1088 let result = new Promise((resolve, reject) => {
\r
1089 let requestMessage = {
\r
1093 params: messageParams
\r
1095 let responsePromise = { method: method, timerStart: Date.now(), resolve, reject };
\r
1096 traceSendingRequest(requestMessage);
\r
1098 messageWriter.write(requestMessage);
\r
1101 // Writing the message failed. So we need to reject the promise.
\r
1102 responsePromise.reject(new messages_1.ResponseError(messages_1.ErrorCodes.MessageWriteError, e.message ? e.message : 'Unknown reason'));
\r
1103 responsePromise = null;
\r
1105 if (responsePromise) {
\r
1106 responsePromises[String(id)] = responsePromise;
\r
1110 token.onCancellationRequested(() => {
\r
1111 connection.sendNotification(CancelNotification.type, { id });
\r
1116 onRequest: (type, handler) => {
\r
1117 throwIfClosedOrDisposed();
\r
1118 if (Is.func(type)) {
\r
1119 starRequestHandler = type;
\r
1121 else if (handler) {
\r
1122 if (Is.string(type)) {
\r
1123 requestHandlers[type] = { type: undefined, handler };
\r
1126 requestHandlers[type.method] = { type, handler };
\r
1130 trace: (_value, _tracer, sendNotificationOrTraceOptions) => {
\r
1131 let _sendNotification = false;
\r
1132 let _traceFormat = TraceFormat.Text;
\r
1133 if (sendNotificationOrTraceOptions !== void 0) {
\r
1134 if (Is.boolean(sendNotificationOrTraceOptions)) {
\r
1135 _sendNotification = sendNotificationOrTraceOptions;
\r
1138 _sendNotification = sendNotificationOrTraceOptions.sendNotification || false;
\r
1139 _traceFormat = sendNotificationOrTraceOptions.traceFormat || TraceFormat.Text;
\r
1143 traceFormat = _traceFormat;
\r
1144 if (trace === Trace.Off) {
\r
1145 tracer = undefined;
\r
1150 if (_sendNotification && !isClosed() && !isDisposed()) {
\r
1151 connection.sendNotification(SetTraceNotification.type, { value: Trace.toString(_value) });
\r
1154 onError: errorEmitter.event,
\r
1155 onClose: closeEmitter.event,
\r
1156 onUnhandledNotification: unhandledNotificationEmitter.event,
\r
1157 onDispose: disposeEmitter.event,
\r
1159 if (isDisposed()) {
\r
1162 state = ConnectionState.Disposed;
\r
1163 disposeEmitter.fire(undefined);
\r
1164 let error = new Error('Connection got disposed.');
\r
1165 Object.keys(responsePromises).forEach((key) => {
\r
1166 responsePromises[key].reject(error);
\r
1168 responsePromises = Object.create(null);
\r
1169 requestTokens = Object.create(null);
\r
1170 messageQueue = new linkedMap_1.LinkedMap();
\r
1171 // Test for backwards compatibility
\r
1172 if (Is.func(messageWriter.dispose)) {
\r
1173 messageWriter.dispose();
\r
1175 if (Is.func(messageReader.dispose)) {
\r
1176 messageReader.dispose();
\r
1180 throwIfClosedOrDisposed();
\r
1181 throwIfListening();
\r
1182 state = ConnectionState.Listening;
\r
1183 messageReader.listen(callback);
\r
1186 // eslint-disable-next-line no-console
\r
1187 console.log('inspect');
\r
1190 connection.onNotification(LogTraceNotification.type, (params) => {
\r
1191 if (trace === Trace.Off || !tracer) {
\r
1194 tracer.log(params.message, trace === Trace.Verbose ? params.verbose : undefined);
\r
1196 connection.onNotification(ProgressNotification.type, (params) => {
\r
1197 const handler = progressHandlers.get(params.token);
\r
1199 handler(params.value);
\r
1202 unhandledProgressEmitter.fire(params);
\r
1205 return connection;
\r
1207 function isMessageReader(value) {
\r
1208 return value.listen !== void 0 && value.read === void 0;
\r
1210 function isMessageWriter(value) {
\r
1211 return value.write !== void 0 && value.end === void 0;
\r
1213 function createMessageConnection(input, output, logger, strategy) {
\r
1215 logger = exports.NullLogger;
\r
1217 let reader = isMessageReader(input) ? input : new messageReader_1.StreamMessageReader(input);
\r
1218 let writer = isMessageWriter(output) ? output : new messageWriter_1.StreamMessageWriter(output);
\r
1219 return _createMessageConnection(reader, writer, logger, strategy);
\r
1221 exports.createMessageConnection = createMessageConnection;
\r
1226 /***/ ((__unused_webpack_module, exports) => {
1228 /* --------------------------------------------------------------------------------------------
\r
1229 * Copyright (c) Microsoft Corporation. All rights reserved.
\r
1230 * Licensed under the MIT License. See License.txt in the project root for license information.
\r
1231 * ------------------------------------------------------------------------------------------ */
\r
1233 Object.defineProperty(exports, "__esModule", ({ value: true }));
\r
1234 function boolean(value) {
\r
1235 return value === true || value === false;
\r
1237 exports.boolean = boolean;
\r
1238 function string(value) {
\r
1239 return typeof value === 'string' || value instanceof String;
\r
1241 exports.string = string;
\r
1242 function number(value) {
\r
1243 return typeof value === 'number' || value instanceof Number;
\r
1245 exports.number = number;
\r
1246 function error(value) {
\r
1247 return value instanceof Error;
\r
1249 exports.error = error;
\r
1250 function func(value) {
\r
1251 return typeof value === 'function';
\r
1253 exports.func = func;
\r
1254 function array(value) {
\r
1255 return Array.isArray(value);
\r
1257 exports.array = array;
\r
1258 function stringArray(value) {
\r
1259 return array(value) && value.every(elem => string(elem));
\r
1261 exports.stringArray = stringArray;
\r
1266 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
1268 /* --------------------------------------------------------------------------------------------
\r
1269 * Copyright (c) Microsoft Corporation. All rights reserved.
\r
1270 * Licensed under the MIT License. See License.txt in the project root for license information.
\r
1271 * ------------------------------------------------------------------------------------------ */
\r
1273 Object.defineProperty(exports, "__esModule", ({ value: true }));
\r
1274 const is = __webpack_require__(6);
\r
1276 * Predefined error codes.
\r
1279 (function (ErrorCodes) {
\r
1280 // Defined by JSON RPC
\r
1281 ErrorCodes.ParseError = -32700;
\r
1282 ErrorCodes.InvalidRequest = -32600;
\r
1283 ErrorCodes.MethodNotFound = -32601;
\r
1284 ErrorCodes.InvalidParams = -32602;
\r
1285 ErrorCodes.InternalError = -32603;
\r
1286 ErrorCodes.serverErrorStart = -32099;
\r
1287 ErrorCodes.serverErrorEnd = -32000;
\r
1288 ErrorCodes.ServerNotInitialized = -32002;
\r
1289 ErrorCodes.UnknownErrorCode = -32001;
\r
1290 // Defined by the protocol.
\r
1291 ErrorCodes.RequestCancelled = -32800;
\r
1292 ErrorCodes.ContentModified = -32801;
\r
1293 // Defined by VSCode library.
\r
1294 ErrorCodes.MessageWriteError = 1;
\r
1295 ErrorCodes.MessageReadError = 2;
\r
1296 })(ErrorCodes = exports.ErrorCodes || (exports.ErrorCodes = {}));
\r
1298 * An error object return in a response in case a request
\r
1301 class ResponseError extends Error {
\r
1302 constructor(code, message, data) {
\r
1304 this.code = is.number(code) ? code : ErrorCodes.UnknownErrorCode;
\r
1306 Object.setPrototypeOf(this, ResponseError.prototype);
\r
1311 message: this.message,
\r
1316 exports.ResponseError = ResponseError;
\r
1318 * An abstract implementation of a MessageType.
\r
1320 class AbstractMessageType {
\r
1321 constructor(_method, _numberOfParams) {
\r
1322 this._method = _method;
\r
1323 this._numberOfParams = _numberOfParams;
\r
1326 return this._method;
\r
1328 get numberOfParams() {
\r
1329 return this._numberOfParams;
\r
1332 exports.AbstractMessageType = AbstractMessageType;
\r
1334 * Classes to type request response pairs
\r
1336 * The type parameter RO will be removed in the next major version
\r
1337 * of the JSON RPC library since it is a LSP concept and doesn't
\r
1338 * belong here. For now it is tagged as default never.
\r
1340 class RequestType0 extends AbstractMessageType {
\r
1341 constructor(method) {
\r
1345 exports.RequestType0 = RequestType0;
\r
1346 class RequestType extends AbstractMessageType {
\r
1347 constructor(method) {
\r
1351 exports.RequestType = RequestType;
\r
1352 class RequestType1 extends AbstractMessageType {
\r
1353 constructor(method) {
\r
1357 exports.RequestType1 = RequestType1;
\r
1358 class RequestType2 extends AbstractMessageType {
\r
1359 constructor(method) {
\r
1363 exports.RequestType2 = RequestType2;
\r
1364 class RequestType3 extends AbstractMessageType {
\r
1365 constructor(method) {
\r
1369 exports.RequestType3 = RequestType3;
\r
1370 class RequestType4 extends AbstractMessageType {
\r
1371 constructor(method) {
\r
1375 exports.RequestType4 = RequestType4;
\r
1376 class RequestType5 extends AbstractMessageType {
\r
1377 constructor(method) {
\r
1381 exports.RequestType5 = RequestType5;
\r
1382 class RequestType6 extends AbstractMessageType {
\r
1383 constructor(method) {
\r
1387 exports.RequestType6 = RequestType6;
\r
1388 class RequestType7 extends AbstractMessageType {
\r
1389 constructor(method) {
\r
1393 exports.RequestType7 = RequestType7;
\r
1394 class RequestType8 extends AbstractMessageType {
\r
1395 constructor(method) {
\r
1399 exports.RequestType8 = RequestType8;
\r
1400 class RequestType9 extends AbstractMessageType {
\r
1401 constructor(method) {
\r
1405 exports.RequestType9 = RequestType9;
\r
1407 * The type parameter RO will be removed in the next major version
\r
1408 * of the JSON RPC library since it is a LSP concept and doesn't
\r
1409 * belong here. For now it is tagged as default never.
\r
1411 class NotificationType extends AbstractMessageType {
\r
1412 constructor(method) {
\r
1414 this._ = undefined;
\r
1417 exports.NotificationType = NotificationType;
\r
1418 class NotificationType0 extends AbstractMessageType {
\r
1419 constructor(method) {
\r
1423 exports.NotificationType0 = NotificationType0;
\r
1424 class NotificationType1 extends AbstractMessageType {
\r
1425 constructor(method) {
\r
1429 exports.NotificationType1 = NotificationType1;
\r
1430 class NotificationType2 extends AbstractMessageType {
\r
1431 constructor(method) {
\r
1435 exports.NotificationType2 = NotificationType2;
\r
1436 class NotificationType3 extends AbstractMessageType {
\r
1437 constructor(method) {
\r
1441 exports.NotificationType3 = NotificationType3;
\r
1442 class NotificationType4 extends AbstractMessageType {
\r
1443 constructor(method) {
\r
1447 exports.NotificationType4 = NotificationType4;
\r
1448 class NotificationType5 extends AbstractMessageType {
\r
1449 constructor(method) {
\r
1453 exports.NotificationType5 = NotificationType5;
\r
1454 class NotificationType6 extends AbstractMessageType {
\r
1455 constructor(method) {
\r
1459 exports.NotificationType6 = NotificationType6;
\r
1460 class NotificationType7 extends AbstractMessageType {
\r
1461 constructor(method) {
\r
1465 exports.NotificationType7 = NotificationType7;
\r
1466 class NotificationType8 extends AbstractMessageType {
\r
1467 constructor(method) {
\r
1471 exports.NotificationType8 = NotificationType8;
\r
1472 class NotificationType9 extends AbstractMessageType {
\r
1473 constructor(method) {
\r
1477 exports.NotificationType9 = NotificationType9;
\r
1479 * Tests if the given message is a request message
\r
1481 function isRequestMessage(message) {
\r
1482 let candidate = message;
\r
1483 return candidate && is.string(candidate.method) && (is.string(candidate.id) || is.number(candidate.id));
\r
1485 exports.isRequestMessage = isRequestMessage;
\r
1487 * Tests if the given message is a notification message
\r
1489 function isNotificationMessage(message) {
\r
1490 let candidate = message;
\r
1491 return candidate && is.string(candidate.method) && message.id === void 0;
\r
1493 exports.isNotificationMessage = isNotificationMessage;
\r
1495 * Tests if the given message is a response message
\r
1497 function isResponseMessage(message) {
\r
1498 let candidate = message;
\r
1499 return candidate && (candidate.result !== void 0 || !!candidate.error) && (is.string(candidate.id) || is.number(candidate.id) || candidate.id === null);
\r
1501 exports.isResponseMessage = isResponseMessage;
\r
1506 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
1508 /* --------------------------------------------------------------------------------------------
\r
1509 * Copyright (c) Microsoft Corporation. All rights reserved.
\r
1510 * Licensed under the MIT License. See License.txt in the project root for license information.
\r
1511 * ------------------------------------------------------------------------------------------ */
\r
1513 Object.defineProperty(exports, "__esModule", ({ value: true }));
\r
1514 const events_1 = __webpack_require__(9);
\r
1515 const Is = __webpack_require__(6);
\r
1516 let DefaultSize = 8192;
\r
1517 let CR = Buffer.from('\r', 'ascii')[0];
\r
1518 let LF = Buffer.from('\n', 'ascii')[0];
\r
1519 let CRLF = '\r\n';
\r
1520 class MessageBuffer {
\r
1521 constructor(encoding = 'utf8') {
\r
1522 this.encoding = encoding;
\r
1524 this.buffer = Buffer.allocUnsafe(DefaultSize);
\r
1527 var toAppend = chunk;
\r
1528 if (typeof (chunk) === 'string') {
\r
1530 var bufferLen = Buffer.byteLength(str, this.encoding);
\r
1531 toAppend = Buffer.allocUnsafe(bufferLen);
\r
1532 toAppend.write(str, 0, bufferLen, this.encoding);
\r
1534 if (this.buffer.length - this.index >= toAppend.length) {
\r
1535 toAppend.copy(this.buffer, this.index, 0, toAppend.length);
\r
1538 var newSize = (Math.ceil((this.index + toAppend.length) / DefaultSize) + 1) * DefaultSize;
\r
1539 if (this.index === 0) {
\r
1540 this.buffer = Buffer.allocUnsafe(newSize);
\r
1541 toAppend.copy(this.buffer, 0, 0, toAppend.length);
\r
1544 this.buffer = Buffer.concat([this.buffer.slice(0, this.index), toAppend], newSize);
\r
1547 this.index += toAppend.length;
\r
1549 tryReadHeaders() {
\r
1550 let result = undefined;
\r
1552 while (current + 3 < this.index && (this.buffer[current] !== CR || this.buffer[current + 1] !== LF || this.buffer[current + 2] !== CR || this.buffer[current + 3] !== LF)) {
\r
1555 // No header / body separator found (e.g CRLFCRLF)
\r
1556 if (current + 3 >= this.index) {
\r
1559 result = Object.create(null);
\r
1560 let headers = this.buffer.toString('ascii', 0, current).split(CRLF);
\r
1561 headers.forEach((header) => {
\r
1562 let index = header.indexOf(':');
\r
1563 if (index === -1) {
\r
1564 throw new Error('Message header must separate key and value using :');
\r
1566 let key = header.substr(0, index);
\r
1567 let value = header.substr(index + 1).trim();
\r
1568 result[key] = value;
\r
1570 let nextStart = current + 4;
\r
1571 this.buffer = this.buffer.slice(nextStart);
\r
1572 this.index = this.index - nextStart;
\r
1575 tryReadContent(length) {
\r
1576 if (this.index < length) {
\r
1579 let result = this.buffer.toString(this.encoding, 0, length);
\r
1580 let nextStart = length;
\r
1581 this.buffer.copy(this.buffer, 0, nextStart);
\r
1582 this.index = this.index - nextStart;
\r
1585 get numberOfBytes() {
\r
1586 return this.index;
\r
1589 var MessageReader;
\r
1590 (function (MessageReader) {
\r
1591 function is(value) {
\r
1592 let candidate = value;
\r
1593 return candidate && Is.func(candidate.listen) && Is.func(candidate.dispose) &&
\r
1594 Is.func(candidate.onError) && Is.func(candidate.onClose) && Is.func(candidate.onPartialMessage);
\r
1596 MessageReader.is = is;
\r
1597 })(MessageReader = exports.MessageReader || (exports.MessageReader = {}));
\r
1598 class AbstractMessageReader {
\r
1600 this.errorEmitter = new events_1.Emitter();
\r
1601 this.closeEmitter = new events_1.Emitter();
\r
1602 this.partialMessageEmitter = new events_1.Emitter();
\r
1605 this.errorEmitter.dispose();
\r
1606 this.closeEmitter.dispose();
\r
1609 return this.errorEmitter.event;
\r
1611 fireError(error) {
\r
1612 this.errorEmitter.fire(this.asError(error));
\r
1615 return this.closeEmitter.event;
\r
1618 this.closeEmitter.fire(undefined);
\r
1620 get onPartialMessage() {
\r
1621 return this.partialMessageEmitter.event;
\r
1623 firePartialMessage(info) {
\r
1624 this.partialMessageEmitter.fire(info);
\r
1627 if (error instanceof Error) {
\r
1631 return new Error(`Reader received error. Reason: ${Is.string(error.message) ? error.message : 'unknown'}`);
\r
1635 exports.AbstractMessageReader = AbstractMessageReader;
\r
1636 class StreamMessageReader extends AbstractMessageReader {
\r
1637 constructor(readable, encoding = 'utf8') {
\r
1639 this.readable = readable;
\r
1640 this.buffer = new MessageBuffer(encoding);
\r
1641 this._partialMessageTimeout = 10000;
\r
1643 set partialMessageTimeout(timeout) {
\r
1644 this._partialMessageTimeout = timeout;
\r
1646 get partialMessageTimeout() {
\r
1647 return this._partialMessageTimeout;
\r
1649 listen(callback) {
\r
1650 this.nextMessageLength = -1;
\r
1651 this.messageToken = 0;
\r
1652 this.partialMessageTimer = undefined;
\r
1653 this.callback = callback;
\r
1654 this.readable.on('data', (data) => {
\r
1655 this.onData(data);
\r
1657 this.readable.on('error', (error) => this.fireError(error));
\r
1658 this.readable.on('close', () => this.fireClose());
\r
1661 this.buffer.append(data);
\r
1663 if (this.nextMessageLength === -1) {
\r
1664 let headers = this.buffer.tryReadHeaders();
\r
1668 let contentLength = headers['Content-Length'];
\r
1669 if (!contentLength) {
\r
1670 throw new Error('Header must provide a Content-Length property.');
\r
1672 let length = parseInt(contentLength);
\r
1673 if (isNaN(length)) {
\r
1674 throw new Error('Content-Length value must be a number.');
\r
1676 this.nextMessageLength = length;
\r
1677 // Take the encoding form the header. For compatibility
\r
1678 // treat both utf-8 and utf8 as node utf8
\r
1680 var msg = this.buffer.tryReadContent(this.nextMessageLength);
\r
1681 if (msg === null) {
\r
1682 /** We haven't received the full message yet. */
\r
1683 this.setPartialMessageTimer();
\r
1686 this.clearPartialMessageTimer();
\r
1687 this.nextMessageLength = -1;
\r
1688 this.messageToken++;
\r
1689 var json = JSON.parse(msg);
\r
1690 this.callback(json);
\r
1693 clearPartialMessageTimer() {
\r
1694 if (this.partialMessageTimer) {
\r
1695 clearTimeout(this.partialMessageTimer);
\r
1696 this.partialMessageTimer = undefined;
\r
1699 setPartialMessageTimer() {
\r
1700 this.clearPartialMessageTimer();
\r
1701 if (this._partialMessageTimeout <= 0) {
\r
1704 this.partialMessageTimer = setTimeout((token, timeout) => {
\r
1705 this.partialMessageTimer = undefined;
\r
1706 if (token === this.messageToken) {
\r
1707 this.firePartialMessage({ messageToken: token, waitingTime: timeout });
\r
1708 this.setPartialMessageTimer();
\r
1710 }, this._partialMessageTimeout, this.messageToken, this._partialMessageTimeout);
\r
1713 exports.StreamMessageReader = StreamMessageReader;
\r
1714 class IPCMessageReader extends AbstractMessageReader {
\r
1715 constructor(process) {
\r
1717 this.process = process;
\r
1718 let eventEmitter = this.process;
\r
1719 eventEmitter.on('error', (error) => this.fireError(error));
\r
1720 eventEmitter.on('close', () => this.fireClose());
\r
1722 listen(callback) {
\r
1723 this.process.on('message', callback);
\r
1726 exports.IPCMessageReader = IPCMessageReader;
\r
1727 class SocketMessageReader extends StreamMessageReader {
\r
1728 constructor(socket, encoding = 'utf-8') {
\r
1729 super(socket, encoding);
\r
1732 exports.SocketMessageReader = SocketMessageReader;
\r
1737 /***/ ((__unused_webpack_module, exports) => {
1739 /* --------------------------------------------------------------------------------------------
\r
1740 * Copyright (c) Microsoft Corporation. All rights reserved.
\r
1741 * Licensed under the MIT License. See License.txt in the project root for license information.
\r
1742 * ------------------------------------------------------------------------------------------ */
\r
1744 Object.defineProperty(exports, "__esModule", ({ value: true }));
\r
1746 (function (Disposable) {
\r
1747 function create(func) {
\r
1752 Disposable.create = create;
\r
1753 })(Disposable = exports.Disposable || (exports.Disposable = {}));
\r
1755 (function (Event) {
\r
1756 const _disposable = { dispose() { } };
\r
1757 Event.None = function () { return _disposable; };
\r
1758 })(Event = exports.Event || (exports.Event = {}));
\r
1759 class CallbackList {
\r
1760 add(callback, context = null, bucket) {
\r
1761 if (!this._callbacks) {
\r
1762 this._callbacks = [];
\r
1763 this._contexts = [];
\r
1765 this._callbacks.push(callback);
\r
1766 this._contexts.push(context);
\r
1767 if (Array.isArray(bucket)) {
\r
1768 bucket.push({ dispose: () => this.remove(callback, context) });
\r
1771 remove(callback, context = null) {
\r
1772 if (!this._callbacks) {
\r
1775 var foundCallbackWithDifferentContext = false;
\r
1776 for (var i = 0, len = this._callbacks.length; i < len; i++) {
\r
1777 if (this._callbacks[i] === callback) {
\r
1778 if (this._contexts[i] === context) {
\r
1779 // callback & context match => remove it
\r
1780 this._callbacks.splice(i, 1);
\r
1781 this._contexts.splice(i, 1);
\r
1785 foundCallbackWithDifferentContext = true;
\r
1789 if (foundCallbackWithDifferentContext) {
\r
1790 throw new Error('When adding a listener with a context, you should remove it with the same context');
\r
1794 if (!this._callbacks) {
\r
1797 var ret = [], callbacks = this._callbacks.slice(0), contexts = this._contexts.slice(0);
\r
1798 for (var i = 0, len = callbacks.length; i < len; i++) {
\r
1800 ret.push(callbacks[i].apply(contexts[i], args));
\r
1803 // eslint-disable-next-line no-console
\r
1810 return !this._callbacks || this._callbacks.length === 0;
\r
1813 this._callbacks = undefined;
\r
1814 this._contexts = undefined;
\r
1818 constructor(_options) {
\r
1819 this._options = _options;
\r
1822 * For the public to allow to subscribe
\r
1823 * to events from this Emitter
\r
1826 if (!this._event) {
\r
1827 this._event = (listener, thisArgs, disposables) => {
\r
1828 if (!this._callbacks) {
\r
1829 this._callbacks = new CallbackList();
\r
1831 if (this._options && this._options.onFirstListenerAdd && this._callbacks.isEmpty()) {
\r
1832 this._options.onFirstListenerAdd(this);
\r
1834 this._callbacks.add(listener, thisArgs);
\r
1838 this._callbacks.remove(listener, thisArgs);
\r
1839 result.dispose = Emitter._noop;
\r
1840 if (this._options && this._options.onLastListenerRemove && this._callbacks.isEmpty()) {
\r
1841 this._options.onLastListenerRemove(this);
\r
1845 if (Array.isArray(disposables)) {
\r
1846 disposables.push(result);
\r
1851 return this._event;
\r
1854 * To be kept private to fire an event to
\r
1858 if (this._callbacks) {
\r
1859 this._callbacks.invoke.call(this._callbacks, event);
\r
1863 if (this._callbacks) {
\r
1864 this._callbacks.dispose();
\r
1865 this._callbacks = undefined;
\r
1869 exports.Emitter = Emitter;
\r
1870 Emitter._noop = function () { };
\r
1875 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
1877 /* --------------------------------------------------------------------------------------------
\r
1878 * Copyright (c) Microsoft Corporation. All rights reserved.
\r
1879 * Licensed under the MIT License. See License.txt in the project root for license information.
\r
1880 * ------------------------------------------------------------------------------------------ */
\r
1882 Object.defineProperty(exports, "__esModule", ({ value: true }));
\r
1883 const events_1 = __webpack_require__(9);
\r
1884 const Is = __webpack_require__(6);
\r
1885 let ContentLength = 'Content-Length: ';
\r
1886 let CRLF = '\r\n';
\r
1887 var MessageWriter;
\r
1888 (function (MessageWriter) {
\r
1889 function is(value) {
\r
1890 let candidate = value;
\r
1891 return candidate && Is.func(candidate.dispose) && Is.func(candidate.onClose) &&
\r
1892 Is.func(candidate.onError) && Is.func(candidate.write);
\r
1894 MessageWriter.is = is;
\r
1895 })(MessageWriter = exports.MessageWriter || (exports.MessageWriter = {}));
\r
1896 class AbstractMessageWriter {
\r
1898 this.errorEmitter = new events_1.Emitter();
\r
1899 this.closeEmitter = new events_1.Emitter();
\r
1902 this.errorEmitter.dispose();
\r
1903 this.closeEmitter.dispose();
\r
1906 return this.errorEmitter.event;
\r
1908 fireError(error, message, count) {
\r
1909 this.errorEmitter.fire([this.asError(error), message, count]);
\r
1912 return this.closeEmitter.event;
\r
1915 this.closeEmitter.fire(undefined);
\r
1918 if (error instanceof Error) {
\r
1922 return new Error(`Writer received error. Reason: ${Is.string(error.message) ? error.message : 'unknown'}`);
\r
1926 exports.AbstractMessageWriter = AbstractMessageWriter;
\r
1927 class StreamMessageWriter extends AbstractMessageWriter {
\r
1928 constructor(writable, encoding = 'utf8') {
\r
1930 this.writable = writable;
\r
1931 this.encoding = encoding;
\r
1932 this.errorCount = 0;
\r
1933 this.writable.on('error', (error) => this.fireError(error));
\r
1934 this.writable.on('close', () => this.fireClose());
\r
1937 let json = JSON.stringify(msg);
\r
1938 let contentLength = Buffer.byteLength(json, this.encoding);
\r
1940 ContentLength, contentLength.toString(), CRLF,
\r
1944 // Header must be written in ASCII encoding
\r
1945 this.writable.write(headers.join(''), 'ascii');
\r
1946 // Now write the content. This can be written in any encoding
\r
1947 this.writable.write(json, this.encoding);
\r
1948 this.errorCount = 0;
\r
1951 this.errorCount++;
\r
1952 this.fireError(error, msg, this.errorCount);
\r
1956 exports.StreamMessageWriter = StreamMessageWriter;
\r
1957 class IPCMessageWriter extends AbstractMessageWriter {
\r
1958 constructor(process) {
\r
1960 this.process = process;
\r
1961 this.errorCount = 0;
\r
1963 this.sending = false;
\r
1964 let eventEmitter = this.process;
\r
1965 eventEmitter.on('error', (error) => this.fireError(error));
\r
1966 eventEmitter.on('close', () => this.fireClose);
\r
1969 if (!this.sending && this.queue.length === 0) {
\r
1970 // See https://github.com/nodejs/node/issues/7657
\r
1971 this.doWriteMessage(msg);
\r
1974 this.queue.push(msg);
\r
1977 doWriteMessage(msg) {
\r
1979 if (this.process.send) {
\r
1980 this.sending = true;
\r
1981 this.process.send(msg, undefined, undefined, (error) => {
\r
1982 this.sending = false;
\r
1984 this.errorCount++;
\r
1985 this.fireError(error, msg, this.errorCount);
\r
1988 this.errorCount = 0;
\r
1990 if (this.queue.length > 0) {
\r
1991 this.doWriteMessage(this.queue.shift());
\r
1997 this.errorCount++;
\r
1998 this.fireError(error, msg, this.errorCount);
\r
2002 exports.IPCMessageWriter = IPCMessageWriter;
\r
2003 class SocketMessageWriter extends AbstractMessageWriter {
\r
2004 constructor(socket, encoding = 'utf8') {
\r
2006 this.socket = socket;
\r
2008 this.sending = false;
\r
2009 this.encoding = encoding;
\r
2010 this.errorCount = 0;
\r
2011 this.socket.on('error', (error) => this.fireError(error));
\r
2012 this.socket.on('close', () => this.fireClose());
\r
2016 this.socket.destroy();
\r
2019 if (!this.sending && this.queue.length === 0) {
\r
2020 // See https://github.com/nodejs/node/issues/7657
\r
2021 this.doWriteMessage(msg);
\r
2024 this.queue.push(msg);
\r
2027 doWriteMessage(msg) {
\r
2028 let json = JSON.stringify(msg);
\r
2029 let contentLength = Buffer.byteLength(json, this.encoding);
\r
2031 ContentLength, contentLength.toString(), CRLF,
\r
2035 // Header must be written in ASCII encoding
\r
2036 this.sending = true;
\r
2037 this.socket.write(headers.join(''), 'ascii', (error) => {
\r
2039 this.handleError(error, msg);
\r
2042 // Now write the content. This can be written in any encoding
\r
2043 this.socket.write(json, this.encoding, (error) => {
\r
2044 this.sending = false;
\r
2046 this.handleError(error, msg);
\r
2049 this.errorCount = 0;
\r
2051 if (this.queue.length > 0) {
\r
2052 this.doWriteMessage(this.queue.shift());
\r
2057 this.handleError(error, msg);
\r
2062 this.handleError(error, msg);
\r
2065 handleError(error, msg) {
\r
2066 this.errorCount++;
\r
2067 this.fireError(error, msg, this.errorCount);
\r
2070 exports.SocketMessageWriter = SocketMessageWriter;
\r
2075 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
2077 /*---------------------------------------------------------------------------------------------
\r
2078 * Copyright (c) Microsoft Corporation. All rights reserved.
\r
2079 * Licensed under the MIT License. See License.txt in the project root for license information.
\r
2080 *--------------------------------------------------------------------------------------------*/
\r
2082 Object.defineProperty(exports, "__esModule", ({ value: true }));
\r
2083 const events_1 = __webpack_require__(9);
\r
2084 const Is = __webpack_require__(6);
\r
2085 var CancellationToken;
\r
2086 (function (CancellationToken) {
\r
2087 CancellationToken.None = Object.freeze({
\r
2088 isCancellationRequested: false,
\r
2089 onCancellationRequested: events_1.Event.None
\r
2091 CancellationToken.Cancelled = Object.freeze({
\r
2092 isCancellationRequested: true,
\r
2093 onCancellationRequested: events_1.Event.None
\r
2095 function is(value) {
\r
2096 let candidate = value;
\r
2097 return candidate && (candidate === CancellationToken.None
\r
2098 || candidate === CancellationToken.Cancelled
\r
2099 || (Is.boolean(candidate.isCancellationRequested) && !!candidate.onCancellationRequested));
\r
2101 CancellationToken.is = is;
\r
2102 })(CancellationToken = exports.CancellationToken || (exports.CancellationToken = {}));
\r
2103 const shortcutEvent = Object.freeze(function (callback, context) {
\r
2104 let handle = setTimeout(callback.bind(context), 0);
\r
2105 return { dispose() { clearTimeout(handle); } };
\r
2107 class MutableToken {
\r
2109 this._isCancelled = false;
\r
2112 if (!this._isCancelled) {
\r
2113 this._isCancelled = true;
\r
2114 if (this._emitter) {
\r
2115 this._emitter.fire(undefined);
\r
2120 get isCancellationRequested() {
\r
2121 return this._isCancelled;
\r
2123 get onCancellationRequested() {
\r
2124 if (this._isCancelled) {
\r
2125 return shortcutEvent;
\r
2127 if (!this._emitter) {
\r
2128 this._emitter = new events_1.Emitter();
\r
2130 return this._emitter.event;
\r
2133 if (this._emitter) {
\r
2134 this._emitter.dispose();
\r
2135 this._emitter = undefined;
\r
2139 class CancellationTokenSource {
\r
2141 if (!this._token) {
\r
2142 // be lazy and create the token only when
\r
2143 // actually needed
\r
2144 this._token = new MutableToken();
\r
2146 return this._token;
\r
2149 if (!this._token) {
\r
2150 // save an object by returning the default
\r
2151 // cancelled token when cancellation happens
\r
2152 // before someone asks for the token
\r
2153 this._token = CancellationToken.Cancelled;
\r
2156 this._token.cancel();
\r
2160 if (!this._token) {
\r
2161 // ensure to initialize with an empty token if we had none
\r
2162 this._token = CancellationToken.None;
\r
2164 else if (this._token instanceof MutableToken) {
\r
2165 // actually dispose
\r
2166 this._token.dispose();
\r
2170 exports.CancellationTokenSource = CancellationTokenSource;
\r
2175 /***/ ((__unused_webpack_module, exports) => {
2178 /*---------------------------------------------------------------------------------------------
\r
2179 * Copyright (c) Microsoft Corporation. All rights reserved.
\r
2180 * Licensed under the MIT License. See License.txt in the project root for license information.
\r
2181 *--------------------------------------------------------------------------------------------*/
\r
2182 Object.defineProperty(exports, "__esModule", ({ value: true }));
\r
2184 (function (Touch) {
\r
2188 })(Touch = exports.Touch || (exports.Touch = {}));
\r
2191 this._map = new Map();
\r
2192 this._head = undefined;
\r
2193 this._tail = undefined;
\r
2197 this._map.clear();
\r
2198 this._head = undefined;
\r
2199 this._tail = undefined;
\r
2203 return !this._head && !this._tail;
\r
2206 return this._size;
\r
2209 return this._map.has(key);
\r
2212 const item = this._map.get(key);
\r
2216 return item.value;
\r
2218 set(key, value, touch = Touch.None) {
\r
2219 let item = this._map.get(key);
\r
2221 item.value = value;
\r
2222 if (touch !== Touch.None) {
\r
2223 this.touch(item, touch);
\r
2227 item = { key, value, next: undefined, previous: undefined };
\r
2230 this.addItemLast(item);
\r
2233 this.addItemFirst(item);
\r
2236 this.addItemLast(item);
\r
2239 this.addItemLast(item);
\r
2242 this._map.set(key, item);
\r
2247 const item = this._map.get(key);
\r
2251 this._map.delete(key);
\r
2252 this.removeItem(item);
\r
2257 if (!this._head && !this._tail) {
\r
2260 if (!this._head || !this._tail) {
\r
2261 throw new Error('Invalid list');
\r
2263 const item = this._head;
\r
2264 this._map.delete(item.key);
\r
2265 this.removeItem(item);
\r
2267 return item.value;
\r
2269 forEach(callbackfn, thisArg) {
\r
2270 let current = this._head;
\r
2273 callbackfn.bind(thisArg)(current.value, current.key, this);
\r
2276 callbackfn(current.value, current.key, this);
\r
2278 current = current.next;
\r
2281 forEachReverse(callbackfn, thisArg) {
\r
2282 let current = this._tail;
\r
2285 callbackfn.bind(thisArg)(current.value, current.key, this);
\r
2288 callbackfn(current.value, current.key, this);
\r
2290 current = current.previous;
\r
2295 let current = this._head;
\r
2297 result.push(current.value);
\r
2298 current = current.next;
\r
2304 let current = this._head;
\r
2306 result.push(current.key);
\r
2307 current = current.next;
\r
2311 /* JSON RPC run on es5 which has no Symbol.iterator
\r
2312 public keys(): IterableIterator<K> {
\r
2313 let current = this._head;
\r
2314 let iterator: IterableIterator<K> = {
\r
2315 [Symbol.iterator]() {
\r
2318 next():IteratorResult<K> {
\r
2320 let result = { value: current.key, done: false };
\r
2321 current = current.next;
\r
2324 return { value: undefined, done: true };
\r
2331 public values(): IterableIterator<V> {
\r
2332 let current = this._head;
\r
2333 let iterator: IterableIterator<V> = {
\r
2334 [Symbol.iterator]() {
\r
2337 next():IteratorResult<V> {
\r
2339 let result = { value: current.value, done: false };
\r
2340 current = current.next;
\r
2343 return { value: undefined, done: true };
\r
2350 addItemFirst(item) {
\r
2351 // First time Insert
\r
2352 if (!this._head && !this._tail) {
\r
2353 this._tail = item;
\r
2355 else if (!this._head) {
\r
2356 throw new Error('Invalid list');
\r
2359 item.next = this._head;
\r
2360 this._head.previous = item;
\r
2362 this._head = item;
\r
2364 addItemLast(item) {
\r
2365 // First time Insert
\r
2366 if (!this._head && !this._tail) {
\r
2367 this._head = item;
\r
2369 else if (!this._tail) {
\r
2370 throw new Error('Invalid list');
\r
2373 item.previous = this._tail;
\r
2374 this._tail.next = item;
\r
2376 this._tail = item;
\r
2378 removeItem(item) {
\r
2379 if (item === this._head && item === this._tail) {
\r
2380 this._head = undefined;
\r
2381 this._tail = undefined;
\r
2383 else if (item === this._head) {
\r
2384 this._head = item.next;
\r
2386 else if (item === this._tail) {
\r
2387 this._tail = item.previous;
\r
2390 const next = item.next;
\r
2391 const previous = item.previous;
\r
2392 if (!next || !previous) {
\r
2393 throw new Error('Invalid list');
\r
2395 next.previous = previous;
\r
2396 previous.next = next;
\r
2399 touch(item, touch) {
\r
2400 if (!this._head || !this._tail) {
\r
2401 throw new Error('Invalid list');
\r
2403 if ((touch !== Touch.First && touch !== Touch.Last)) {
\r
2406 if (touch === Touch.First) {
\r
2407 if (item === this._head) {
\r
2410 const next = item.next;
\r
2411 const previous = item.previous;
\r
2412 // Unlink the item
\r
2413 if (item === this._tail) {
\r
2414 // previous must be defined since item was not head but is tail
\r
2415 // So there are more than on item in the map
\r
2416 previous.next = undefined;
\r
2417 this._tail = previous;
\r
2420 // Both next and previous are not undefined since item was neither head nor tail.
\r
2421 next.previous = previous;
\r
2422 previous.next = next;
\r
2424 // Insert the node at head
\r
2425 item.previous = undefined;
\r
2426 item.next = this._head;
\r
2427 this._head.previous = item;
\r
2428 this._head = item;
\r
2430 else if (touch === Touch.Last) {
\r
2431 if (item === this._tail) {
\r
2434 const next = item.next;
\r
2435 const previous = item.previous;
\r
2436 // Unlink the item.
\r
2437 if (item === this._head) {
\r
2438 // next must be defined since item was not tail but is head
\r
2439 // So there are more than on item in the map
\r
2440 next.previous = undefined;
\r
2441 this._head = next;
\r
2444 // Both next and previous are not undefined since item was neither head nor tail.
\r
2445 next.previous = previous;
\r
2446 previous.next = next;
\r
2448 item.next = undefined;
\r
2449 item.previous = this._tail;
\r
2450 this._tail.next = item;
\r
2451 this._tail = item;
\r
2455 exports.LinkedMap = LinkedMap;
\r
2460 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
2462 /* --------------------------------------------------------------------------------------------
\r
2463 * Copyright (c) Microsoft Corporation. All rights reserved.
\r
2464 * Licensed under the MIT License. See License.txt in the project root for license information.
\r
2465 * ------------------------------------------------------------------------------------------ */
\r
2467 Object.defineProperty(exports, "__esModule", ({ value: true }));
\r
2468 const path_1 = __webpack_require__(3);
\r
2469 const os_1 = __webpack_require__(14);
\r
2470 const crypto_1 = __webpack_require__(15);
\r
2471 const net_1 = __webpack_require__(16);
\r
2472 const messageReader_1 = __webpack_require__(8);
\r
2473 const messageWriter_1 = __webpack_require__(10);
\r
2474 function generateRandomPipeName() {
\r
2475 const randomSuffix = crypto_1.randomBytes(21).toString('hex');
\r
2476 if (process.platform === 'win32') {
\r
2477 return `\\\\.\\pipe\\vscode-jsonrpc-${randomSuffix}-sock`;
\r
2480 // Mac/Unix: use socket file
\r
2481 return path_1.join(os_1.tmpdir(), `vscode-${randomSuffix}.sock`);
\r
2484 exports.generateRandomPipeName = generateRandomPipeName;
\r
2485 function createClientPipeTransport(pipeName, encoding = 'utf-8') {
\r
2486 let connectResolve;
\r
2487 let connected = new Promise((resolve, _reject) => {
\r
2488 connectResolve = resolve;
\r
2490 return new Promise((resolve, reject) => {
\r
2491 let server = net_1.createServer((socket) => {
\r
2494 new messageReader_1.SocketMessageReader(socket, encoding),
\r
2495 new messageWriter_1.SocketMessageWriter(socket, encoding)
\r
2498 server.on('error', reject);
\r
2499 server.listen(pipeName, () => {
\r
2500 server.removeListener('error', reject);
\r
2502 onConnected: () => { return connected; }
\r
2507 exports.createClientPipeTransport = createClientPipeTransport;
\r
2508 function createServerPipeTransport(pipeName, encoding = 'utf-8') {
\r
2509 const socket = net_1.createConnection(pipeName);
\r
2511 new messageReader_1.SocketMessageReader(socket, encoding),
\r
2512 new messageWriter_1.SocketMessageWriter(socket, encoding)
\r
2515 exports.createServerPipeTransport = createServerPipeTransport;
\r
2520 /***/ ((module) => {
2522 module.exports = require("os");;
2526 /***/ ((module) => {
2528 module.exports = require("crypto");;
2532 /***/ ((module) => {
2534 module.exports = require("net");;
2538 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
2540 /* --------------------------------------------------------------------------------------------
\r
2541 * Copyright (c) Microsoft Corporation. All rights reserved.
\r
2542 * Licensed under the MIT License. See License.txt in the project root for license information.
\r
2543 * ------------------------------------------------------------------------------------------ */
\r
2545 Object.defineProperty(exports, "__esModule", ({ value: true }));
\r
2546 const net_1 = __webpack_require__(16);
\r
2547 const messageReader_1 = __webpack_require__(8);
\r
2548 const messageWriter_1 = __webpack_require__(10);
\r
2549 function createClientSocketTransport(port, encoding = 'utf-8') {
\r
2550 let connectResolve;
\r
2551 let connected = new Promise((resolve, _reject) => {
\r
2552 connectResolve = resolve;
\r
2554 return new Promise((resolve, reject) => {
\r
2555 let server = net_1.createServer((socket) => {
\r
2558 new messageReader_1.SocketMessageReader(socket, encoding),
\r
2559 new messageWriter_1.SocketMessageWriter(socket, encoding)
\r
2562 server.on('error', reject);
\r
2563 server.listen(port, '127.0.0.1', () => {
\r
2564 server.removeListener('error', reject);
\r
2566 onConnected: () => { return connected; }
\r
2571 exports.createClientSocketTransport = createClientSocketTransport;
\r
2572 function createServerSocketTransport(port, encoding = 'utf-8') {
\r
2573 const socket = net_1.createConnection(port, '127.0.0.1');
\r
2575 new messageReader_1.SocketMessageReader(socket, encoding),
\r
2576 new messageWriter_1.SocketMessageWriter(socket, encoding)
\r
2579 exports.createServerSocketTransport = createServerSocketTransport;
\r
2584 /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
2586 __webpack_require__.r(__webpack_exports__);
2587 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
2588 /* harmony export */ "Position": () => /* binding */ Position,
2589 /* harmony export */ "Range": () => /* binding */ Range,
2590 /* harmony export */ "Location": () => /* binding */ Location,
2591 /* harmony export */ "LocationLink": () => /* binding */ LocationLink,
2592 /* harmony export */ "Color": () => /* binding */ Color,
2593 /* harmony export */ "ColorInformation": () => /* binding */ ColorInformation,
2594 /* harmony export */ "ColorPresentation": () => /* binding */ ColorPresentation,
2595 /* harmony export */ "FoldingRangeKind": () => /* binding */ FoldingRangeKind,
2596 /* harmony export */ "FoldingRange": () => /* binding */ FoldingRange,
2597 /* harmony export */ "DiagnosticRelatedInformation": () => /* binding */ DiagnosticRelatedInformation,
2598 /* harmony export */ "DiagnosticSeverity": () => /* binding */ DiagnosticSeverity,
2599 /* harmony export */ "DiagnosticTag": () => /* binding */ DiagnosticTag,
2600 /* harmony export */ "Diagnostic": () => /* binding */ Diagnostic,
2601 /* harmony export */ "Command": () => /* binding */ Command,
2602 /* harmony export */ "TextEdit": () => /* binding */ TextEdit,
2603 /* harmony export */ "TextDocumentEdit": () => /* binding */ TextDocumentEdit,
2604 /* harmony export */ "CreateFile": () => /* binding */ CreateFile,
2605 /* harmony export */ "RenameFile": () => /* binding */ RenameFile,
2606 /* harmony export */ "DeleteFile": () => /* binding */ DeleteFile,
2607 /* harmony export */ "WorkspaceEdit": () => /* binding */ WorkspaceEdit,
2608 /* harmony export */ "WorkspaceChange": () => /* binding */ WorkspaceChange,
2609 /* harmony export */ "TextDocumentIdentifier": () => /* binding */ TextDocumentIdentifier,
2610 /* harmony export */ "VersionedTextDocumentIdentifier": () => /* binding */ VersionedTextDocumentIdentifier,
2611 /* harmony export */ "TextDocumentItem": () => /* binding */ TextDocumentItem,
2612 /* harmony export */ "MarkupKind": () => /* binding */ MarkupKind,
2613 /* harmony export */ "MarkupContent": () => /* binding */ MarkupContent,
2614 /* harmony export */ "CompletionItemKind": () => /* binding */ CompletionItemKind,
2615 /* harmony export */ "InsertTextFormat": () => /* binding */ InsertTextFormat,
2616 /* harmony export */ "CompletionItemTag": () => /* binding */ CompletionItemTag,
2617 /* harmony export */ "CompletionItem": () => /* binding */ CompletionItem,
2618 /* harmony export */ "CompletionList": () => /* binding */ CompletionList,
2619 /* harmony export */ "MarkedString": () => /* binding */ MarkedString,
2620 /* harmony export */ "Hover": () => /* binding */ Hover,
2621 /* harmony export */ "ParameterInformation": () => /* binding */ ParameterInformation,
2622 /* harmony export */ "SignatureInformation": () => /* binding */ SignatureInformation,
2623 /* harmony export */ "DocumentHighlightKind": () => /* binding */ DocumentHighlightKind,
2624 /* harmony export */ "DocumentHighlight": () => /* binding */ DocumentHighlight,
2625 /* harmony export */ "SymbolKind": () => /* binding */ SymbolKind,
2626 /* harmony export */ "SymbolTag": () => /* binding */ SymbolTag,
2627 /* harmony export */ "SymbolInformation": () => /* binding */ SymbolInformation,
2628 /* harmony export */ "DocumentSymbol": () => /* binding */ DocumentSymbol,
2629 /* harmony export */ "CodeActionKind": () => /* binding */ CodeActionKind,
2630 /* harmony export */ "CodeActionContext": () => /* binding */ CodeActionContext,
2631 /* harmony export */ "CodeAction": () => /* binding */ CodeAction,
2632 /* harmony export */ "CodeLens": () => /* binding */ CodeLens,
2633 /* harmony export */ "FormattingOptions": () => /* binding */ FormattingOptions,
2634 /* harmony export */ "DocumentLink": () => /* binding */ DocumentLink,
2635 /* harmony export */ "SelectionRange": () => /* binding */ SelectionRange,
2636 /* harmony export */ "EOL": () => /* binding */ EOL,
2637 /* harmony export */ "TextDocument": () => /* binding */ TextDocument
2638 /* harmony export */ });
2639 /* --------------------------------------------------------------------------------------------
\r
2640 * Copyright (c) Microsoft Corporation. All rights reserved.
\r
2641 * Licensed under the MIT License. See License.txt in the project root for license information.
\r
2642 * ------------------------------------------------------------------------------------------ */
\r
2645 * The Position namespace provides helper functions to work with
\r
2646 * [Position](#Position) literals.
\r
2649 (function (Position) {
\r
2651 * Creates a new Position literal from the given line and character.
\r
2652 * @param line The position's line.
\r
2653 * @param character The position's character.
\r
2655 function create(line, character) {
\r
2656 return { line: line, character: character };
\r
2658 Position.create = create;
\r
2660 * Checks whether the given liternal conforms to the [Position](#Position) interface.
\r
2662 function is(value) {
\r
2663 var candidate = value;
\r
2664 return Is.objectLiteral(candidate) && Is.number(candidate.line) && Is.number(candidate.character);
\r
2667 })(Position || (Position = {}));
\r
2669 * The Range namespace provides helper functions to work with
\r
2670 * [Range](#Range) literals.
\r
2673 (function (Range) {
\r
2674 function create(one, two, three, four) {
\r
2675 if (Is.number(one) && Is.number(two) && Is.number(three) && Is.number(four)) {
\r
2676 return { start: Position.create(one, two), end: Position.create(three, four) };
\r
2678 else if (Position.is(one) && Position.is(two)) {
\r
2679 return { start: one, end: two };
\r
2682 throw new Error("Range#create called with invalid arguments[" + one + ", " + two + ", " + three + ", " + four + "]");
\r
2685 Range.create = create;
\r
2687 * Checks whether the given literal conforms to the [Range](#Range) interface.
\r
2689 function is(value) {
\r
2690 var candidate = value;
\r
2691 return Is.objectLiteral(candidate) && Position.is(candidate.start) && Position.is(candidate.end);
\r
2694 })(Range || (Range = {}));
\r
2696 * The Location namespace provides helper functions to work with
\r
2697 * [Location](#Location) literals.
\r
2700 (function (Location) {
\r
2702 * Creates a Location literal.
\r
2703 * @param uri The location's uri.
\r
2704 * @param range The location's range.
\r
2706 function create(uri, range) {
\r
2707 return { uri: uri, range: range };
\r
2709 Location.create = create;
\r
2711 * Checks whether the given literal conforms to the [Location](#Location) interface.
\r
2713 function is(value) {
\r
2714 var candidate = value;
\r
2715 return Is.defined(candidate) && Range.is(candidate.range) && (Is.string(candidate.uri) || Is.undefined(candidate.uri));
\r
2718 })(Location || (Location = {}));
\r
2720 * The LocationLink namespace provides helper functions to work with
\r
2721 * [LocationLink](#LocationLink) literals.
\r
2724 (function (LocationLink) {
\r
2726 * Creates a LocationLink literal.
\r
2727 * @param targetUri The definition's uri.
\r
2728 * @param targetRange The full range of the definition.
\r
2729 * @param targetSelectionRange The span of the symbol definition at the target.
\r
2730 * @param originSelectionRange The span of the symbol being defined in the originating source file.
\r
2732 function create(targetUri, targetRange, targetSelectionRange, originSelectionRange) {
\r
2733 return { targetUri: targetUri, targetRange: targetRange, targetSelectionRange: targetSelectionRange, originSelectionRange: originSelectionRange };
\r
2735 LocationLink.create = create;
\r
2737 * Checks whether the given literal conforms to the [LocationLink](#LocationLink) interface.
\r
2739 function is(value) {
\r
2740 var candidate = value;
\r
2741 return Is.defined(candidate) && Range.is(candidate.targetRange) && Is.string(candidate.targetUri)
\r
2742 && (Range.is(candidate.targetSelectionRange) || Is.undefined(candidate.targetSelectionRange))
\r
2743 && (Range.is(candidate.originSelectionRange) || Is.undefined(candidate.originSelectionRange));
\r
2745 LocationLink.is = is;
\r
2746 })(LocationLink || (LocationLink = {}));
\r
2748 * The Color namespace provides helper functions to work with
\r
2749 * [Color](#Color) literals.
\r
2752 (function (Color) {
\r
2754 * Creates a new Color literal.
\r
2756 function create(red, green, blue, alpha) {
\r
2764 Color.create = create;
\r
2766 * Checks whether the given literal conforms to the [Color](#Color) interface.
\r
2768 function is(value) {
\r
2769 var candidate = value;
\r
2770 return Is.number(candidate.red)
\r
2771 && Is.number(candidate.green)
\r
2772 && Is.number(candidate.blue)
\r
2773 && Is.number(candidate.alpha);
\r
2776 })(Color || (Color = {}));
\r
2778 * The ColorInformation namespace provides helper functions to work with
\r
2779 * [ColorInformation](#ColorInformation) literals.
\r
2781 var ColorInformation;
\r
2782 (function (ColorInformation) {
\r
2784 * Creates a new ColorInformation literal.
\r
2786 function create(range, color) {
\r
2792 ColorInformation.create = create;
\r
2794 * Checks whether the given literal conforms to the [ColorInformation](#ColorInformation) interface.
\r
2796 function is(value) {
\r
2797 var candidate = value;
\r
2798 return Range.is(candidate.range) && Color.is(candidate.color);
\r
2800 ColorInformation.is = is;
\r
2801 })(ColorInformation || (ColorInformation = {}));
\r
2803 * The Color namespace provides helper functions to work with
\r
2804 * [ColorPresentation](#ColorPresentation) literals.
\r
2806 var ColorPresentation;
\r
2807 (function (ColorPresentation) {
\r
2809 * Creates a new ColorInformation literal.
\r
2811 function create(label, textEdit, additionalTextEdits) {
\r
2814 textEdit: textEdit,
\r
2815 additionalTextEdits: additionalTextEdits,
\r
2818 ColorPresentation.create = create;
\r
2820 * Checks whether the given literal conforms to the [ColorInformation](#ColorInformation) interface.
\r
2822 function is(value) {
\r
2823 var candidate = value;
\r
2824 return Is.string(candidate.label)
\r
2825 && (Is.undefined(candidate.textEdit) || TextEdit.is(candidate))
\r
2826 && (Is.undefined(candidate.additionalTextEdits) || Is.typedArray(candidate.additionalTextEdits, TextEdit.is));
\r
2828 ColorPresentation.is = is;
\r
2829 })(ColorPresentation || (ColorPresentation = {}));
\r
2831 * Enum of known range kinds
\r
2833 var FoldingRangeKind;
\r
2834 (function (FoldingRangeKind) {
\r
2836 * Folding range for a comment
\r
2838 FoldingRangeKind["Comment"] = "comment";
\r
2840 * Folding range for a imports or includes
\r
2842 FoldingRangeKind["Imports"] = "imports";
\r
2844 * Folding range for a region (e.g. `#region`)
\r
2846 FoldingRangeKind["Region"] = "region";
\r
2847 })(FoldingRangeKind || (FoldingRangeKind = {}));
\r
2849 * The folding range namespace provides helper functions to work with
\r
2850 * [FoldingRange](#FoldingRange) literals.
\r
2853 (function (FoldingRange) {
\r
2855 * Creates a new FoldingRange literal.
\r
2857 function create(startLine, endLine, startCharacter, endCharacter, kind) {
\r
2859 startLine: startLine,
\r
2862 if (Is.defined(startCharacter)) {
\r
2863 result.startCharacter = startCharacter;
\r
2865 if (Is.defined(endCharacter)) {
\r
2866 result.endCharacter = endCharacter;
\r
2868 if (Is.defined(kind)) {
\r
2869 result.kind = kind;
\r
2873 FoldingRange.create = create;
\r
2875 * Checks whether the given literal conforms to the [FoldingRange](#FoldingRange) interface.
\r
2877 function is(value) {
\r
2878 var candidate = value;
\r
2879 return Is.number(candidate.startLine) && Is.number(candidate.startLine)
\r
2880 && (Is.undefined(candidate.startCharacter) || Is.number(candidate.startCharacter))
\r
2881 && (Is.undefined(candidate.endCharacter) || Is.number(candidate.endCharacter))
\r
2882 && (Is.undefined(candidate.kind) || Is.string(candidate.kind));
\r
2884 FoldingRange.is = is;
\r
2885 })(FoldingRange || (FoldingRange = {}));
\r
2887 * The DiagnosticRelatedInformation namespace provides helper functions to work with
\r
2888 * [DiagnosticRelatedInformation](#DiagnosticRelatedInformation) literals.
\r
2890 var DiagnosticRelatedInformation;
\r
2891 (function (DiagnosticRelatedInformation) {
\r
2893 * Creates a new DiagnosticRelatedInformation literal.
\r
2895 function create(location, message) {
\r
2897 location: location,
\r
2901 DiagnosticRelatedInformation.create = create;
\r
2903 * Checks whether the given literal conforms to the [DiagnosticRelatedInformation](#DiagnosticRelatedInformation) interface.
\r
2905 function is(value) {
\r
2906 var candidate = value;
\r
2907 return Is.defined(candidate) && Location.is(candidate.location) && Is.string(candidate.message);
\r
2909 DiagnosticRelatedInformation.is = is;
\r
2910 })(DiagnosticRelatedInformation || (DiagnosticRelatedInformation = {}));
\r
2912 * The diagnostic's severity.
\r
2914 var DiagnosticSeverity;
\r
2915 (function (DiagnosticSeverity) {
\r
2917 * Reports an error.
\r
2919 DiagnosticSeverity.Error = 1;
\r
2921 * Reports a warning.
\r
2923 DiagnosticSeverity.Warning = 2;
\r
2925 * Reports an information.
\r
2927 DiagnosticSeverity.Information = 3;
\r
2931 DiagnosticSeverity.Hint = 4;
\r
2932 })(DiagnosticSeverity || (DiagnosticSeverity = {}));
\r
2934 * The diagnostic tags.
\r
2938 var DiagnosticTag;
\r
2939 (function (DiagnosticTag) {
\r
2941 * Unused or unnecessary code.
\r
2943 * Clients are allowed to render diagnostics with this tag faded out instead of having
\r
2944 * an error squiggle.
\r
2946 DiagnosticTag.Unnecessary = 1;
\r
2948 * Deprecated or obsolete code.
\r
2950 * Clients are allowed to rendered diagnostics with this tag strike through.
\r
2952 DiagnosticTag.Deprecated = 2;
\r
2953 })(DiagnosticTag || (DiagnosticTag = {}));
\r
2955 * The Diagnostic namespace provides helper functions to work with
\r
2956 * [Diagnostic](#Diagnostic) literals.
\r
2959 (function (Diagnostic) {
\r
2961 * Creates a new Diagnostic literal.
\r
2963 function create(range, message, severity, code, source, relatedInformation) {
\r
2964 var result = { range: range, message: message };
\r
2965 if (Is.defined(severity)) {
\r
2966 result.severity = severity;
\r
2968 if (Is.defined(code)) {
\r
2969 result.code = code;
\r
2971 if (Is.defined(source)) {
\r
2972 result.source = source;
\r
2974 if (Is.defined(relatedInformation)) {
\r
2975 result.relatedInformation = relatedInformation;
\r
2979 Diagnostic.create = create;
\r
2981 * Checks whether the given literal conforms to the [Diagnostic](#Diagnostic) interface.
\r
2983 function is(value) {
\r
2984 var candidate = value;
\r
2985 return Is.defined(candidate)
\r
2986 && Range.is(candidate.range)
\r
2987 && Is.string(candidate.message)
\r
2988 && (Is.number(candidate.severity) || Is.undefined(candidate.severity))
\r
2989 && (Is.number(candidate.code) || Is.string(candidate.code) || Is.undefined(candidate.code))
\r
2990 && (Is.string(candidate.source) || Is.undefined(candidate.source))
\r
2991 && (Is.undefined(candidate.relatedInformation) || Is.typedArray(candidate.relatedInformation, DiagnosticRelatedInformation.is));
\r
2993 Diagnostic.is = is;
\r
2994 })(Diagnostic || (Diagnostic = {}));
\r
2996 * The Command namespace provides helper functions to work with
\r
2997 * [Command](#Command) literals.
\r
3000 (function (Command) {
\r
3002 * Creates a new Command literal.
\r
3004 function create(title, command) {
\r
3006 for (var _i = 2; _i < arguments.length; _i++) {
\r
3007 args[_i - 2] = arguments[_i];
\r
3009 var result = { title: title, command: command };
\r
3010 if (Is.defined(args) && args.length > 0) {
\r
3011 result.arguments = args;
\r
3015 Command.create = create;
\r
3017 * Checks whether the given literal conforms to the [Command](#Command) interface.
\r
3019 function is(value) {
\r
3020 var candidate = value;
\r
3021 return Is.defined(candidate) && Is.string(candidate.title) && Is.string(candidate.command);
\r
3024 })(Command || (Command = {}));
\r
3026 * The TextEdit namespace provides helper function to create replace,
\r
3027 * insert and delete edits more easily.
\r
3030 (function (TextEdit) {
\r
3032 * Creates a replace text edit.
\r
3033 * @param range The range of text to be replaced.
\r
3034 * @param newText The new text.
\r
3036 function replace(range, newText) {
\r
3037 return { range: range, newText: newText };
\r
3039 TextEdit.replace = replace;
\r
3041 * Creates a insert text edit.
\r
3042 * @param position The position to insert the text at.
\r
3043 * @param newText The text to be inserted.
\r
3045 function insert(position, newText) {
\r
3046 return { range: { start: position, end: position }, newText: newText };
\r
3048 TextEdit.insert = insert;
\r
3050 * Creates a delete text edit.
\r
3051 * @param range The range of text to be deleted.
\r
3053 function del(range) {
\r
3054 return { range: range, newText: '' };
\r
3056 TextEdit.del = del;
\r
3057 function is(value) {
\r
3058 var candidate = value;
\r
3059 return Is.objectLiteral(candidate)
\r
3060 && Is.string(candidate.newText)
\r
3061 && Range.is(candidate.range);
\r
3064 })(TextEdit || (TextEdit = {}));
\r
3066 * The TextDocumentEdit namespace provides helper function to create
\r
3067 * an edit that manipulates a text document.
\r
3069 var TextDocumentEdit;
\r
3070 (function (TextDocumentEdit) {
\r
3072 * Creates a new `TextDocumentEdit`
\r
3074 function create(textDocument, edits) {
\r
3075 return { textDocument: textDocument, edits: edits };
\r
3077 TextDocumentEdit.create = create;
\r
3078 function is(value) {
\r
3079 var candidate = value;
\r
3080 return Is.defined(candidate)
\r
3081 && VersionedTextDocumentIdentifier.is(candidate.textDocument)
\r
3082 && Array.isArray(candidate.edits);
\r
3084 TextDocumentEdit.is = is;
\r
3085 })(TextDocumentEdit || (TextDocumentEdit = {}));
\r
3087 (function (CreateFile) {
\r
3088 function create(uri, options) {
\r
3093 if (options !== void 0 && (options.overwrite !== void 0 || options.ignoreIfExists !== void 0)) {
\r
3094 result.options = options;
\r
3098 CreateFile.create = create;
\r
3099 function is(value) {
\r
3100 var candidate = value;
\r
3101 return candidate && candidate.kind === 'create' && Is.string(candidate.uri) &&
\r
3102 (candidate.options === void 0 ||
\r
3103 ((candidate.options.overwrite === void 0 || Is.boolean(candidate.options.overwrite)) && (candidate.options.ignoreIfExists === void 0 || Is.boolean(candidate.options.ignoreIfExists))));
\r
3105 CreateFile.is = is;
\r
3106 })(CreateFile || (CreateFile = {}));
\r
3108 (function (RenameFile) {
\r
3109 function create(oldUri, newUri, options) {
\r
3115 if (options !== void 0 && (options.overwrite !== void 0 || options.ignoreIfExists !== void 0)) {
\r
3116 result.options = options;
\r
3120 RenameFile.create = create;
\r
3121 function is(value) {
\r
3122 var candidate = value;
\r
3123 return candidate && candidate.kind === 'rename' && Is.string(candidate.oldUri) && Is.string(candidate.newUri) &&
\r
3124 (candidate.options === void 0 ||
\r
3125 ((candidate.options.overwrite === void 0 || Is.boolean(candidate.options.overwrite)) && (candidate.options.ignoreIfExists === void 0 || Is.boolean(candidate.options.ignoreIfExists))));
\r
3127 RenameFile.is = is;
\r
3128 })(RenameFile || (RenameFile = {}));
\r
3130 (function (DeleteFile) {
\r
3131 function create(uri, options) {
\r
3136 if (options !== void 0 && (options.recursive !== void 0 || options.ignoreIfNotExists !== void 0)) {
\r
3137 result.options = options;
\r
3141 DeleteFile.create = create;
\r
3142 function is(value) {
\r
3143 var candidate = value;
\r
3144 return candidate && candidate.kind === 'delete' && Is.string(candidate.uri) &&
\r
3145 (candidate.options === void 0 ||
\r
3146 ((candidate.options.recursive === void 0 || Is.boolean(candidate.options.recursive)) && (candidate.options.ignoreIfNotExists === void 0 || Is.boolean(candidate.options.ignoreIfNotExists))));
\r
3148 DeleteFile.is = is;
\r
3149 })(DeleteFile || (DeleteFile = {}));
\r
3150 var WorkspaceEdit;
\r
3151 (function (WorkspaceEdit) {
\r
3152 function is(value) {
\r
3153 var candidate = value;
\r
3154 return candidate &&
\r
3155 (candidate.changes !== void 0 || candidate.documentChanges !== void 0) &&
\r
3156 (candidate.documentChanges === void 0 || candidate.documentChanges.every(function (change) {
\r
3157 if (Is.string(change.kind)) {
\r
3158 return CreateFile.is(change) || RenameFile.is(change) || DeleteFile.is(change);
\r
3161 return TextDocumentEdit.is(change);
\r
3165 WorkspaceEdit.is = is;
\r
3166 })(WorkspaceEdit || (WorkspaceEdit = {}));
\r
3167 var TextEditChangeImpl = /** @class */ (function () {
\r
3168 function TextEditChangeImpl(edits) {
\r
3169 this.edits = edits;
\r
3171 TextEditChangeImpl.prototype.insert = function (position, newText) {
\r
3172 this.edits.push(TextEdit.insert(position, newText));
\r
3174 TextEditChangeImpl.prototype.replace = function (range, newText) {
\r
3175 this.edits.push(TextEdit.replace(range, newText));
\r
3177 TextEditChangeImpl.prototype.delete = function (range) {
\r
3178 this.edits.push(TextEdit.del(range));
\r
3180 TextEditChangeImpl.prototype.add = function (edit) {
\r
3181 this.edits.push(edit);
\r
3183 TextEditChangeImpl.prototype.all = function () {
\r
3184 return this.edits;
\r
3186 TextEditChangeImpl.prototype.clear = function () {
\r
3187 this.edits.splice(0, this.edits.length);
\r
3189 return TextEditChangeImpl;
\r
3192 * A workspace change helps constructing changes to a workspace.
\r
3194 var WorkspaceChange = /** @class */ (function () {
\r
3195 function WorkspaceChange(workspaceEdit) {
\r
3197 this._textEditChanges = Object.create(null);
\r
3198 if (workspaceEdit) {
\r
3199 this._workspaceEdit = workspaceEdit;
\r
3200 if (workspaceEdit.documentChanges) {
\r
3201 workspaceEdit.documentChanges.forEach(function (change) {
\r
3202 if (TextDocumentEdit.is(change)) {
\r
3203 var textEditChange = new TextEditChangeImpl(change.edits);
\r
3204 _this._textEditChanges[change.textDocument.uri] = textEditChange;
\r
3208 else if (workspaceEdit.changes) {
\r
3209 Object.keys(workspaceEdit.changes).forEach(function (key) {
\r
3210 var textEditChange = new TextEditChangeImpl(workspaceEdit.changes[key]);
\r
3211 _this._textEditChanges[key] = textEditChange;
\r
3216 Object.defineProperty(WorkspaceChange.prototype, "edit", {
\r
3218 * Returns the underlying [WorkspaceEdit](#WorkspaceEdit) literal
\r
3219 * use to be returned from a workspace edit operation like rename.
\r
3221 get: function () {
\r
3222 return this._workspaceEdit;
\r
3225 configurable: true
\r
3227 WorkspaceChange.prototype.getTextEditChange = function (key) {
\r
3228 if (VersionedTextDocumentIdentifier.is(key)) {
\r
3229 if (!this._workspaceEdit) {
\r
3230 this._workspaceEdit = {
\r
3231 documentChanges: []
\r
3234 if (!this._workspaceEdit.documentChanges) {
\r
3235 throw new Error('Workspace edit is not configured for document changes.');
\r
3237 var textDocument = key;
\r
3238 var result = this._textEditChanges[textDocument.uri];
\r
3241 var textDocumentEdit = {
\r
3242 textDocument: textDocument,
\r
3245 this._workspaceEdit.documentChanges.push(textDocumentEdit);
\r
3246 result = new TextEditChangeImpl(edits);
\r
3247 this._textEditChanges[textDocument.uri] = result;
\r
3252 if (!this._workspaceEdit) {
\r
3253 this._workspaceEdit = {
\r
3254 changes: Object.create(null)
\r
3257 if (!this._workspaceEdit.changes) {
\r
3258 throw new Error('Workspace edit is not configured for normal text edit changes.');
\r
3260 var result = this._textEditChanges[key];
\r
3263 this._workspaceEdit.changes[key] = edits;
\r
3264 result = new TextEditChangeImpl(edits);
\r
3265 this._textEditChanges[key] = result;
\r
3270 WorkspaceChange.prototype.createFile = function (uri, options) {
\r
3271 this.checkDocumentChanges();
\r
3272 this._workspaceEdit.documentChanges.push(CreateFile.create(uri, options));
\r
3274 WorkspaceChange.prototype.renameFile = function (oldUri, newUri, options) {
\r
3275 this.checkDocumentChanges();
\r
3276 this._workspaceEdit.documentChanges.push(RenameFile.create(oldUri, newUri, options));
\r
3278 WorkspaceChange.prototype.deleteFile = function (uri, options) {
\r
3279 this.checkDocumentChanges();
\r
3280 this._workspaceEdit.documentChanges.push(DeleteFile.create(uri, options));
\r
3282 WorkspaceChange.prototype.checkDocumentChanges = function () {
\r
3283 if (!this._workspaceEdit || !this._workspaceEdit.documentChanges) {
\r
3284 throw new Error('Workspace edit is not configured for document changes.');
\r
3287 return WorkspaceChange;
\r
3291 * The TextDocumentIdentifier namespace provides helper functions to work with
\r
3292 * [TextDocumentIdentifier](#TextDocumentIdentifier) literals.
\r
3294 var TextDocumentIdentifier;
\r
3295 (function (TextDocumentIdentifier) {
\r
3297 * Creates a new TextDocumentIdentifier literal.
\r
3298 * @param uri The document's uri.
\r
3300 function create(uri) {
\r
3301 return { uri: uri };
\r
3303 TextDocumentIdentifier.create = create;
\r
3305 * Checks whether the given literal conforms to the [TextDocumentIdentifier](#TextDocumentIdentifier) interface.
\r
3307 function is(value) {
\r
3308 var candidate = value;
\r
3309 return Is.defined(candidate) && Is.string(candidate.uri);
\r
3311 TextDocumentIdentifier.is = is;
\r
3312 })(TextDocumentIdentifier || (TextDocumentIdentifier = {}));
\r
3314 * The VersionedTextDocumentIdentifier namespace provides helper functions to work with
\r
3315 * [VersionedTextDocumentIdentifier](#VersionedTextDocumentIdentifier) literals.
\r
3317 var VersionedTextDocumentIdentifier;
\r
3318 (function (VersionedTextDocumentIdentifier) {
\r
3320 * Creates a new VersionedTextDocumentIdentifier literal.
\r
3321 * @param uri The document's uri.
\r
3322 * @param uri The document's text.
\r
3324 function create(uri, version) {
\r
3325 return { uri: uri, version: version };
\r
3327 VersionedTextDocumentIdentifier.create = create;
\r
3329 * Checks whether the given literal conforms to the [VersionedTextDocumentIdentifier](#VersionedTextDocumentIdentifier) interface.
\r
3331 function is(value) {
\r
3332 var candidate = value;
\r
3333 return Is.defined(candidate) && Is.string(candidate.uri) && (candidate.version === null || Is.number(candidate.version));
\r
3335 VersionedTextDocumentIdentifier.is = is;
\r
3336 })(VersionedTextDocumentIdentifier || (VersionedTextDocumentIdentifier = {}));
\r
3338 * The TextDocumentItem namespace provides helper functions to work with
\r
3339 * [TextDocumentItem](#TextDocumentItem) literals.
\r
3341 var TextDocumentItem;
\r
3342 (function (TextDocumentItem) {
\r
3344 * Creates a new TextDocumentItem literal.
\r
3345 * @param uri The document's uri.
\r
3346 * @param languageId The document's language identifier.
\r
3347 * @param version The document's version number.
\r
3348 * @param text The document's text.
\r
3350 function create(uri, languageId, version, text) {
\r
3351 return { uri: uri, languageId: languageId, version: version, text: text };
\r
3353 TextDocumentItem.create = create;
\r
3355 * Checks whether the given literal conforms to the [TextDocumentItem](#TextDocumentItem) interface.
\r
3357 function is(value) {
\r
3358 var candidate = value;
\r
3359 return Is.defined(candidate) && Is.string(candidate.uri) && Is.string(candidate.languageId) && Is.number(candidate.version) && Is.string(candidate.text);
\r
3361 TextDocumentItem.is = is;
\r
3362 })(TextDocumentItem || (TextDocumentItem = {}));
\r
3364 * Describes the content type that a client supports in various
\r
3365 * result literals like `Hover`, `ParameterInfo` or `CompletionItem`.
\r
3367 * Please note that `MarkupKinds` must not start with a `$`. This kinds
\r
3368 * are reserved for internal usage.
\r
3371 (function (MarkupKind) {
\r
3373 * Plain text is supported as a content format
\r
3375 MarkupKind.PlainText = 'plaintext';
\r
3377 * Markdown is supported as a content format
\r
3379 MarkupKind.Markdown = 'markdown';
\r
3380 })(MarkupKind || (MarkupKind = {}));
\r
3381 (function (MarkupKind) {
\r
3383 * Checks whether the given value is a value of the [MarkupKind](#MarkupKind) type.
\r
3385 function is(value) {
\r
3386 var candidate = value;
\r
3387 return candidate === MarkupKind.PlainText || candidate === MarkupKind.Markdown;
\r
3389 MarkupKind.is = is;
\r
3390 })(MarkupKind || (MarkupKind = {}));
\r
3391 var MarkupContent;
\r
3392 (function (MarkupContent) {
\r
3394 * Checks whether the given value conforms to the [MarkupContent](#MarkupContent) interface.
\r
3396 function is(value) {
\r
3397 var candidate = value;
\r
3398 return Is.objectLiteral(value) && MarkupKind.is(candidate.kind) && Is.string(candidate.value);
\r
3400 MarkupContent.is = is;
\r
3401 })(MarkupContent || (MarkupContent = {}));
\r
3403 * The kind of a completion entry.
\r
3405 var CompletionItemKind;
\r
3406 (function (CompletionItemKind) {
\r
3407 CompletionItemKind.Text = 1;
\r
3408 CompletionItemKind.Method = 2;
\r
3409 CompletionItemKind.Function = 3;
\r
3410 CompletionItemKind.Constructor = 4;
\r
3411 CompletionItemKind.Field = 5;
\r
3412 CompletionItemKind.Variable = 6;
\r
3413 CompletionItemKind.Class = 7;
\r
3414 CompletionItemKind.Interface = 8;
\r
3415 CompletionItemKind.Module = 9;
\r
3416 CompletionItemKind.Property = 10;
\r
3417 CompletionItemKind.Unit = 11;
\r
3418 CompletionItemKind.Value = 12;
\r
3419 CompletionItemKind.Enum = 13;
\r
3420 CompletionItemKind.Keyword = 14;
\r
3421 CompletionItemKind.Snippet = 15;
\r
3422 CompletionItemKind.Color = 16;
\r
3423 CompletionItemKind.File = 17;
\r
3424 CompletionItemKind.Reference = 18;
\r
3425 CompletionItemKind.Folder = 19;
\r
3426 CompletionItemKind.EnumMember = 20;
\r
3427 CompletionItemKind.Constant = 21;
\r
3428 CompletionItemKind.Struct = 22;
\r
3429 CompletionItemKind.Event = 23;
\r
3430 CompletionItemKind.Operator = 24;
\r
3431 CompletionItemKind.TypeParameter = 25;
\r
3432 })(CompletionItemKind || (CompletionItemKind = {}));
\r
3434 * Defines whether the insert text in a completion item should be interpreted as
\r
3435 * plain text or a snippet.
\r
3437 var InsertTextFormat;
\r
3438 (function (InsertTextFormat) {
\r
3440 * The primary text to be inserted is treated as a plain string.
\r
3442 InsertTextFormat.PlainText = 1;
\r
3444 * The primary text to be inserted is treated as a snippet.
\r
3446 * A snippet can define tab stops and placeholders with `$1`, `$2`
\r
3447 * and `${3:foo}`. `$0` defines the final tab stop, it defaults to
\r
3448 * the end of the snippet. Placeholders with equal identifiers are linked,
\r
3449 * that is typing in one will update others too.
\r
3451 * See also: https://github.com/Microsoft/vscode/blob/master/src/vs/editor/contrib/snippet/common/snippet.md
\r
3453 InsertTextFormat.Snippet = 2;
\r
3454 })(InsertTextFormat || (InsertTextFormat = {}));
\r
3456 * Completion item tags are extra annotations that tweak the rendering of a completion
\r
3461 var CompletionItemTag;
\r
3462 (function (CompletionItemTag) {
\r
3464 * Render a completion as obsolete, usually using a strike-out.
\r
3466 CompletionItemTag.Deprecated = 1;
\r
3467 })(CompletionItemTag || (CompletionItemTag = {}));
\r
3469 * The CompletionItem namespace provides functions to deal with
\r
3470 * completion items.
\r
3472 var CompletionItem;
\r
3473 (function (CompletionItem) {
\r
3475 * Create a completion item and seed it with a label.
\r
3476 * @param label The completion item's label
\r
3478 function create(label) {
\r
3479 return { label: label };
\r
3481 CompletionItem.create = create;
\r
3482 })(CompletionItem || (CompletionItem = {}));
\r
3484 * The CompletionList namespace provides functions to deal with
\r
3485 * completion lists.
\r
3487 var CompletionList;
\r
3488 (function (CompletionList) {
\r
3490 * Creates a new completion list.
\r
3492 * @param items The completion items.
\r
3493 * @param isIncomplete The list is not complete.
\r
3495 function create(items, isIncomplete) {
\r
3496 return { items: items ? items : [], isIncomplete: !!isIncomplete };
\r
3498 CompletionList.create = create;
\r
3499 })(CompletionList || (CompletionList = {}));
\r
3501 (function (MarkedString) {
\r
3503 * Creates a marked string from plain text.
\r
3505 * @param plainText The plain text.
\r
3507 function fromPlainText(plainText) {
\r
3508 return plainText.replace(/[\\`*_{}[\]()#+\-.!]/g, '\\$&'); // escape markdown syntax tokens: http://daringfireball.net/projects/markdown/syntax#backslash
\r
3510 MarkedString.fromPlainText = fromPlainText;
\r
3512 * Checks whether the given value conforms to the [MarkedString](#MarkedString) type.
\r
3514 function is(value) {
\r
3515 var candidate = value;
\r
3516 return Is.string(candidate) || (Is.objectLiteral(candidate) && Is.string(candidate.language) && Is.string(candidate.value));
\r
3518 MarkedString.is = is;
\r
3519 })(MarkedString || (MarkedString = {}));
\r
3521 (function (Hover) {
\r
3523 * Checks whether the given value conforms to the [Hover](#Hover) interface.
\r
3525 function is(value) {
\r
3526 var candidate = value;
\r
3527 return !!candidate && Is.objectLiteral(candidate) && (MarkupContent.is(candidate.contents) ||
\r
3528 MarkedString.is(candidate.contents) ||
\r
3529 Is.typedArray(candidate.contents, MarkedString.is)) && (value.range === void 0 || Range.is(value.range));
\r
3532 })(Hover || (Hover = {}));
\r
3534 * The ParameterInformation namespace provides helper functions to work with
\r
3535 * [ParameterInformation](#ParameterInformation) literals.
\r
3537 var ParameterInformation;
\r
3538 (function (ParameterInformation) {
\r
3540 * Creates a new parameter information literal.
\r
3542 * @param label A label string.
\r
3543 * @param documentation A doc string.
\r
3545 function create(label, documentation) {
\r
3546 return documentation ? { label: label, documentation: documentation } : { label: label };
\r
3548 ParameterInformation.create = create;
\r
3549 })(ParameterInformation || (ParameterInformation = {}));
\r
3551 * The SignatureInformation namespace provides helper functions to work with
\r
3552 * [SignatureInformation](#SignatureInformation) literals.
\r
3554 var SignatureInformation;
\r
3555 (function (SignatureInformation) {
\r
3556 function create(label, documentation) {
\r
3557 var parameters = [];
\r
3558 for (var _i = 2; _i < arguments.length; _i++) {
\r
3559 parameters[_i - 2] = arguments[_i];
\r
3561 var result = { label: label };
\r
3562 if (Is.defined(documentation)) {
\r
3563 result.documentation = documentation;
\r
3565 if (Is.defined(parameters)) {
\r
3566 result.parameters = parameters;
\r
3569 result.parameters = [];
\r
3573 SignatureInformation.create = create;
\r
3574 })(SignatureInformation || (SignatureInformation = {}));
\r
3576 * A document highlight kind.
\r
3578 var DocumentHighlightKind;
\r
3579 (function (DocumentHighlightKind) {
\r
3581 * A textual occurrence.
\r
3583 DocumentHighlightKind.Text = 1;
\r
3585 * Read-access of a symbol, like reading a variable.
\r
3587 DocumentHighlightKind.Read = 2;
\r
3589 * Write-access of a symbol, like writing to a variable.
\r
3591 DocumentHighlightKind.Write = 3;
\r
3592 })(DocumentHighlightKind || (DocumentHighlightKind = {}));
\r
3594 * DocumentHighlight namespace to provide helper functions to work with
\r
3595 * [DocumentHighlight](#DocumentHighlight) literals.
\r
3597 var DocumentHighlight;
\r
3598 (function (DocumentHighlight) {
\r
3600 * Create a DocumentHighlight object.
\r
3601 * @param range The range the highlight applies to.
\r
3603 function create(range, kind) {
\r
3604 var result = { range: range };
\r
3605 if (Is.number(kind)) {
\r
3606 result.kind = kind;
\r
3610 DocumentHighlight.create = create;
\r
3611 })(DocumentHighlight || (DocumentHighlight = {}));
\r
3616 (function (SymbolKind) {
\r
3617 SymbolKind.File = 1;
\r
3618 SymbolKind.Module = 2;
\r
3619 SymbolKind.Namespace = 3;
\r
3620 SymbolKind.Package = 4;
\r
3621 SymbolKind.Class = 5;
\r
3622 SymbolKind.Method = 6;
\r
3623 SymbolKind.Property = 7;
\r
3624 SymbolKind.Field = 8;
\r
3625 SymbolKind.Constructor = 9;
\r
3626 SymbolKind.Enum = 10;
\r
3627 SymbolKind.Interface = 11;
\r
3628 SymbolKind.Function = 12;
\r
3629 SymbolKind.Variable = 13;
\r
3630 SymbolKind.Constant = 14;
\r
3631 SymbolKind.String = 15;
\r
3632 SymbolKind.Number = 16;
\r
3633 SymbolKind.Boolean = 17;
\r
3634 SymbolKind.Array = 18;
\r
3635 SymbolKind.Object = 19;
\r
3636 SymbolKind.Key = 20;
\r
3637 SymbolKind.Null = 21;
\r
3638 SymbolKind.EnumMember = 22;
\r
3639 SymbolKind.Struct = 23;
\r
3640 SymbolKind.Event = 24;
\r
3641 SymbolKind.Operator = 25;
\r
3642 SymbolKind.TypeParameter = 26;
\r
3643 })(SymbolKind || (SymbolKind = {}));
\r
3645 * Symbol tags are extra annotations that tweak the rendering of a symbol.
\r
3649 (function (SymbolTag) {
\r
3651 * Render a symbol as obsolete, usually using a strike-out.
\r
3653 SymbolTag.Deprecated = 1;
\r
3654 })(SymbolTag || (SymbolTag = {}));
\r
3655 var SymbolInformation;
\r
3656 (function (SymbolInformation) {
\r
3658 * Creates a new symbol information literal.
\r
3660 * @param name The name of the symbol.
\r
3661 * @param kind The kind of the symbol.
\r
3662 * @param range The range of the location of the symbol.
\r
3663 * @param uri The resource of the location of symbol, defaults to the current document.
\r
3664 * @param containerName The name of the symbol containing the symbol.
\r
3666 function create(name, kind, range, uri, containerName) {
\r
3670 location: { uri: uri, range: range }
\r
3672 if (containerName) {
\r
3673 result.containerName = containerName;
\r
3677 SymbolInformation.create = create;
\r
3678 })(SymbolInformation || (SymbolInformation = {}));
\r
3679 var DocumentSymbol;
\r
3680 (function (DocumentSymbol) {
\r
3682 * Creates a new symbol information literal.
\r
3684 * @param name The name of the symbol.
\r
3685 * @param detail The detail of the symbol.
\r
3686 * @param kind The kind of the symbol.
\r
3687 * @param range The range of the symbol.
\r
3688 * @param selectionRange The selectionRange of the symbol.
\r
3689 * @param children Children of the symbol.
\r
3691 function create(name, detail, kind, range, selectionRange, children) {
\r
3697 selectionRange: selectionRange
\r
3699 if (children !== void 0) {
\r
3700 result.children = children;
\r
3704 DocumentSymbol.create = create;
\r
3706 * Checks whether the given literal conforms to the [DocumentSymbol](#DocumentSymbol) interface.
\r
3708 function is(value) {
\r
3709 var candidate = value;
\r
3710 return candidate &&
\r
3711 Is.string(candidate.name) && Is.number(candidate.kind) &&
\r
3712 Range.is(candidate.range) && Range.is(candidate.selectionRange) &&
\r
3713 (candidate.detail === void 0 || Is.string(candidate.detail)) &&
\r
3714 (candidate.deprecated === void 0 || Is.boolean(candidate.deprecated)) &&
\r
3715 (candidate.children === void 0 || Array.isArray(candidate.children));
\r
3717 DocumentSymbol.is = is;
\r
3718 })(DocumentSymbol || (DocumentSymbol = {}));
\r
3720 * A set of predefined code action kinds
\r
3722 var CodeActionKind;
\r
3723 (function (CodeActionKind) {
\r
3727 CodeActionKind.Empty = '';
\r
3729 * Base kind for quickfix actions: 'quickfix'
\r
3731 CodeActionKind.QuickFix = 'quickfix';
\r
3733 * Base kind for refactoring actions: 'refactor'
\r
3735 CodeActionKind.Refactor = 'refactor';
\r
3737 * Base kind for refactoring extraction actions: 'refactor.extract'
\r
3739 * Example extract actions:
\r
3741 * - Extract method
\r
3742 * - Extract function
\r
3743 * - Extract variable
\r
3744 * - Extract interface from class
\r
3747 CodeActionKind.RefactorExtract = 'refactor.extract';
\r
3749 * Base kind for refactoring inline actions: 'refactor.inline'
\r
3751 * Example inline actions:
\r
3753 * - Inline function
\r
3754 * - Inline variable
\r
3755 * - Inline constant
\r
3758 CodeActionKind.RefactorInline = 'refactor.inline';
\r
3760 * Base kind for refactoring rewrite actions: 'refactor.rewrite'
\r
3762 * Example rewrite actions:
\r
3764 * - Convert JavaScript function to class
\r
3765 * - Add or remove parameter
\r
3766 * - Encapsulate field
\r
3767 * - Make method static
\r
3768 * - Move method to base class
\r
3771 CodeActionKind.RefactorRewrite = 'refactor.rewrite';
\r
3773 * Base kind for source actions: `source`
\r
3775 * Source code actions apply to the entire file.
\r
3777 CodeActionKind.Source = 'source';
\r
3779 * Base kind for an organize imports source action: `source.organizeImports`
\r
3781 CodeActionKind.SourceOrganizeImports = 'source.organizeImports';
\r
3783 * Base kind for auto-fix source actions: `source.fixAll`.
\r
3785 * Fix all actions automatically fix errors that have a clear fix that do not require user input.
\r
3786 * They should not suppress errors or perform unsafe fixes such as generating new types or classes.
\r
3790 CodeActionKind.SourceFixAll = 'source.fixAll';
\r
3791 })(CodeActionKind || (CodeActionKind = {}));
\r
3793 * The CodeActionContext namespace provides helper functions to work with
\r
3794 * [CodeActionContext](#CodeActionContext) literals.
\r
3796 var CodeActionContext;
\r
3797 (function (CodeActionContext) {
\r
3799 * Creates a new CodeActionContext literal.
\r
3801 function create(diagnostics, only) {
\r
3802 var result = { diagnostics: diagnostics };
\r
3803 if (only !== void 0 && only !== null) {
\r
3804 result.only = only;
\r
3808 CodeActionContext.create = create;
\r
3810 * Checks whether the given literal conforms to the [CodeActionContext](#CodeActionContext) interface.
\r
3812 function is(value) {
\r
3813 var candidate = value;
\r
3814 return Is.defined(candidate) && Is.typedArray(candidate.diagnostics, Diagnostic.is) && (candidate.only === void 0 || Is.typedArray(candidate.only, Is.string));
\r
3816 CodeActionContext.is = is;
\r
3817 })(CodeActionContext || (CodeActionContext = {}));
\r
3819 (function (CodeAction) {
\r
3820 function create(title, commandOrEdit, kind) {
\r
3821 var result = { title: title };
\r
3822 if (Command.is(commandOrEdit)) {
\r
3823 result.command = commandOrEdit;
\r
3826 result.edit = commandOrEdit;
\r
3828 if (kind !== void 0) {
\r
3829 result.kind = kind;
\r
3833 CodeAction.create = create;
\r
3834 function is(value) {
\r
3835 var candidate = value;
\r
3836 return candidate && Is.string(candidate.title) &&
\r
3837 (candidate.diagnostics === void 0 || Is.typedArray(candidate.diagnostics, Diagnostic.is)) &&
\r
3838 (candidate.kind === void 0 || Is.string(candidate.kind)) &&
\r
3839 (candidate.edit !== void 0 || candidate.command !== void 0) &&
\r
3840 (candidate.command === void 0 || Command.is(candidate.command)) &&
\r
3841 (candidate.isPreferred === void 0 || Is.boolean(candidate.isPreferred)) &&
\r
3842 (candidate.edit === void 0 || WorkspaceEdit.is(candidate.edit));
\r
3844 CodeAction.is = is;
\r
3845 })(CodeAction || (CodeAction = {}));
\r
3847 * The CodeLens namespace provides helper functions to work with
\r
3848 * [CodeLens](#CodeLens) literals.
\r
3851 (function (CodeLens) {
\r
3853 * Creates a new CodeLens literal.
\r
3855 function create(range, data) {
\r
3856 var result = { range: range };
\r
3857 if (Is.defined(data)) {
\r
3858 result.data = data;
\r
3862 CodeLens.create = create;
\r
3864 * Checks whether the given literal conforms to the [CodeLens](#CodeLens) interface.
\r
3866 function is(value) {
\r
3867 var candidate = value;
\r
3868 return Is.defined(candidate) && Range.is(candidate.range) && (Is.undefined(candidate.command) || Command.is(candidate.command));
\r
3871 })(CodeLens || (CodeLens = {}));
\r
3873 * The FormattingOptions namespace provides helper functions to work with
\r
3874 * [FormattingOptions](#FormattingOptions) literals.
\r
3876 var FormattingOptions;
\r
3877 (function (FormattingOptions) {
\r
3879 * Creates a new FormattingOptions literal.
\r
3881 function create(tabSize, insertSpaces) {
\r
3882 return { tabSize: tabSize, insertSpaces: insertSpaces };
\r
3884 FormattingOptions.create = create;
\r
3886 * Checks whether the given literal conforms to the [FormattingOptions](#FormattingOptions) interface.
\r
3888 function is(value) {
\r
3889 var candidate = value;
\r
3890 return Is.defined(candidate) && Is.number(candidate.tabSize) && Is.boolean(candidate.insertSpaces);
\r
3892 FormattingOptions.is = is;
\r
3893 })(FormattingOptions || (FormattingOptions = {}));
\r
3895 * The DocumentLink namespace provides helper functions to work with
\r
3896 * [DocumentLink](#DocumentLink) literals.
\r
3899 (function (DocumentLink) {
\r
3901 * Creates a new DocumentLink literal.
\r
3903 function create(range, target, data) {
\r
3904 return { range: range, target: target, data: data };
\r
3906 DocumentLink.create = create;
\r
3908 * Checks whether the given literal conforms to the [DocumentLink](#DocumentLink) interface.
\r
3910 function is(value) {
\r
3911 var candidate = value;
\r
3912 return Is.defined(candidate) && Range.is(candidate.range) && (Is.undefined(candidate.target) || Is.string(candidate.target));
\r
3914 DocumentLink.is = is;
\r
3915 })(DocumentLink || (DocumentLink = {}));
\r
3917 * The SelectionRange namespace provides helper function to work with
\r
3918 * SelectionRange literals.
\r
3920 var SelectionRange;
\r
3921 (function (SelectionRange) {
\r
3923 * Creates a new SelectionRange
\r
3924 * @param range the range.
\r
3925 * @param parent an optional parent.
\r
3927 function create(range, parent) {
\r
3928 return { range: range, parent: parent };
\r
3930 SelectionRange.create = create;
\r
3931 function is(value) {
\r
3932 var candidate = value;
\r
3933 return candidate !== undefined && Range.is(candidate.range) && (candidate.parent === undefined || SelectionRange.is(candidate.parent));
\r
3935 SelectionRange.is = is;
\r
3936 })(SelectionRange || (SelectionRange = {}));
\r
3937 var EOL = ['\n', '\r\n', '\r'];
\r
3939 * @deprecated Use the text document from the new vscode-languageserver-textdocument package.
\r
3942 (function (TextDocument) {
\r
3944 * Creates a new ITextDocument literal from the given uri and content.
\r
3945 * @param uri The document's uri.
\r
3946 * @param languageId The document's language Id.
\r
3947 * @param content The document's content.
\r
3949 function create(uri, languageId, version, content) {
\r
3950 return new FullTextDocument(uri, languageId, version, content);
\r
3952 TextDocument.create = create;
\r
3954 * Checks whether the given literal conforms to the [ITextDocument](#ITextDocument) interface.
\r
3956 function is(value) {
\r
3957 var candidate = value;
\r
3958 return Is.defined(candidate) && Is.string(candidate.uri) && (Is.undefined(candidate.languageId) || Is.string(candidate.languageId)) && Is.number(candidate.lineCount)
\r
3959 && Is.func(candidate.getText) && Is.func(candidate.positionAt) && Is.func(candidate.offsetAt) ? true : false;
\r
3961 TextDocument.is = is;
\r
3962 function applyEdits(document, edits) {
\r
3963 var text = document.getText();
\r
3964 var sortedEdits = mergeSort(edits, function (a, b) {
\r
3965 var diff = a.range.start.line - b.range.start.line;
\r
3967 return a.range.start.character - b.range.start.character;
\r
3971 var lastModifiedOffset = text.length;
\r
3972 for (var i = sortedEdits.length - 1; i >= 0; i--) {
\r
3973 var e = sortedEdits[i];
\r
3974 var startOffset = document.offsetAt(e.range.start);
\r
3975 var endOffset = document.offsetAt(e.range.end);
\r
3976 if (endOffset <= lastModifiedOffset) {
\r
3977 text = text.substring(0, startOffset) + e.newText + text.substring(endOffset, text.length);
\r
3980 throw new Error('Overlapping edit');
\r
3982 lastModifiedOffset = startOffset;
\r
3986 TextDocument.applyEdits = applyEdits;
\r
3987 function mergeSort(data, compare) {
\r
3988 if (data.length <= 1) {
\r
3992 var p = (data.length / 2) | 0;
\r
3993 var left = data.slice(0, p);
\r
3994 var right = data.slice(p);
\r
3995 mergeSort(left, compare);
\r
3996 mergeSort(right, compare);
\r
4000 while (leftIdx < left.length && rightIdx < right.length) {
\r
4001 var ret = compare(left[leftIdx], right[rightIdx]);
\r
4003 // smaller_equal -> take left to preserve order
\r
4004 data[i++] = left[leftIdx++];
\r
4007 // greater -> take right
\r
4008 data[i++] = right[rightIdx++];
\r
4011 while (leftIdx < left.length) {
\r
4012 data[i++] = left[leftIdx++];
\r
4014 while (rightIdx < right.length) {
\r
4015 data[i++] = right[rightIdx++];
\r
4019 })(TextDocument || (TextDocument = {}));
\r
4020 var FullTextDocument = /** @class */ (function () {
\r
4021 function FullTextDocument(uri, languageId, version, content) {
\r
4023 this._languageId = languageId;
\r
4024 this._version = version;
\r
4025 this._content = content;
\r
4026 this._lineOffsets = undefined;
\r
4028 Object.defineProperty(FullTextDocument.prototype, "uri", {
\r
4029 get: function () {
\r
4033 configurable: true
\r
4035 Object.defineProperty(FullTextDocument.prototype, "languageId", {
\r
4036 get: function () {
\r
4037 return this._languageId;
\r
4040 configurable: true
\r
4042 Object.defineProperty(FullTextDocument.prototype, "version", {
\r
4043 get: function () {
\r
4044 return this._version;
\r
4047 configurable: true
\r
4049 FullTextDocument.prototype.getText = function (range) {
\r
4051 var start = this.offsetAt(range.start);
\r
4052 var end = this.offsetAt(range.end);
\r
4053 return this._content.substring(start, end);
\r
4055 return this._content;
\r
4057 FullTextDocument.prototype.update = function (event, version) {
\r
4058 this._content = event.text;
\r
4059 this._version = version;
\r
4060 this._lineOffsets = undefined;
\r
4062 FullTextDocument.prototype.getLineOffsets = function () {
\r
4063 if (this._lineOffsets === undefined) {
\r
4064 var lineOffsets = [];
\r
4065 var text = this._content;
\r
4066 var isLineStart = true;
\r
4067 for (var i = 0; i < text.length; i++) {
\r
4068 if (isLineStart) {
\r
4069 lineOffsets.push(i);
\r
4070 isLineStart = false;
\r
4072 var ch = text.charAt(i);
\r
4073 isLineStart = (ch === '\r' || ch === '\n');
\r
4074 if (ch === '\r' && i + 1 < text.length && text.charAt(i + 1) === '\n') {
\r
4078 if (isLineStart && text.length > 0) {
\r
4079 lineOffsets.push(text.length);
\r
4081 this._lineOffsets = lineOffsets;
\r
4083 return this._lineOffsets;
\r
4085 FullTextDocument.prototype.positionAt = function (offset) {
\r
4086 offset = Math.max(Math.min(offset, this._content.length), 0);
\r
4087 var lineOffsets = this.getLineOffsets();
\r
4088 var low = 0, high = lineOffsets.length;
\r
4090 return Position.create(0, offset);
\r
4092 while (low < high) {
\r
4093 var mid = Math.floor((low + high) / 2);
\r
4094 if (lineOffsets[mid] > offset) {
\r
4101 // low is the least x for which the line offset is larger than the current offset
\r
4102 // or array.length if no line offset is larger than the current offset
\r
4103 var line = low - 1;
\r
4104 return Position.create(line, offset - lineOffsets[line]);
\r
4106 FullTextDocument.prototype.offsetAt = function (position) {
\r
4107 var lineOffsets = this.getLineOffsets();
\r
4108 if (position.line >= lineOffsets.length) {
\r
4109 return this._content.length;
\r
4111 else if (position.line < 0) {
\r
4114 var lineOffset = lineOffsets[position.line];
\r
4115 var nextLineOffset = (position.line + 1 < lineOffsets.length) ? lineOffsets[position.line + 1] : this._content.length;
\r
4116 return Math.max(Math.min(lineOffset + position.character, nextLineOffset), lineOffset);
\r
4118 Object.defineProperty(FullTextDocument.prototype, "lineCount", {
\r
4119 get: function () {
\r
4120 return this.getLineOffsets().length;
\r
4123 configurable: true
\r
4125 return FullTextDocument;
\r
4129 var toString = Object.prototype.toString;
\r
4130 function defined(value) {
\r
4131 return typeof value !== 'undefined';
\r
4133 Is.defined = defined;
\r
4134 function undefined(value) {
\r
4135 return typeof value === 'undefined';
\r
4137 Is.undefined = undefined;
\r
4138 function boolean(value) {
\r
4139 return value === true || value === false;
\r
4141 Is.boolean = boolean;
\r
4142 function string(value) {
\r
4143 return toString.call(value) === '[object String]';
\r
4145 Is.string = string;
\r
4146 function number(value) {
\r
4147 return toString.call(value) === '[object Number]';
\r
4149 Is.number = number;
\r
4150 function func(value) {
\r
4151 return toString.call(value) === '[object Function]';
\r
4154 function objectLiteral(value) {
\r
4155 // Strictly speaking class instances pass this check as well. Since the LSP
\r
4156 // doesn't use classes we ignore this for now. If we do we need to add something
\r
4157 // like this: `Object.getPrototypeOf(Object.getPrototypeOf(x)) === null`
\r
4158 return value !== null && typeof value === 'object';
\r
4160 Is.objectLiteral = objectLiteral;
\r
4161 function typedArray(value, check) {
\r
4162 return Array.isArray(value) && value.every(check);
\r
4164 Is.typedArray = typedArray;
\r
4165 })(Is || (Is = {}));
\r
4170 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
4172 /* --------------------------------------------------------------------------------------------
\r
4173 * Copyright (c) Microsoft Corporation. All rights reserved.
\r
4174 * Licensed under the MIT License. See License.txt in the project root for license information.
\r
4175 * ------------------------------------------------------------------------------------------ */
\r
4177 Object.defineProperty(exports, "__esModule", ({ value: true }));
\r
4178 const Is = __webpack_require__(20);
\r
4179 const vscode_jsonrpc_1 = __webpack_require__(5);
\r
4180 const messages_1 = __webpack_require__(21);
\r
4181 const protocol_implementation_1 = __webpack_require__(22);
\r
4182 exports.ImplementationRequest = protocol_implementation_1.ImplementationRequest;
\r
4183 const protocol_typeDefinition_1 = __webpack_require__(23);
\r
4184 exports.TypeDefinitionRequest = protocol_typeDefinition_1.TypeDefinitionRequest;
\r
4185 const protocol_workspaceFolders_1 = __webpack_require__(24);
\r
4186 exports.WorkspaceFoldersRequest = protocol_workspaceFolders_1.WorkspaceFoldersRequest;
\r
4187 exports.DidChangeWorkspaceFoldersNotification = protocol_workspaceFolders_1.DidChangeWorkspaceFoldersNotification;
\r
4188 const protocol_configuration_1 = __webpack_require__(25);
\r
4189 exports.ConfigurationRequest = protocol_configuration_1.ConfigurationRequest;
\r
4190 const protocol_colorProvider_1 = __webpack_require__(26);
\r
4191 exports.DocumentColorRequest = protocol_colorProvider_1.DocumentColorRequest;
\r
4192 exports.ColorPresentationRequest = protocol_colorProvider_1.ColorPresentationRequest;
\r
4193 const protocol_foldingRange_1 = __webpack_require__(27);
\r
4194 exports.FoldingRangeRequest = protocol_foldingRange_1.FoldingRangeRequest;
\r
4195 const protocol_declaration_1 = __webpack_require__(28);
\r
4196 exports.DeclarationRequest = protocol_declaration_1.DeclarationRequest;
\r
4197 const protocol_selectionRange_1 = __webpack_require__(29);
\r
4198 exports.SelectionRangeRequest = protocol_selectionRange_1.SelectionRangeRequest;
\r
4199 const protocol_progress_1 = __webpack_require__(30);
\r
4200 exports.WorkDoneProgress = protocol_progress_1.WorkDoneProgress;
\r
4201 exports.WorkDoneProgressCreateRequest = protocol_progress_1.WorkDoneProgressCreateRequest;
\r
4202 exports.WorkDoneProgressCancelNotification = protocol_progress_1.WorkDoneProgressCancelNotification;
\r
4203 // @ts-ignore: to avoid inlining LocatioLink as dynamic import
\r
4204 let __noDynamicImport;
\r
4206 * The DocumentFilter namespace provides helper functions to work with
\r
4207 * [DocumentFilter](#DocumentFilter) literals.
\r
4209 var DocumentFilter;
\r
4210 (function (DocumentFilter) {
\r
4211 function is(value) {
\r
4212 const candidate = value;
\r
4213 return Is.string(candidate.language) || Is.string(candidate.scheme) || Is.string(candidate.pattern);
\r
4215 DocumentFilter.is = is;
\r
4216 })(DocumentFilter = exports.DocumentFilter || (exports.DocumentFilter = {}));
\r
4218 * The DocumentSelector namespace provides helper functions to work with
\r
4219 * [DocumentSelector](#DocumentSelector)s.
\r
4221 var DocumentSelector;
\r
4222 (function (DocumentSelector) {
\r
4223 function is(value) {
\r
4224 if (!Array.isArray(value)) {
\r
4227 for (let elem of value) {
\r
4228 if (!Is.string(elem) && !DocumentFilter.is(elem)) {
\r
4234 DocumentSelector.is = is;
\r
4235 })(DocumentSelector = exports.DocumentSelector || (exports.DocumentSelector = {}));
\r
4237 * The `client/registerCapability` request is sent from the server to the client to register a new capability
\r
4238 * handler on the client side.
\r
4240 var RegistrationRequest;
\r
4241 (function (RegistrationRequest) {
\r
4242 RegistrationRequest.type = new messages_1.ProtocolRequestType('client/registerCapability');
\r
4243 })(RegistrationRequest = exports.RegistrationRequest || (exports.RegistrationRequest = {}));
\r
4245 * The `client/unregisterCapability` request is sent from the server to the client to unregister a previously registered capability
\r
4246 * handler on the client side.
\r
4248 var UnregistrationRequest;
\r
4249 (function (UnregistrationRequest) {
\r
4250 UnregistrationRequest.type = new messages_1.ProtocolRequestType('client/unregisterCapability');
\r
4251 })(UnregistrationRequest = exports.UnregistrationRequest || (exports.UnregistrationRequest = {}));
\r
4252 var ResourceOperationKind;
\r
4253 (function (ResourceOperationKind) {
\r
4255 * Supports creating new files and folders.
\r
4257 ResourceOperationKind.Create = 'create';
\r
4259 * Supports renaming existing files and folders.
\r
4261 ResourceOperationKind.Rename = 'rename';
\r
4263 * Supports deleting existing files and folders.
\r
4265 ResourceOperationKind.Delete = 'delete';
\r
4266 })(ResourceOperationKind = exports.ResourceOperationKind || (exports.ResourceOperationKind = {}));
\r
4267 var FailureHandlingKind;
\r
4268 (function (FailureHandlingKind) {
\r
4270 * Applying the workspace change is simply aborted if one of the changes provided
\r
4271 * fails. All operations executed before the failing operation stay executed.
\r
4273 FailureHandlingKind.Abort = 'abort';
\r
4275 * All operations are executed transactional. That means they either all
\r
4276 * succeed or no changes at all are applied to the workspace.
\r
4278 FailureHandlingKind.Transactional = 'transactional';
\r
4280 * If the workspace edit contains only textual file changes they are executed transactional.
\r
4281 * If resource changes (create, rename or delete file) are part of the change the failure
\r
4282 * handling startegy is abort.
\r
4284 FailureHandlingKind.TextOnlyTransactional = 'textOnlyTransactional';
\r
4286 * The client tries to undo the operations already executed. But there is no
\r
4287 * guarantee that this is succeeding.
\r
4289 FailureHandlingKind.Undo = 'undo';
\r
4290 })(FailureHandlingKind = exports.FailureHandlingKind || (exports.FailureHandlingKind = {}));
\r
4292 * The StaticRegistrationOptions namespace provides helper functions to work with
\r
4293 * [StaticRegistrationOptions](#StaticRegistrationOptions) literals.
\r
4295 var StaticRegistrationOptions;
\r
4296 (function (StaticRegistrationOptions) {
\r
4297 function hasId(value) {
\r
4298 const candidate = value;
\r
4299 return candidate && Is.string(candidate.id) && candidate.id.length > 0;
\r
4301 StaticRegistrationOptions.hasId = hasId;
\r
4302 })(StaticRegistrationOptions = exports.StaticRegistrationOptions || (exports.StaticRegistrationOptions = {}));
\r
4304 * The TextDocumentRegistrationOptions namespace provides helper functions to work with
\r
4305 * [TextDocumentRegistrationOptions](#TextDocumentRegistrationOptions) literals.
\r
4307 var TextDocumentRegistrationOptions;
\r
4308 (function (TextDocumentRegistrationOptions) {
\r
4309 function is(value) {
\r
4310 const candidate = value;
\r
4311 return candidate && (candidate.documentSelector === null || DocumentSelector.is(candidate.documentSelector));
\r
4313 TextDocumentRegistrationOptions.is = is;
\r
4314 })(TextDocumentRegistrationOptions = exports.TextDocumentRegistrationOptions || (exports.TextDocumentRegistrationOptions = {}));
\r
4316 * The WorkDoneProgressOptions namespace provides helper functions to work with
\r
4317 * [WorkDoneProgressOptions](#WorkDoneProgressOptions) literals.
\r
4319 var WorkDoneProgressOptions;
\r
4320 (function (WorkDoneProgressOptions) {
\r
4321 function is(value) {
\r
4322 const candidate = value;
\r
4323 return Is.objectLiteral(candidate) && (candidate.workDoneProgress === undefined || Is.boolean(candidate.workDoneProgress));
\r
4325 WorkDoneProgressOptions.is = is;
\r
4326 function hasWorkDoneProgress(value) {
\r
4327 const candidate = value;
\r
4328 return candidate && Is.boolean(candidate.workDoneProgress);
\r
4330 WorkDoneProgressOptions.hasWorkDoneProgress = hasWorkDoneProgress;
\r
4331 })(WorkDoneProgressOptions = exports.WorkDoneProgressOptions || (exports.WorkDoneProgressOptions = {}));
\r
4333 * The initialize request is sent from the client to the server.
\r
4334 * It is sent once as the request after starting up the server.
\r
4335 * The requests parameter is of type [InitializeParams](#InitializeParams)
\r
4336 * the response if of type [InitializeResult](#InitializeResult) of a Thenable that
\r
4337 * resolves to such.
\r
4339 var InitializeRequest;
\r
4340 (function (InitializeRequest) {
\r
4341 InitializeRequest.type = new messages_1.ProtocolRequestType('initialize');
\r
4342 })(InitializeRequest = exports.InitializeRequest || (exports.InitializeRequest = {}));
\r
4344 * Known error codes for an `InitializeError`;
\r
4346 var InitializeError;
\r
4347 (function (InitializeError) {
\r
4349 * If the protocol version provided by the client can't be handled by the server.
\r
4350 * @deprecated This initialize error got replaced by client capabilities. There is
\r
4351 * no version handshake in version 3.0x
\r
4353 InitializeError.unknownProtocolVersion = 1;
\r
4354 })(InitializeError = exports.InitializeError || (exports.InitializeError = {}));
\r
4356 * The intialized notification is sent from the client to the
\r
4357 * server after the client is fully initialized and the server
\r
4358 * is allowed to send requests from the server to the client.
\r
4360 var InitializedNotification;
\r
4361 (function (InitializedNotification) {
\r
4362 InitializedNotification.type = new messages_1.ProtocolNotificationType('initialized');
\r
4363 })(InitializedNotification = exports.InitializedNotification || (exports.InitializedNotification = {}));
\r
4364 //---- Shutdown Method ----
\r
4366 * A shutdown request is sent from the client to the server.
\r
4367 * It is sent once when the client decides to shutdown the
\r
4368 * server. The only notification that is sent after a shutdown request
\r
4369 * is the exit event.
\r
4371 var ShutdownRequest;
\r
4372 (function (ShutdownRequest) {
\r
4373 ShutdownRequest.type = new messages_1.ProtocolRequestType0('shutdown');
\r
4374 })(ShutdownRequest = exports.ShutdownRequest || (exports.ShutdownRequest = {}));
\r
4375 //---- Exit Notification ----
\r
4377 * The exit event is sent from the client to the server to
\r
4378 * ask the server to exit its process.
\r
4380 var ExitNotification;
\r
4381 (function (ExitNotification) {
\r
4382 ExitNotification.type = new messages_1.ProtocolNotificationType0('exit');
\r
4383 })(ExitNotification = exports.ExitNotification || (exports.ExitNotification = {}));
\r
4385 * The configuration change notification is sent from the client to the server
\r
4386 * when the client's configuration has changed. The notification contains
\r
4387 * the changed configuration as defined by the language client.
\r
4389 var DidChangeConfigurationNotification;
\r
4390 (function (DidChangeConfigurationNotification) {
\r
4391 DidChangeConfigurationNotification.type = new messages_1.ProtocolNotificationType('workspace/didChangeConfiguration');
\r
4392 })(DidChangeConfigurationNotification = exports.DidChangeConfigurationNotification || (exports.DidChangeConfigurationNotification = {}));
\r
4393 //---- Message show and log notifications ----
\r
4395 * The message type
\r
4398 (function (MessageType) {
\r
4400 * An error message.
\r
4402 MessageType.Error = 1;
\r
4404 * A warning message.
\r
4406 MessageType.Warning = 2;
\r
4408 * An information message.
\r
4410 MessageType.Info = 3;
\r
4414 MessageType.Log = 4;
\r
4415 })(MessageType = exports.MessageType || (exports.MessageType = {}));
\r
4417 * The show message notification is sent from a server to a client to ask
\r
4418 * the client to display a particular message in the user interface.
\r
4420 var ShowMessageNotification;
\r
4421 (function (ShowMessageNotification) {
\r
4422 ShowMessageNotification.type = new messages_1.ProtocolNotificationType('window/showMessage');
\r
4423 })(ShowMessageNotification = exports.ShowMessageNotification || (exports.ShowMessageNotification = {}));
\r
4425 * The show message request is sent from the server to the client to show a message
\r
4426 * and a set of options actions to the user.
\r
4428 var ShowMessageRequest;
\r
4429 (function (ShowMessageRequest) {
\r
4430 ShowMessageRequest.type = new messages_1.ProtocolRequestType('window/showMessageRequest');
\r
4431 })(ShowMessageRequest = exports.ShowMessageRequest || (exports.ShowMessageRequest = {}));
\r
4433 * The log message notification is sent from the server to the client to ask
\r
4434 * the client to log a particular message.
\r
4436 var LogMessageNotification;
\r
4437 (function (LogMessageNotification) {
\r
4438 LogMessageNotification.type = new messages_1.ProtocolNotificationType('window/logMessage');
\r
4439 })(LogMessageNotification = exports.LogMessageNotification || (exports.LogMessageNotification = {}));
\r
4440 //---- Telemetry notification
\r
4442 * The telemetry event notification is sent from the server to the client to ask
\r
4443 * the client to log telemetry data.
\r
4445 var TelemetryEventNotification;
\r
4446 (function (TelemetryEventNotification) {
\r
4447 TelemetryEventNotification.type = new messages_1.ProtocolNotificationType('telemetry/event');
\r
4448 })(TelemetryEventNotification = exports.TelemetryEventNotification || (exports.TelemetryEventNotification = {}));
\r
4450 * Defines how the host (editor) should sync
\r
4451 * document changes to the language server.
\r
4453 var TextDocumentSyncKind;
\r
4454 (function (TextDocumentSyncKind) {
\r
4456 * Documents should not be synced at all.
\r
4458 TextDocumentSyncKind.None = 0;
\r
4460 * Documents are synced by always sending the full content
\r
4461 * of the document.
\r
4463 TextDocumentSyncKind.Full = 1;
\r
4465 * Documents are synced by sending the full content on open.
\r
4466 * After that only incremental updates to the document are
\r
4469 TextDocumentSyncKind.Incremental = 2;
\r
4470 })(TextDocumentSyncKind = exports.TextDocumentSyncKind || (exports.TextDocumentSyncKind = {}));
\r
4472 * The document open notification is sent from the client to the server to signal
\r
4473 * newly opened text documents. The document's truth is now managed by the client
\r
4474 * and the server must not try to read the document's truth using the document's
\r
4475 * uri. Open in this sense means it is managed by the client. It doesn't necessarily
\r
4476 * mean that its content is presented in an editor. An open notification must not
\r
4477 * be sent more than once without a corresponding close notification send before.
\r
4478 * This means open and close notification must be balanced and the max open count
\r
4481 var DidOpenTextDocumentNotification;
\r
4482 (function (DidOpenTextDocumentNotification) {
\r
4483 DidOpenTextDocumentNotification.method = 'textDocument/didOpen';
\r
4484 DidOpenTextDocumentNotification.type = new messages_1.ProtocolNotificationType(DidOpenTextDocumentNotification.method);
\r
4485 })(DidOpenTextDocumentNotification = exports.DidOpenTextDocumentNotification || (exports.DidOpenTextDocumentNotification = {}));
\r
4487 * The document change notification is sent from the client to the server to signal
\r
4488 * changes to a text document.
\r
4490 var DidChangeTextDocumentNotification;
\r
4491 (function (DidChangeTextDocumentNotification) {
\r
4492 DidChangeTextDocumentNotification.method = 'textDocument/didChange';
\r
4493 DidChangeTextDocumentNotification.type = new messages_1.ProtocolNotificationType(DidChangeTextDocumentNotification.method);
\r
4494 })(DidChangeTextDocumentNotification = exports.DidChangeTextDocumentNotification || (exports.DidChangeTextDocumentNotification = {}));
\r
4496 * The document close notification is sent from the client to the server when
\r
4497 * the document got closed in the client. The document's truth now exists where
\r
4498 * the document's uri points to (e.g. if the document's uri is a file uri the
\r
4499 * truth now exists on disk). As with the open notification the close notification
\r
4500 * is about managing the document's content. Receiving a close notification
\r
4501 * doesn't mean that the document was open in an editor before. A close
\r
4502 * notification requires a previous open notification to be sent.
\r
4504 var DidCloseTextDocumentNotification;
\r
4505 (function (DidCloseTextDocumentNotification) {
\r
4506 DidCloseTextDocumentNotification.method = 'textDocument/didClose';
\r
4507 DidCloseTextDocumentNotification.type = new messages_1.ProtocolNotificationType(DidCloseTextDocumentNotification.method);
\r
4508 })(DidCloseTextDocumentNotification = exports.DidCloseTextDocumentNotification || (exports.DidCloseTextDocumentNotification = {}));
\r
4510 * The document save notification is sent from the client to the server when
\r
4511 * the document got saved in the client.
\r
4513 var DidSaveTextDocumentNotification;
\r
4514 (function (DidSaveTextDocumentNotification) {
\r
4515 DidSaveTextDocumentNotification.method = 'textDocument/didSave';
\r
4516 DidSaveTextDocumentNotification.type = new messages_1.ProtocolNotificationType(DidSaveTextDocumentNotification.method);
\r
4517 })(DidSaveTextDocumentNotification = exports.DidSaveTextDocumentNotification || (exports.DidSaveTextDocumentNotification = {}));
\r
4519 * Represents reasons why a text document is saved.
\r
4521 var TextDocumentSaveReason;
\r
4522 (function (TextDocumentSaveReason) {
\r
4524 * Manually triggered, e.g. by the user pressing save, by starting debugging,
\r
4525 * or by an API call.
\r
4527 TextDocumentSaveReason.Manual = 1;
\r
4529 * Automatic after a delay.
\r
4531 TextDocumentSaveReason.AfterDelay = 2;
\r
4533 * When the editor lost focus.
\r
4535 TextDocumentSaveReason.FocusOut = 3;
\r
4536 })(TextDocumentSaveReason = exports.TextDocumentSaveReason || (exports.TextDocumentSaveReason = {}));
\r
4538 * A document will save notification is sent from the client to the server before
\r
4539 * the document is actually saved.
\r
4541 var WillSaveTextDocumentNotification;
\r
4542 (function (WillSaveTextDocumentNotification) {
\r
4543 WillSaveTextDocumentNotification.method = 'textDocument/willSave';
\r
4544 WillSaveTextDocumentNotification.type = new messages_1.ProtocolNotificationType(WillSaveTextDocumentNotification.method);
\r
4545 })(WillSaveTextDocumentNotification = exports.WillSaveTextDocumentNotification || (exports.WillSaveTextDocumentNotification = {}));
\r
4547 * A document will save request is sent from the client to the server before
\r
4548 * the document is actually saved. The request can return an array of TextEdits
\r
4549 * which will be applied to the text document before it is saved. Please note that
\r
4550 * clients might drop results if computing the text edits took too long or if a
\r
4551 * server constantly fails on this request. This is done to keep the save fast and
\r
4554 var WillSaveTextDocumentWaitUntilRequest;
\r
4555 (function (WillSaveTextDocumentWaitUntilRequest) {
\r
4556 WillSaveTextDocumentWaitUntilRequest.method = 'textDocument/willSaveWaitUntil';
\r
4557 WillSaveTextDocumentWaitUntilRequest.type = new messages_1.ProtocolRequestType(WillSaveTextDocumentWaitUntilRequest.method);
\r
4558 })(WillSaveTextDocumentWaitUntilRequest = exports.WillSaveTextDocumentWaitUntilRequest || (exports.WillSaveTextDocumentWaitUntilRequest = {}));
\r
4560 * The watched files notification is sent from the client to the server when
\r
4561 * the client detects changes to file watched by the language client.
\r
4563 var DidChangeWatchedFilesNotification;
\r
4564 (function (DidChangeWatchedFilesNotification) {
\r
4565 DidChangeWatchedFilesNotification.type = new messages_1.ProtocolNotificationType('workspace/didChangeWatchedFiles');
\r
4566 })(DidChangeWatchedFilesNotification = exports.DidChangeWatchedFilesNotification || (exports.DidChangeWatchedFilesNotification = {}));
\r
4568 * The file event type
\r
4570 var FileChangeType;
\r
4571 (function (FileChangeType) {
\r
4573 * The file got created.
\r
4575 FileChangeType.Created = 1;
\r
4577 * The file got changed.
\r
4579 FileChangeType.Changed = 2;
\r
4581 * The file got deleted.
\r
4583 FileChangeType.Deleted = 3;
\r
4584 })(FileChangeType = exports.FileChangeType || (exports.FileChangeType = {}));
\r
4586 (function (WatchKind) {
\r
4588 * Interested in create events.
\r
4590 WatchKind.Create = 1;
\r
4592 * Interested in change events
\r
4594 WatchKind.Change = 2;
\r
4596 * Interested in delete events
\r
4598 WatchKind.Delete = 4;
\r
4599 })(WatchKind = exports.WatchKind || (exports.WatchKind = {}));
\r
4601 * Diagnostics notification are sent from the server to the client to signal
\r
4602 * results of validation runs.
\r
4604 var PublishDiagnosticsNotification;
\r
4605 (function (PublishDiagnosticsNotification) {
\r
4606 PublishDiagnosticsNotification.type = new messages_1.ProtocolNotificationType('textDocument/publishDiagnostics');
\r
4607 })(PublishDiagnosticsNotification = exports.PublishDiagnosticsNotification || (exports.PublishDiagnosticsNotification = {}));
\r
4609 * How a completion was triggered
\r
4611 var CompletionTriggerKind;
\r
4612 (function (CompletionTriggerKind) {
\r
4614 * Completion was triggered by typing an identifier (24x7 code
\r
4615 * complete), manual invocation (e.g Ctrl+Space) or via API.
\r
4617 CompletionTriggerKind.Invoked = 1;
\r
4619 * Completion was triggered by a trigger character specified by
\r
4620 * the `triggerCharacters` properties of the `CompletionRegistrationOptions`.
\r
4622 CompletionTriggerKind.TriggerCharacter = 2;
\r
4624 * Completion was re-triggered as current completion list is incomplete
\r
4626 CompletionTriggerKind.TriggerForIncompleteCompletions = 3;
\r
4627 })(CompletionTriggerKind = exports.CompletionTriggerKind || (exports.CompletionTriggerKind = {}));
\r
4629 * Request to request completion at a given text document position. The request's
\r
4630 * parameter is of type [TextDocumentPosition](#TextDocumentPosition) the response
\r
4631 * is of type [CompletionItem[]](#CompletionItem) or [CompletionList](#CompletionList)
\r
4632 * or a Thenable that resolves to such.
\r
4634 * The request can delay the computation of the [`detail`](#CompletionItem.detail)
\r
4635 * and [`documentation`](#CompletionItem.documentation) properties to the `completionItem/resolve`
\r
4636 * request. However, properties that are needed for the initial sorting and filtering, like `sortText`,
\r
4637 * `filterText`, `insertText`, and `textEdit`, must not be changed during resolve.
\r
4639 var CompletionRequest;
\r
4640 (function (CompletionRequest) {
\r
4641 CompletionRequest.method = 'textDocument/completion';
\r
4642 CompletionRequest.type = new messages_1.ProtocolRequestType(CompletionRequest.method);
\r
4643 /** @deprecated Use CompletionRequest.type */
\r
4644 CompletionRequest.resultType = new vscode_jsonrpc_1.ProgressType();
\r
4645 })(CompletionRequest = exports.CompletionRequest || (exports.CompletionRequest = {}));
\r
4647 * Request to resolve additional information for a given completion item.The request's
\r
4648 * parameter is of type [CompletionItem](#CompletionItem) the response
\r
4649 * is of type [CompletionItem](#CompletionItem) or a Thenable that resolves to such.
\r
4651 var CompletionResolveRequest;
\r
4652 (function (CompletionResolveRequest) {
\r
4653 CompletionResolveRequest.method = 'completionItem/resolve';
\r
4654 CompletionResolveRequest.type = new messages_1.ProtocolRequestType(CompletionResolveRequest.method);
\r
4655 })(CompletionResolveRequest = exports.CompletionResolveRequest || (exports.CompletionResolveRequest = {}));
\r
4657 * Request to request hover information at a given text document position. The request's
\r
4658 * parameter is of type [TextDocumentPosition](#TextDocumentPosition) the response is of
\r
4659 * type [Hover](#Hover) or a Thenable that resolves to such.
\r
4662 (function (HoverRequest) {
\r
4663 HoverRequest.method = 'textDocument/hover';
\r
4664 HoverRequest.type = new messages_1.ProtocolRequestType(HoverRequest.method);
\r
4665 })(HoverRequest = exports.HoverRequest || (exports.HoverRequest = {}));
\r
4667 * How a signature help was triggered.
\r
4671 var SignatureHelpTriggerKind;
\r
4672 (function (SignatureHelpTriggerKind) {
\r
4674 * Signature help was invoked manually by the user or by a command.
\r
4676 SignatureHelpTriggerKind.Invoked = 1;
\r
4678 * Signature help was triggered by a trigger character.
\r
4680 SignatureHelpTriggerKind.TriggerCharacter = 2;
\r
4682 * Signature help was triggered by the cursor moving or by the document content changing.
\r
4684 SignatureHelpTriggerKind.ContentChange = 3;
\r
4685 })(SignatureHelpTriggerKind = exports.SignatureHelpTriggerKind || (exports.SignatureHelpTriggerKind = {}));
\r
4686 var SignatureHelpRequest;
\r
4687 (function (SignatureHelpRequest) {
\r
4688 SignatureHelpRequest.method = 'textDocument/signatureHelp';
\r
4689 SignatureHelpRequest.type = new messages_1.ProtocolRequestType(SignatureHelpRequest.method);
\r
4690 })(SignatureHelpRequest = exports.SignatureHelpRequest || (exports.SignatureHelpRequest = {}));
\r
4692 * A request to resolve the definition location of a symbol at a given text
\r
4693 * document position. The request's parameter is of type [TextDocumentPosition]
\r
4694 * (#TextDocumentPosition) the response is of either type [Definition](#Definition)
\r
4695 * or a typed array of [DefinitionLink](#DefinitionLink) or a Thenable that resolves
\r
4698 var DefinitionRequest;
\r
4699 (function (DefinitionRequest) {
\r
4700 DefinitionRequest.method = 'textDocument/definition';
\r
4701 DefinitionRequest.type = new messages_1.ProtocolRequestType(DefinitionRequest.method);
\r
4702 /** @deprecated Use DefinitionRequest.type */
\r
4703 DefinitionRequest.resultType = new vscode_jsonrpc_1.ProgressType();
\r
4704 })(DefinitionRequest = exports.DefinitionRequest || (exports.DefinitionRequest = {}));
\r
4706 * A request to resolve project-wide references for the symbol denoted
\r
4707 * by the given text document position. The request's parameter is of
\r
4708 * type [ReferenceParams](#ReferenceParams) the response is of type
\r
4709 * [Location[]](#Location) or a Thenable that resolves to such.
\r
4711 var ReferencesRequest;
\r
4712 (function (ReferencesRequest) {
\r
4713 ReferencesRequest.method = 'textDocument/references';
\r
4714 ReferencesRequest.type = new messages_1.ProtocolRequestType(ReferencesRequest.method);
\r
4715 /** @deprecated Use ReferencesRequest.type */
\r
4716 ReferencesRequest.resultType = new vscode_jsonrpc_1.ProgressType();
\r
4717 })(ReferencesRequest = exports.ReferencesRequest || (exports.ReferencesRequest = {}));
\r
4719 * Request to resolve a [DocumentHighlight](#DocumentHighlight) for a given
\r
4720 * text document position. The request's parameter is of type [TextDocumentPosition]
\r
4721 * (#TextDocumentPosition) the request response is of type [DocumentHighlight[]]
\r
4722 * (#DocumentHighlight) or a Thenable that resolves to such.
\r
4724 var DocumentHighlightRequest;
\r
4725 (function (DocumentHighlightRequest) {
\r
4726 DocumentHighlightRequest.method = 'textDocument/documentHighlight';
\r
4727 DocumentHighlightRequest.type = new messages_1.ProtocolRequestType(DocumentHighlightRequest.method);
\r
4728 /** @deprecated Use DocumentHighlightRequest.type */
\r
4729 DocumentHighlightRequest.resultType = new vscode_jsonrpc_1.ProgressType();
\r
4730 })(DocumentHighlightRequest = exports.DocumentHighlightRequest || (exports.DocumentHighlightRequest = {}));
\r
4732 * A request to list all symbols found in a given text document. The request's
\r
4733 * parameter is of type [TextDocumentIdentifier](#TextDocumentIdentifier) the
\r
4734 * response is of type [SymbolInformation[]](#SymbolInformation) or a Thenable
\r
4735 * that resolves to such.
\r
4737 var DocumentSymbolRequest;
\r
4738 (function (DocumentSymbolRequest) {
\r
4739 DocumentSymbolRequest.method = 'textDocument/documentSymbol';
\r
4740 DocumentSymbolRequest.type = new messages_1.ProtocolRequestType(DocumentSymbolRequest.method);
\r
4741 /** @deprecated Use DocumentSymbolRequest.type */
\r
4742 DocumentSymbolRequest.resultType = new vscode_jsonrpc_1.ProgressType();
\r
4743 })(DocumentSymbolRequest = exports.DocumentSymbolRequest || (exports.DocumentSymbolRequest = {}));
\r
4745 * A request to provide commands for the given text document and range.
\r
4747 var CodeActionRequest;
\r
4748 (function (CodeActionRequest) {
\r
4749 CodeActionRequest.method = 'textDocument/codeAction';
\r
4750 CodeActionRequest.type = new messages_1.ProtocolRequestType(CodeActionRequest.method);
\r
4751 /** @deprecated Use CodeActionRequest.type */
\r
4752 CodeActionRequest.resultType = new vscode_jsonrpc_1.ProgressType();
\r
4753 })(CodeActionRequest = exports.CodeActionRequest || (exports.CodeActionRequest = {}));
\r
4755 * A request to list project-wide symbols matching the query string given
\r
4756 * by the [WorkspaceSymbolParams](#WorkspaceSymbolParams). The response is
\r
4757 * of type [SymbolInformation[]](#SymbolInformation) or a Thenable that
\r
4758 * resolves to such.
\r
4760 var WorkspaceSymbolRequest;
\r
4761 (function (WorkspaceSymbolRequest) {
\r
4762 WorkspaceSymbolRequest.method = 'workspace/symbol';
\r
4763 WorkspaceSymbolRequest.type = new messages_1.ProtocolRequestType(WorkspaceSymbolRequest.method);
\r
4764 /** @deprecated Use WorkspaceSymbolRequest.type */
\r
4765 WorkspaceSymbolRequest.resultType = new vscode_jsonrpc_1.ProgressType();
\r
4766 })(WorkspaceSymbolRequest = exports.WorkspaceSymbolRequest || (exports.WorkspaceSymbolRequest = {}));
\r
4768 * A request to provide code lens for the given text document.
\r
4770 var CodeLensRequest;
\r
4771 (function (CodeLensRequest) {
\r
4772 CodeLensRequest.type = new messages_1.ProtocolRequestType('textDocument/codeLens');
\r
4773 /** @deprecated Use CodeLensRequest.type */
\r
4774 CodeLensRequest.resultType = new vscode_jsonrpc_1.ProgressType();
\r
4775 })(CodeLensRequest = exports.CodeLensRequest || (exports.CodeLensRequest = {}));
\r
4777 * A request to resolve a command for a given code lens.
\r
4779 var CodeLensResolveRequest;
\r
4780 (function (CodeLensResolveRequest) {
\r
4781 CodeLensResolveRequest.type = new messages_1.ProtocolRequestType('codeLens/resolve');
\r
4782 })(CodeLensResolveRequest = exports.CodeLensResolveRequest || (exports.CodeLensResolveRequest = {}));
\r
4784 * A request to provide document links
\r
4786 var DocumentLinkRequest;
\r
4787 (function (DocumentLinkRequest) {
\r
4788 DocumentLinkRequest.method = 'textDocument/documentLink';
\r
4789 DocumentLinkRequest.type = new messages_1.ProtocolRequestType(DocumentLinkRequest.method);
\r
4790 /** @deprecated Use DocumentLinkRequest.type */
\r
4791 DocumentLinkRequest.resultType = new vscode_jsonrpc_1.ProgressType();
\r
4792 })(DocumentLinkRequest = exports.DocumentLinkRequest || (exports.DocumentLinkRequest = {}));
\r
4794 * Request to resolve additional information for a given document link. The request's
\r
4795 * parameter is of type [DocumentLink](#DocumentLink) the response
\r
4796 * is of type [DocumentLink](#DocumentLink) or a Thenable that resolves to such.
\r
4798 var DocumentLinkResolveRequest;
\r
4799 (function (DocumentLinkResolveRequest) {
\r
4800 DocumentLinkResolveRequest.type = new messages_1.ProtocolRequestType('documentLink/resolve');
\r
4801 })(DocumentLinkResolveRequest = exports.DocumentLinkResolveRequest || (exports.DocumentLinkResolveRequest = {}));
\r
4803 * A request to to format a whole document.
\r
4805 var DocumentFormattingRequest;
\r
4806 (function (DocumentFormattingRequest) {
\r
4807 DocumentFormattingRequest.method = 'textDocument/formatting';
\r
4808 DocumentFormattingRequest.type = new messages_1.ProtocolRequestType(DocumentFormattingRequest.method);
\r
4809 })(DocumentFormattingRequest = exports.DocumentFormattingRequest || (exports.DocumentFormattingRequest = {}));
\r
4811 * A request to to format a range in a document.
\r
4813 var DocumentRangeFormattingRequest;
\r
4814 (function (DocumentRangeFormattingRequest) {
\r
4815 DocumentRangeFormattingRequest.method = 'textDocument/rangeFormatting';
\r
4816 DocumentRangeFormattingRequest.type = new messages_1.ProtocolRequestType(DocumentRangeFormattingRequest.method);
\r
4817 })(DocumentRangeFormattingRequest = exports.DocumentRangeFormattingRequest || (exports.DocumentRangeFormattingRequest = {}));
\r
4819 * A request to format a document on type.
\r
4821 var DocumentOnTypeFormattingRequest;
\r
4822 (function (DocumentOnTypeFormattingRequest) {
\r
4823 DocumentOnTypeFormattingRequest.method = 'textDocument/onTypeFormatting';
\r
4824 DocumentOnTypeFormattingRequest.type = new messages_1.ProtocolRequestType(DocumentOnTypeFormattingRequest.method);
\r
4825 })(DocumentOnTypeFormattingRequest = exports.DocumentOnTypeFormattingRequest || (exports.DocumentOnTypeFormattingRequest = {}));
\r
4827 * A request to rename a symbol.
\r
4829 var RenameRequest;
\r
4830 (function (RenameRequest) {
\r
4831 RenameRequest.method = 'textDocument/rename';
\r
4832 RenameRequest.type = new messages_1.ProtocolRequestType(RenameRequest.method);
\r
4833 })(RenameRequest = exports.RenameRequest || (exports.RenameRequest = {}));
\r
4835 * A request to test and perform the setup necessary for a rename.
\r
4837 var PrepareRenameRequest;
\r
4838 (function (PrepareRenameRequest) {
\r
4839 PrepareRenameRequest.method = 'textDocument/prepareRename';
\r
4840 PrepareRenameRequest.type = new messages_1.ProtocolRequestType(PrepareRenameRequest.method);
\r
4841 })(PrepareRenameRequest = exports.PrepareRenameRequest || (exports.PrepareRenameRequest = {}));
\r
4843 * A request send from the client to the server to execute a command. The request might return
\r
4844 * a workspace edit which the client will apply to the workspace.
\r
4846 var ExecuteCommandRequest;
\r
4847 (function (ExecuteCommandRequest) {
\r
4848 ExecuteCommandRequest.type = new messages_1.ProtocolRequestType('workspace/executeCommand');
\r
4849 })(ExecuteCommandRequest = exports.ExecuteCommandRequest || (exports.ExecuteCommandRequest = {}));
\r
4851 * A request sent from the server to the client to modified certain resources.
\r
4853 var ApplyWorkspaceEditRequest;
\r
4854 (function (ApplyWorkspaceEditRequest) {
\r
4855 ApplyWorkspaceEditRequest.type = new messages_1.ProtocolRequestType('workspace/applyEdit');
\r
4856 })(ApplyWorkspaceEditRequest = exports.ApplyWorkspaceEditRequest || (exports.ApplyWorkspaceEditRequest = {}));
\r
4861 /***/ ((__unused_webpack_module, exports) => {
4863 /* --------------------------------------------------------------------------------------------
\r
4864 * Copyright (c) Microsoft Corporation. All rights reserved.
\r
4865 * Licensed under the MIT License. See License.txt in the project root for license information.
\r
4866 * ------------------------------------------------------------------------------------------ */
\r
4868 Object.defineProperty(exports, "__esModule", ({ value: true }));
\r
4869 function boolean(value) {
\r
4870 return value === true || value === false;
\r
4872 exports.boolean = boolean;
\r
4873 function string(value) {
\r
4874 return typeof value === 'string' || value instanceof String;
\r
4876 exports.string = string;
\r
4877 function number(value) {
\r
4878 return typeof value === 'number' || value instanceof Number;
\r
4880 exports.number = number;
\r
4881 function error(value) {
\r
4882 return value instanceof Error;
\r
4884 exports.error = error;
\r
4885 function func(value) {
\r
4886 return typeof value === 'function';
\r
4888 exports.func = func;
\r
4889 function array(value) {
\r
4890 return Array.isArray(value);
\r
4892 exports.array = array;
\r
4893 function stringArray(value) {
\r
4894 return array(value) && value.every(elem => string(elem));
\r
4896 exports.stringArray = stringArray;
\r
4897 function typedArray(value, check) {
\r
4898 return Array.isArray(value) && value.every(check);
\r
4900 exports.typedArray = typedArray;
\r
4901 function objectLiteral(value) {
\r
4902 // Strictly speaking class instances pass this check as well. Since the LSP
\r
4903 // doesn't use classes we ignore this for now. If we do we need to add something
\r
4904 // like this: `Object.getPrototypeOf(Object.getPrototypeOf(x)) === null`
\r
4905 return value !== null && typeof value === 'object';
\r
4907 exports.objectLiteral = objectLiteral;
\r
4912 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
4914 /* --------------------------------------------------------------------------------------------
\r
4915 * Copyright (c) Microsoft Corporation. All rights reserved.
\r
4916 * Licensed under the MIT License. See License.txt in the project root for license information.
\r
4917 * ------------------------------------------------------------------------------------------ */
\r
4919 Object.defineProperty(exports, "__esModule", ({ value: true }));
\r
4920 const vscode_jsonrpc_1 = __webpack_require__(5);
\r
4921 class ProtocolRequestType0 extends vscode_jsonrpc_1.RequestType0 {
\r
4922 constructor(method) {
\r
4926 exports.ProtocolRequestType0 = ProtocolRequestType0;
\r
4927 class ProtocolRequestType extends vscode_jsonrpc_1.RequestType {
\r
4928 constructor(method) {
\r
4932 exports.ProtocolRequestType = ProtocolRequestType;
\r
4933 class ProtocolNotificationType extends vscode_jsonrpc_1.NotificationType {
\r
4934 constructor(method) {
\r
4938 exports.ProtocolNotificationType = ProtocolNotificationType;
\r
4939 class ProtocolNotificationType0 extends vscode_jsonrpc_1.NotificationType0 {
\r
4940 constructor(method) {
\r
4944 exports.ProtocolNotificationType0 = ProtocolNotificationType0;
\r
4949 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
4951 /* --------------------------------------------------------------------------------------------
\r
4952 * Copyright (c) Microsoft Corporation. All rights reserved.
\r
4953 * Licensed under the MIT License. See License.txt in the project root for license information.
\r
4954 * ------------------------------------------------------------------------------------------ */
\r
4956 Object.defineProperty(exports, "__esModule", ({ value: true }));
\r
4957 const vscode_jsonrpc_1 = __webpack_require__(5);
\r
4958 const messages_1 = __webpack_require__(21);
\r
4959 // @ts-ignore: to avoid inlining LocatioLink as dynamic import
\r
4960 let __noDynamicImport;
\r
4962 * A request to resolve the implementation locations of a symbol at a given text
\r
4963 * document position. The request's parameter is of type [TextDocumentPositioParams]
\r
4964 * (#TextDocumentPositionParams) the response is of type [Definition](#Definition) or a
\r
4965 * Thenable that resolves to such.
\r
4967 var ImplementationRequest;
\r
4968 (function (ImplementationRequest) {
\r
4969 ImplementationRequest.method = 'textDocument/implementation';
\r
4970 ImplementationRequest.type = new messages_1.ProtocolRequestType(ImplementationRequest.method);
\r
4971 /** @deprecated Use ImplementationRequest.type */
\r
4972 ImplementationRequest.resultType = new vscode_jsonrpc_1.ProgressType();
\r
4973 })(ImplementationRequest = exports.ImplementationRequest || (exports.ImplementationRequest = {}));
\r
4978 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
4980 /* --------------------------------------------------------------------------------------------
\r
4981 * Copyright (c) Microsoft Corporation. All rights reserved.
\r
4982 * Licensed under the MIT License. See License.txt in the project root for license information.
\r
4983 * ------------------------------------------------------------------------------------------ */
\r
4985 Object.defineProperty(exports, "__esModule", ({ value: true }));
\r
4986 const vscode_jsonrpc_1 = __webpack_require__(5);
\r
4987 const messages_1 = __webpack_require__(21);
\r
4988 // @ts-ignore: to avoid inlining LocatioLink as dynamic import
\r
4989 let __noDynamicImport;
\r
4991 * A request to resolve the type definition locations of a symbol at a given text
\r
4992 * document position. The request's parameter is of type [TextDocumentPositioParams]
\r
4993 * (#TextDocumentPositionParams) the response is of type [Definition](#Definition) or a
\r
4994 * Thenable that resolves to such.
\r
4996 var TypeDefinitionRequest;
\r
4997 (function (TypeDefinitionRequest) {
\r
4998 TypeDefinitionRequest.method = 'textDocument/typeDefinition';
\r
4999 TypeDefinitionRequest.type = new messages_1.ProtocolRequestType(TypeDefinitionRequest.method);
\r
5000 /** @deprecated Use TypeDefinitionRequest.type */
\r
5001 TypeDefinitionRequest.resultType = new vscode_jsonrpc_1.ProgressType();
\r
5002 })(TypeDefinitionRequest = exports.TypeDefinitionRequest || (exports.TypeDefinitionRequest = {}));
\r
5007 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
5009 /* --------------------------------------------------------------------------------------------
\r
5010 * Copyright (c) Microsoft Corporation. All rights reserved.
\r
5011 * Licensed under the MIT License. See License.txt in the project root for license information.
\r
5012 * ------------------------------------------------------------------------------------------ */
\r
5014 Object.defineProperty(exports, "__esModule", ({ value: true }));
\r
5015 const messages_1 = __webpack_require__(21);
\r
5017 * The `workspace/workspaceFolders` is sent from the server to the client to fetch the open workspace folders.
\r
5019 var WorkspaceFoldersRequest;
\r
5020 (function (WorkspaceFoldersRequest) {
\r
5021 WorkspaceFoldersRequest.type = new messages_1.ProtocolRequestType0('workspace/workspaceFolders');
\r
5022 })(WorkspaceFoldersRequest = exports.WorkspaceFoldersRequest || (exports.WorkspaceFoldersRequest = {}));
\r
5024 * The `workspace/didChangeWorkspaceFolders` notification is sent from the client to the server when the workspace
\r
5025 * folder configuration changes.
\r
5027 var DidChangeWorkspaceFoldersNotification;
\r
5028 (function (DidChangeWorkspaceFoldersNotification) {
\r
5029 DidChangeWorkspaceFoldersNotification.type = new messages_1.ProtocolNotificationType('workspace/didChangeWorkspaceFolders');
\r
5030 })(DidChangeWorkspaceFoldersNotification = exports.DidChangeWorkspaceFoldersNotification || (exports.DidChangeWorkspaceFoldersNotification = {}));
\r
5035 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
5037 /* --------------------------------------------------------------------------------------------
\r
5038 * Copyright (c) Microsoft Corporation. All rights reserved.
\r
5039 * Licensed under the MIT License. See License.txt in the project root for license information.
\r
5040 * ------------------------------------------------------------------------------------------ */
\r
5042 Object.defineProperty(exports, "__esModule", ({ value: true }));
\r
5043 const messages_1 = __webpack_require__(21);
\r
5045 * The 'workspace/configuration' request is sent from the server to the client to fetch a certain
\r
5046 * configuration setting.
\r
5048 * This pull model replaces the old push model were the client signaled configuration change via an
\r
5049 * event. If the server still needs to react to configuration changes (since the server caches the
\r
5050 * result of `workspace/configuration` requests) the server should register for an empty configuration
\r
5051 * change event and empty the cache if such an event is received.
\r
5053 var ConfigurationRequest;
\r
5054 (function (ConfigurationRequest) {
\r
5055 ConfigurationRequest.type = new messages_1.ProtocolRequestType('workspace/configuration');
\r
5056 })(ConfigurationRequest = exports.ConfigurationRequest || (exports.ConfigurationRequest = {}));
\r
5061 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
5063 /* --------------------------------------------------------------------------------------------
\r
5064 * Copyright (c) Microsoft Corporation. All rights reserved.
\r
5065 * Licensed under the MIT License. See License.txt in the project root for license information.
\r
5066 * ------------------------------------------------------------------------------------------ */
\r
5068 Object.defineProperty(exports, "__esModule", ({ value: true }));
\r
5069 const vscode_jsonrpc_1 = __webpack_require__(5);
\r
5070 const messages_1 = __webpack_require__(21);
\r
5072 * A request to list all color symbols found in a given text document. The request's
\r
5073 * parameter is of type [DocumentColorParams](#DocumentColorParams) the
\r
5074 * response is of type [ColorInformation[]](#ColorInformation) or a Thenable
\r
5075 * that resolves to such.
\r
5077 var DocumentColorRequest;
\r
5078 (function (DocumentColorRequest) {
\r
5079 DocumentColorRequest.method = 'textDocument/documentColor';
\r
5080 DocumentColorRequest.type = new messages_1.ProtocolRequestType(DocumentColorRequest.method);
\r
5081 /** @deprecated Use DocumentColorRequest.type */
\r
5082 DocumentColorRequest.resultType = new vscode_jsonrpc_1.ProgressType();
\r
5083 })(DocumentColorRequest = exports.DocumentColorRequest || (exports.DocumentColorRequest = {}));
\r
5085 * A request to list all presentation for a color. The request's
\r
5086 * parameter is of type [ColorPresentationParams](#ColorPresentationParams) the
\r
5087 * response is of type [ColorInformation[]](#ColorInformation) or a Thenable
\r
5088 * that resolves to such.
\r
5090 var ColorPresentationRequest;
\r
5091 (function (ColorPresentationRequest) {
\r
5092 ColorPresentationRequest.type = new messages_1.ProtocolRequestType('textDocument/colorPresentation');
\r
5093 })(ColorPresentationRequest = exports.ColorPresentationRequest || (exports.ColorPresentationRequest = {}));
\r
5098 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
5101 /*---------------------------------------------------------------------------------------------
\r
5102 * Copyright (c) Microsoft Corporation. All rights reserved.
\r
5103 * Licensed under the MIT License. See License.txt in the project root for license information.
\r
5104 *--------------------------------------------------------------------------------------------*/
\r
5105 Object.defineProperty(exports, "__esModule", ({ value: true }));
\r
5106 const vscode_jsonrpc_1 = __webpack_require__(5);
\r
5107 const messages_1 = __webpack_require__(21);
\r
5109 * Enum of known range kinds
\r
5111 var FoldingRangeKind;
\r
5112 (function (FoldingRangeKind) {
\r
5114 * Folding range for a comment
\r
5116 FoldingRangeKind["Comment"] = "comment";
\r
5118 * Folding range for a imports or includes
\r
5120 FoldingRangeKind["Imports"] = "imports";
\r
5122 * Folding range for a region (e.g. `#region`)
\r
5124 FoldingRangeKind["Region"] = "region";
\r
5125 })(FoldingRangeKind = exports.FoldingRangeKind || (exports.FoldingRangeKind = {}));
\r
5127 * A request to provide folding ranges in a document. The request's
\r
5128 * parameter is of type [FoldingRangeParams](#FoldingRangeParams), the
\r
5129 * response is of type [FoldingRangeList](#FoldingRangeList) or a Thenable
\r
5130 * that resolves to such.
\r
5132 var FoldingRangeRequest;
\r
5133 (function (FoldingRangeRequest) {
\r
5134 FoldingRangeRequest.method = 'textDocument/foldingRange';
\r
5135 FoldingRangeRequest.type = new messages_1.ProtocolRequestType(FoldingRangeRequest.method);
\r
5136 /** @deprecated Use FoldingRangeRequest.type */
\r
5137 FoldingRangeRequest.resultType = new vscode_jsonrpc_1.ProgressType();
\r
5138 })(FoldingRangeRequest = exports.FoldingRangeRequest || (exports.FoldingRangeRequest = {}));
\r
5143 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
5145 /* --------------------------------------------------------------------------------------------
\r
5146 * Copyright (c) Microsoft Corporation. All rights reserved.
\r
5147 * Licensed under the MIT License. See License.txt in the project root for license information.
\r
5148 * ------------------------------------------------------------------------------------------ */
\r
5150 Object.defineProperty(exports, "__esModule", ({ value: true }));
\r
5151 const vscode_jsonrpc_1 = __webpack_require__(5);
\r
5152 const messages_1 = __webpack_require__(21);
\r
5153 // @ts-ignore: to avoid inlining LocatioLink as dynamic import
\r
5154 let __noDynamicImport;
\r
5156 * A request to resolve the type definition locations of a symbol at a given text
\r
5157 * document position. The request's parameter is of type [TextDocumentPositioParams]
\r
5158 * (#TextDocumentPositionParams) the response is of type [Declaration](#Declaration)
\r
5159 * or a typed array of [DeclarationLink](#DeclarationLink) or a Thenable that resolves
\r
5162 var DeclarationRequest;
\r
5163 (function (DeclarationRequest) {
\r
5164 DeclarationRequest.method = 'textDocument/declaration';
\r
5165 DeclarationRequest.type = new messages_1.ProtocolRequestType(DeclarationRequest.method);
\r
5166 /** @deprecated Use DeclarationRequest.type */
\r
5167 DeclarationRequest.resultType = new vscode_jsonrpc_1.ProgressType();
\r
5168 })(DeclarationRequest = exports.DeclarationRequest || (exports.DeclarationRequest = {}));
\r
5173 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
5176 /*---------------------------------------------------------------------------------------------
\r
5177 * Copyright (c) Microsoft Corporation. All rights reserved.
\r
5178 * Licensed under the MIT License. See License.txt in the project root for license information.
\r
5179 *--------------------------------------------------------------------------------------------*/
\r
5180 Object.defineProperty(exports, "__esModule", ({ value: true }));
\r
5181 const vscode_jsonrpc_1 = __webpack_require__(5);
\r
5182 const messages_1 = __webpack_require__(21);
\r
5184 * A request to provide selection ranges in a document. The request's
\r
5185 * parameter is of type [SelectionRangeParams](#SelectionRangeParams), the
\r
5186 * response is of type [SelectionRange[]](#SelectionRange[]) or a Thenable
\r
5187 * that resolves to such.
\r
5189 var SelectionRangeRequest;
\r
5190 (function (SelectionRangeRequest) {
\r
5191 SelectionRangeRequest.method = 'textDocument/selectionRange';
\r
5192 SelectionRangeRequest.type = new messages_1.ProtocolRequestType(SelectionRangeRequest.method);
\r
5193 /** @deprecated Use SelectionRangeRequest.type */
\r
5194 SelectionRangeRequest.resultType = new vscode_jsonrpc_1.ProgressType();
\r
5195 })(SelectionRangeRequest = exports.SelectionRangeRequest || (exports.SelectionRangeRequest = {}));
\r
5200 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
5202 /* --------------------------------------------------------------------------------------------
\r
5203 * Copyright (c) Microsoft Corporation. All rights reserved.
\r
5204 * Licensed under the MIT License. See License.txt in the project root for license information.
\r
5205 * ------------------------------------------------------------------------------------------ */
\r
5207 Object.defineProperty(exports, "__esModule", ({ value: true }));
\r
5208 const vscode_jsonrpc_1 = __webpack_require__(5);
\r
5209 const messages_1 = __webpack_require__(21);
\r
5210 var WorkDoneProgress;
\r
5211 (function (WorkDoneProgress) {
\r
5212 WorkDoneProgress.type = new vscode_jsonrpc_1.ProgressType();
\r
5213 })(WorkDoneProgress = exports.WorkDoneProgress || (exports.WorkDoneProgress = {}));
\r
5215 * The `window/workDoneProgress/create` request is sent from the server to the client to initiate progress
\r
5216 * reporting from the server.
\r
5218 var WorkDoneProgressCreateRequest;
\r
5219 (function (WorkDoneProgressCreateRequest) {
\r
5220 WorkDoneProgressCreateRequest.type = new messages_1.ProtocolRequestType('window/workDoneProgress/create');
\r
5221 })(WorkDoneProgressCreateRequest = exports.WorkDoneProgressCreateRequest || (exports.WorkDoneProgressCreateRequest = {}));
\r
5223 * The `window/workDoneProgress/cancel` notification is sent from the client to the server to cancel a progress
\r
5224 * initiated on the server side.
\r
5226 var WorkDoneProgressCancelNotification;
\r
5227 (function (WorkDoneProgressCancelNotification) {
\r
5228 WorkDoneProgressCancelNotification.type = new messages_1.ProtocolNotificationType('window/workDoneProgress/cancel');
\r
5229 })(WorkDoneProgressCancelNotification = exports.WorkDoneProgressCancelNotification || (exports.WorkDoneProgressCancelNotification = {}));
\r
5234 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
5236 /* --------------------------------------------------------------------------------------------
\r
5237 * Copyright (c) TypeFox and others. All rights reserved.
\r
5238 * Licensed under the MIT License. See License.txt in the project root for license information.
\r
5239 * ------------------------------------------------------------------------------------------ */
\r
5241 Object.defineProperty(exports, "__esModule", ({ value: true }));
\r
5242 const messages_1 = __webpack_require__(21);
\r
5244 * A request to result a `CallHierarchyItem` in a document at a given position.
\r
5245 * Can be used as an input to a incoming or outgoing call hierarchy.
\r
5247 * @since 3.16.0 - Proposed state
\r
5249 var CallHierarchyPrepareRequest;
\r
5250 (function (CallHierarchyPrepareRequest) {
\r
5251 CallHierarchyPrepareRequest.method = 'textDocument/prepareCallHierarchy';
\r
5252 CallHierarchyPrepareRequest.type = new messages_1.ProtocolRequestType(CallHierarchyPrepareRequest.method);
\r
5253 })(CallHierarchyPrepareRequest = exports.CallHierarchyPrepareRequest || (exports.CallHierarchyPrepareRequest = {}));
\r
5255 * A request to resolve the incoming calls for a given `CallHierarchyItem`.
\r
5257 * @since 3.16.0 - Proposed state
\r
5259 var CallHierarchyIncomingCallsRequest;
\r
5260 (function (CallHierarchyIncomingCallsRequest) {
\r
5261 CallHierarchyIncomingCallsRequest.method = 'callHierarchy/incomingCalls';
\r
5262 CallHierarchyIncomingCallsRequest.type = new messages_1.ProtocolRequestType(CallHierarchyIncomingCallsRequest.method);
\r
5263 })(CallHierarchyIncomingCallsRequest = exports.CallHierarchyIncomingCallsRequest || (exports.CallHierarchyIncomingCallsRequest = {}));
\r
5265 * A request to resolve the outgoing calls for a given `CallHierarchyItem`.
\r
5267 * @since 3.16.0 - Proposed state
\r
5269 var CallHierarchyOutgoingCallsRequest;
\r
5270 (function (CallHierarchyOutgoingCallsRequest) {
\r
5271 CallHierarchyOutgoingCallsRequest.method = 'callHierarchy/outgoingCalls';
\r
5272 CallHierarchyOutgoingCallsRequest.type = new messages_1.ProtocolRequestType(CallHierarchyOutgoingCallsRequest.method);
\r
5273 })(CallHierarchyOutgoingCallsRequest = exports.CallHierarchyOutgoingCallsRequest || (exports.CallHierarchyOutgoingCallsRequest = {}));
\r
5278 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
5280 /* --------------------------------------------------------------------------------------------
\r
5281 * Copyright (c) Microsoft Corporation. All rights reserved.
\r
5282 * Licensed under the MIT License. See License.txt in the project root for license information.
\r
5283 * ------------------------------------------------------------------------------------------ */
\r
5285 Object.defineProperty(exports, "__esModule", ({ value: true }));
\r
5286 const messages_1 = __webpack_require__(21);
\r
5288 * A set of predefined token types. This set is not fixed
\r
5289 * an clients can specify additional token types via the
\r
5290 * corresponding client capabilities.
\r
5292 * @since 3.16.0 - Proposed state
\r
5294 var SemanticTokenTypes;
\r
5295 (function (SemanticTokenTypes) {
\r
5296 SemanticTokenTypes["comment"] = "comment";
\r
5297 SemanticTokenTypes["keyword"] = "keyword";
\r
5298 SemanticTokenTypes["string"] = "string";
\r
5299 SemanticTokenTypes["number"] = "number";
\r
5300 SemanticTokenTypes["regexp"] = "regexp";
\r
5301 SemanticTokenTypes["operator"] = "operator";
\r
5302 SemanticTokenTypes["namespace"] = "namespace";
\r
5303 SemanticTokenTypes["type"] = "type";
\r
5304 SemanticTokenTypes["struct"] = "struct";
\r
5305 SemanticTokenTypes["class"] = "class";
\r
5306 SemanticTokenTypes["interface"] = "interface";
\r
5307 SemanticTokenTypes["enum"] = "enum";
\r
5308 SemanticTokenTypes["typeParameter"] = "typeParameter";
\r
5309 SemanticTokenTypes["function"] = "function";
\r
5310 SemanticTokenTypes["member"] = "member";
\r
5311 SemanticTokenTypes["property"] = "property";
\r
5312 SemanticTokenTypes["macro"] = "macro";
\r
5313 SemanticTokenTypes["variable"] = "variable";
\r
5314 SemanticTokenTypes["parameter"] = "parameter";
\r
5315 SemanticTokenTypes["label"] = "label";
\r
5316 })(SemanticTokenTypes = exports.SemanticTokenTypes || (exports.SemanticTokenTypes = {}));
\r
5318 * A set of predefined token modifiers. This set is not fixed
\r
5319 * an clients can specify additional token types via the
\r
5320 * corresponding client capabilities.
\r
5322 * @since 3.16.0 - Proposed state
\r
5324 var SemanticTokenModifiers;
\r
5325 (function (SemanticTokenModifiers) {
\r
5326 SemanticTokenModifiers["documentation"] = "documentation";
\r
5327 SemanticTokenModifiers["declaration"] = "declaration";
\r
5328 SemanticTokenModifiers["definition"] = "definition";
\r
5329 SemanticTokenModifiers["reference"] = "reference";
\r
5330 SemanticTokenModifiers["static"] = "static";
\r
5331 SemanticTokenModifiers["abstract"] = "abstract";
\r
5332 SemanticTokenModifiers["deprecated"] = "deprecated";
\r
5333 SemanticTokenModifiers["async"] = "async";
\r
5334 SemanticTokenModifiers["volatile"] = "volatile";
\r
5335 SemanticTokenModifiers["readonly"] = "readonly";
\r
5336 })(SemanticTokenModifiers = exports.SemanticTokenModifiers || (exports.SemanticTokenModifiers = {}));
\r
5338 * @since 3.16.0 - Proposed state
\r
5340 var SemanticTokens;
\r
5341 (function (SemanticTokens) {
\r
5342 function is(value) {
\r
5343 const candidate = value;
\r
5344 return candidate !== undefined && (candidate.resultId === undefined || typeof candidate.resultId === 'string') &&
\r
5345 Array.isArray(candidate.data) && (candidate.data.length === 0 || typeof candidate.data[0] === 'number');
\r
5347 SemanticTokens.is = is;
\r
5348 })(SemanticTokens = exports.SemanticTokens || (exports.SemanticTokens = {}));
\r
5350 * @since 3.16.0 - Proposed state
\r
5352 var SemanticTokensRequest;
\r
5353 (function (SemanticTokensRequest) {
\r
5354 SemanticTokensRequest.method = 'textDocument/semanticTokens';
\r
5355 SemanticTokensRequest.type = new messages_1.ProtocolRequestType(SemanticTokensRequest.method);
\r
5356 })(SemanticTokensRequest = exports.SemanticTokensRequest || (exports.SemanticTokensRequest = {}));
\r
5358 * @since 3.16.0 - Proposed state
\r
5360 var SemanticTokensEditsRequest;
\r
5361 (function (SemanticTokensEditsRequest) {
\r
5362 SemanticTokensEditsRequest.method = 'textDocument/semanticTokens/edits';
\r
5363 SemanticTokensEditsRequest.type = new messages_1.ProtocolRequestType(SemanticTokensEditsRequest.method);
\r
5364 })(SemanticTokensEditsRequest = exports.SemanticTokensEditsRequest || (exports.SemanticTokensEditsRequest = {}));
\r
5366 * @since 3.16.0 - Proposed state
\r
5368 var SemanticTokensRangeRequest;
\r
5369 (function (SemanticTokensRangeRequest) {
\r
5370 SemanticTokensRangeRequest.method = 'textDocument/semanticTokens/range';
\r
5371 SemanticTokensRangeRequest.type = new messages_1.ProtocolRequestType(SemanticTokensRangeRequest.method);
\r
5372 })(SemanticTokensRangeRequest = exports.SemanticTokensRangeRequest || (exports.SemanticTokensRangeRequest = {}));
\r
5377 /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
5380 /*---------------------------------------------------------------------------------------------
5381 * Copyright (c) Microsoft Corporation. All rights reserved.
5382 * Licensed under the MIT License. See License.txt in the project root for license information.
5383 *--------------------------------------------------------------------------------------------*/
5384 var __importDefault = (this && this.__importDefault) || function (mod) {
5385 return (mod && mod.__esModule) ? mod : { "default": mod };
5387 Object.defineProperty(exports, "__esModule", ({ value: true }));
5388 exports.joinPath = exports.normalizePath = exports.resolvePath = exports.FileType = void 0;
5389 const path_1 = __importDefault(__webpack_require__(3));
5391 (function (FileType) {
5393 * The file type is unknown.
5395 FileType[FileType["Unknown"] = 0] = "Unknown";
5399 FileType[FileType["File"] = 1] = "File";
5403 FileType[FileType["Directory"] = 2] = "Directory";
5405 * A symbolic link to a file.
5407 FileType[FileType["SymbolicLink"] = 64] = "SymbolicLink";
5408 })(FileType = exports.FileType || (exports.FileType = {}));
5409 const Dot = '.'.charCodeAt(0);
5410 function resolvePath(uri, p) {
5411 if (path_1.default.isAbsolute(p)) {
5412 return uri.with({ path: normalizePath(p.split('/')) });
5414 return joinPath(uri, p);
5416 exports.resolvePath = resolvePath;
5417 function normalizePath(parts) {
5418 const newParts = [];
5419 for (const part of parts) {
5420 if (part.length === 0 || part.length === 1 && part.charCodeAt(0) === Dot) {
5423 else if (part.length === 2 && part.charCodeAt(0) === Dot && part.charCodeAt(1) === Dot) {
5427 newParts.push(part);
5430 if (parts.length > 1 && parts[parts.length - 1].length === 0) {
5433 let res = newParts.join('/');
5434 if (parts[0].length === 0) {
5439 exports.normalizePath = normalizePath;
5440 function joinPath(uri, ...paths) {
5441 const parts = uri.path.split('/');
5442 for (let path of paths) {
5443 parts.push(...path.split('/'));
5445 return uri.with({ path: normalizePath(parts) });
5447 exports.joinPath = joinPath;
5452 /************************************************************************/
5453 /******/ // The module cache
5454 /******/ var __webpack_module_cache__ = {};
5456 /******/ // The require function
5457 /******/ function __webpack_require__(moduleId) {
5458 /******/ // Check if module is in cache
5459 /******/ if(__webpack_module_cache__[moduleId]) {
5460 /******/ return __webpack_module_cache__[moduleId].exports;
5462 /******/ // Create a new module (and put it into the cache)
5463 /******/ var module = __webpack_module_cache__[moduleId] = {
5464 /******/ // no module.id needed
5465 /******/ // no module.loaded needed
5466 /******/ exports: {}
5469 /******/ // Execute the module function
5470 /******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
5472 /******/ // Return the exports of the module
5473 /******/ return module.exports;
5476 /************************************************************************/
5477 /******/ /* webpack/runtime/define property getters */
5479 /******/ // define getter functions for harmony exports
5480 /******/ __webpack_require__.d = (exports, definition) => {
5481 /******/ for(var key in definition) {
5482 /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
5483 /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
5489 /******/ /* webpack/runtime/hasOwnProperty shorthand */
5491 /******/ __webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop)
5494 /******/ /* webpack/runtime/make namespace object */
5496 /******/ // define __esModule on exports
5497 /******/ __webpack_require__.r = (exports) => {
5498 /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
5499 /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
5501 /******/ Object.defineProperty(exports, '__esModule', { value: true });
5505 /************************************************************************/
5506 /******/ // module exports must be returned from runtime so entry inlining is disabled
5508 /******/ // Load entry module and return exports
5509 /******/ return __webpack_require__(0);