1 (function(e, a) { for(var i in a) e[i] = a[i]; }(exports, /******/ (function(modules) { // webpackBootstrap
2 /******/ // The module cache
3 /******/ var installedModules = {};
5 /******/ // The require function
6 /******/ function __webpack_require__(moduleId) {
8 /******/ // Check if module is in cache
9 /******/ if(installedModules[moduleId]) {
10 /******/ return installedModules[moduleId].exports;
12 /******/ // Create a new module (and put it into the cache)
13 /******/ var module = installedModules[moduleId] = {
19 /******/ // Execute the module function
20 /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
22 /******/ // Flag the module as loaded
23 /******/ module.l = true;
25 /******/ // Return the exports of the module
26 /******/ return module.exports;
30 /******/ // expose the modules object (__webpack_modules__)
31 /******/ __webpack_require__.m = modules;
33 /******/ // expose the module cache
34 /******/ __webpack_require__.c = installedModules;
36 /******/ // define getter function for harmony exports
37 /******/ __webpack_require__.d = function(exports, name, getter) {
38 /******/ if(!__webpack_require__.o(exports, name)) {
39 /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
43 /******/ // define __esModule on exports
44 /******/ __webpack_require__.r = function(exports) {
45 /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
46 /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
48 /******/ Object.defineProperty(exports, '__esModule', { value: true });
51 /******/ // create a fake namespace object
52 /******/ // mode & 1: value is a module id, require it
53 /******/ // mode & 2: merge all properties of value into the ns
54 /******/ // mode & 4: return value when already ns object
55 /******/ // mode & 8|1: behave like require
56 /******/ __webpack_require__.t = function(value, mode) {
57 /******/ if(mode & 1) value = __webpack_require__(value);
58 /******/ if(mode & 8) return value;
59 /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
60 /******/ var ns = Object.create(null);
61 /******/ __webpack_require__.r(ns);
62 /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
63 /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
67 /******/ // getDefaultExport function for compatibility with non-harmony modules
68 /******/ __webpack_require__.n = function(module) {
69 /******/ var getter = module && module.__esModule ?
70 /******/ function getDefault() { return module['default']; } :
71 /******/ function getModuleExports() { return module; };
72 /******/ __webpack_require__.d(getter, 'a', getter);
73 /******/ return getter;
76 /******/ // Object.prototype.hasOwnProperty.call
77 /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
79 /******/ // __webpack_public_path__
80 /******/ __webpack_require__.p = "";
83 /******/ // Load entry module and return exports
84 /******/ return __webpack_require__(__webpack_require__.s = 0);
86 /************************************************************************/
89 /***/ (function(module, exports, __webpack_require__) {
93 var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
94 function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
95 return new (P || (P = Promise))(function (resolve, reject) {
96 function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
97 function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
98 function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
99 step((generator = generator.apply(thisArg, _arguments || [])).next());
102 Object.defineProperty(exports, "__esModule", { value: true });
103 exports.activate = void 0;
104 const coc_nvim_1 = __webpack_require__(1);
105 const customData_1 = __webpack_require__(2);
106 const vscode_languageserver_protocol_1 = __webpack_require__(4);
107 var CustomDataChangedNotification;
108 (function (CustomDataChangedNotification) {
109 CustomDataChangedNotification.type = new vscode_languageserver_protocol_1.NotificationType('css/customDataChanged');
110 })(CustomDataChangedNotification || (CustomDataChangedNotification = {}));
111 function activate(context) {
112 return __awaiter(this, void 0, void 0, function* () {
113 let { subscriptions } = context;
114 const config = coc_nvim_1.workspace.getConfiguration().get('css', {});
117 const file = context.asAbsolutePath('./lib/server.js');
118 const selector = ['css', 'less', 'scss', 'wxss'];
119 const customDataSource = customData_1.getCustomDataSource(context.subscriptions);
120 let serverOptions = {
122 transport: coc_nvim_1.TransportKind.ipc,
124 cwd: coc_nvim_1.workspace.root,
125 execArgv: config.execArgv || []
128 let clientOptions = {
129 documentSelector: selector,
131 configurationSection: ['css', 'less', 'scss', 'wxss']
133 outputChannelName: 'css',
134 initializationOptions: {
135 handledSchemas: ['file']
139 let client = new coc_nvim_1.LanguageClient('css', 'Css language server', serverOptions, clientOptions);
140 // tslint:disable-next-line: no-floating-promises
141 client.onReady().then(() => {
142 client.sendNotification(CustomDataChangedNotification.type, customDataSource.uris);
143 customDataSource.onDidChange(() => {
144 client.sendNotification(CustomDataChangedNotification.type, customDataSource.uris);
147 subscriptions.push(coc_nvim_1.services.registLanguageClient(client));
150 exports.activate = activate;
155 /***/ (function(module, exports) {
157 module.exports = require("coc.nvim");
161 /***/ (function(module, exports, __webpack_require__) {
165 /*---------------------------------------------------------------------------------------------
166 * Copyright (c) Microsoft Corporation. All rights reserved.
167 * Licensed under the MIT License. See License.txt in the project root for license information.
168 *--------------------------------------------------------------------------------------------*/
169 var __importDefault = (this && this.__importDefault) || function (mod) {
170 return (mod && mod.__esModule) ? mod : { "default": mod };
172 Object.defineProperty(exports, "__esModule", { value: true });
173 exports.getCustomDataSource = void 0;
174 const coc_nvim_1 = __webpack_require__(1);
175 const path_1 = __importDefault(__webpack_require__(3));
176 const vscode_languageserver_protocol_1 = __webpack_require__(4);
177 const requests_1 = __webpack_require__(33);
178 function getCustomDataSource(toDispose) {
179 let pathsInWorkspace = getCustomDataPathsInAllWorkspaces();
180 let pathsInExtensions = getCustomDataPathsFromAllExtensions();
181 const onChange = new vscode_languageserver_protocol_1.Emitter();
182 toDispose.push(coc_nvim_1.extensions.onDidActiveExtension(_ => {
183 const newPathsInExtensions = getCustomDataPathsFromAllExtensions();
184 if (newPathsInExtensions.length !== pathsInExtensions.length || !newPathsInExtensions.every((val, idx) => val === pathsInExtensions[idx])) {
185 pathsInExtensions = newPathsInExtensions;
189 toDispose.push(coc_nvim_1.workspace.onDidChangeConfiguration(e => {
190 if (e.affectsConfiguration('css.customData')) {
191 pathsInWorkspace = getCustomDataPathsInAllWorkspaces();
197 return pathsInWorkspace.concat(pathsInExtensions);
200 return onChange.event;
204 exports.getCustomDataSource = getCustomDataSource;
205 function getCustomDataPathsInAllWorkspaces() {
206 const workspaceFolders = coc_nvim_1.workspace.workspaceFolders;
207 const dataPaths = [];
208 if (!workspaceFolders) {
211 const collect = (paths, rootFolder) => {
212 if (Array.isArray(paths)) {
213 for (const path of paths) {
214 if (typeof path === 'string') {
215 dataPaths.push(requests_1.resolvePath(rootFolder, path).toString());
220 for (let i = 0; i < workspaceFolders.length; i++) {
221 const folderUri = workspaceFolders[i].uri;
222 const allCssConfig = coc_nvim_1.workspace.getConfiguration('css', folderUri);
223 const customDataInspect = allCssConfig.inspect('customData');
224 if (customDataInspect) {
225 collect(customDataInspect.workspaceValue, coc_nvim_1.Uri.parse(folderUri));
227 collect(customDataInspect.globalValue, coc_nvim_1.Uri.parse(folderUri));
233 function getCustomDataPathsFromAllExtensions() {
235 const dataPaths = [];
236 for (const extension of coc_nvim_1.extensions.all) {
237 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;
238 if (Array.isArray(customData)) {
239 for (const rp of customData) {
240 dataPaths.push(path_1.default.join(extension.extensionPath, rp).toString());
250 /***/ (function(module, exports) {
252 module.exports = require("path");
256 /***/ (function(module, exports, __webpack_require__) {
259 /* --------------------------------------------------------------------------------------------
\r
260 * Copyright (c) Microsoft Corporation. All rights reserved.
\r
261 * Licensed under the MIT License. See License.txt in the project root for license information.
\r
262 * ------------------------------------------------------------------------------------------ */
\r
264 function __export(m) {
\r
265 for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
\r
267 Object.defineProperty(exports, "__esModule", { value: true });
\r
268 const vscode_jsonrpc_1 = __webpack_require__(5);
\r
269 exports.ErrorCodes = vscode_jsonrpc_1.ErrorCodes;
\r
270 exports.ResponseError = vscode_jsonrpc_1.ResponseError;
\r
271 exports.CancellationToken = vscode_jsonrpc_1.CancellationToken;
\r
272 exports.CancellationTokenSource = vscode_jsonrpc_1.CancellationTokenSource;
\r
273 exports.Disposable = vscode_jsonrpc_1.Disposable;
\r
274 exports.Event = vscode_jsonrpc_1.Event;
\r
275 exports.Emitter = vscode_jsonrpc_1.Emitter;
\r
276 exports.Trace = vscode_jsonrpc_1.Trace;
\r
277 exports.TraceFormat = vscode_jsonrpc_1.TraceFormat;
\r
278 exports.SetTraceNotification = vscode_jsonrpc_1.SetTraceNotification;
\r
279 exports.LogTraceNotification = vscode_jsonrpc_1.LogTraceNotification;
\r
280 exports.RequestType = vscode_jsonrpc_1.RequestType;
\r
281 exports.RequestType0 = vscode_jsonrpc_1.RequestType0;
\r
282 exports.NotificationType = vscode_jsonrpc_1.NotificationType;
\r
283 exports.NotificationType0 = vscode_jsonrpc_1.NotificationType0;
\r
284 exports.MessageReader = vscode_jsonrpc_1.MessageReader;
\r
285 exports.MessageWriter = vscode_jsonrpc_1.MessageWriter;
\r
286 exports.ConnectionStrategy = vscode_jsonrpc_1.ConnectionStrategy;
\r
287 exports.StreamMessageReader = vscode_jsonrpc_1.StreamMessageReader;
\r
288 exports.StreamMessageWriter = vscode_jsonrpc_1.StreamMessageWriter;
\r
289 exports.IPCMessageReader = vscode_jsonrpc_1.IPCMessageReader;
\r
290 exports.IPCMessageWriter = vscode_jsonrpc_1.IPCMessageWriter;
\r
291 exports.createClientPipeTransport = vscode_jsonrpc_1.createClientPipeTransport;
\r
292 exports.createServerPipeTransport = vscode_jsonrpc_1.createServerPipeTransport;
\r
293 exports.generateRandomPipeName = vscode_jsonrpc_1.generateRandomPipeName;
\r
294 exports.createClientSocketTransport = vscode_jsonrpc_1.createClientSocketTransport;
\r
295 exports.createServerSocketTransport = vscode_jsonrpc_1.createServerSocketTransport;
\r
296 exports.ProgressType = vscode_jsonrpc_1.ProgressType;
\r
297 __export(__webpack_require__(18));
\r
298 __export(__webpack_require__(19));
\r
299 const callHierarchy = __webpack_require__(31);
\r
300 const st = __webpack_require__(32);
\r
302 (function (Proposed) {
\r
303 let CallHierarchyPrepareRequest;
\r
304 (function (CallHierarchyPrepareRequest) {
\r
305 CallHierarchyPrepareRequest.method = callHierarchy.CallHierarchyPrepareRequest.method;
\r
306 CallHierarchyPrepareRequest.type = callHierarchy.CallHierarchyPrepareRequest.type;
\r
307 })(CallHierarchyPrepareRequest = Proposed.CallHierarchyPrepareRequest || (Proposed.CallHierarchyPrepareRequest = {}));
\r
308 let CallHierarchyIncomingCallsRequest;
\r
309 (function (CallHierarchyIncomingCallsRequest) {
\r
310 CallHierarchyIncomingCallsRequest.method = callHierarchy.CallHierarchyIncomingCallsRequest.method;
\r
311 CallHierarchyIncomingCallsRequest.type = callHierarchy.CallHierarchyIncomingCallsRequest.type;
\r
312 })(CallHierarchyIncomingCallsRequest = Proposed.CallHierarchyIncomingCallsRequest || (Proposed.CallHierarchyIncomingCallsRequest = {}));
\r
313 let CallHierarchyOutgoingCallsRequest;
\r
314 (function (CallHierarchyOutgoingCallsRequest) {
\r
315 CallHierarchyOutgoingCallsRequest.method = callHierarchy.CallHierarchyOutgoingCallsRequest.method;
\r
316 CallHierarchyOutgoingCallsRequest.type = callHierarchy.CallHierarchyOutgoingCallsRequest.type;
\r
317 })(CallHierarchyOutgoingCallsRequest = Proposed.CallHierarchyOutgoingCallsRequest || (Proposed.CallHierarchyOutgoingCallsRequest = {}));
\r
318 Proposed.SemanticTokenTypes = st.SemanticTokenTypes;
\r
319 Proposed.SemanticTokenModifiers = st.SemanticTokenModifiers;
\r
320 Proposed.SemanticTokens = st.SemanticTokens;
\r
321 let SemanticTokensRequest;
\r
322 (function (SemanticTokensRequest) {
\r
323 SemanticTokensRequest.method = st.SemanticTokensRequest.method;
\r
324 SemanticTokensRequest.type = st.SemanticTokensRequest.type;
\r
325 })(SemanticTokensRequest = Proposed.SemanticTokensRequest || (Proposed.SemanticTokensRequest = {}));
\r
326 let SemanticTokensEditsRequest;
\r
327 (function (SemanticTokensEditsRequest) {
\r
328 SemanticTokensEditsRequest.method = st.SemanticTokensEditsRequest.method;
\r
329 SemanticTokensEditsRequest.type = st.SemanticTokensEditsRequest.type;
\r
330 })(SemanticTokensEditsRequest = Proposed.SemanticTokensEditsRequest || (Proposed.SemanticTokensEditsRequest = {}));
\r
331 let SemanticTokensRangeRequest;
\r
332 (function (SemanticTokensRangeRequest) {
\r
333 SemanticTokensRangeRequest.method = st.SemanticTokensRangeRequest.method;
\r
334 SemanticTokensRangeRequest.type = st.SemanticTokensRangeRequest.type;
\r
335 })(SemanticTokensRangeRequest = Proposed.SemanticTokensRangeRequest || (Proposed.SemanticTokensRangeRequest = {}));
\r
336 })(Proposed = exports.Proposed || (exports.Proposed = {}));
\r
337 function createProtocolConnection(reader, writer, logger, strategy) {
\r
338 return vscode_jsonrpc_1.createMessageConnection(reader, writer, logger, strategy);
\r
340 exports.createProtocolConnection = createProtocolConnection;
\r
345 /***/ (function(module, exports, __webpack_require__) {
348 /* --------------------------------------------------------------------------------------------
\r
349 * Copyright (c) Microsoft Corporation. All rights reserved.
\r
350 * Licensed under the MIT License. See License.txt in the project root for license information.
\r
351 * ------------------------------------------------------------------------------------------ */
\r
352 /// <reference path="../typings/thenable.d.ts" />
\r
354 function __export(m) {
\r
355 for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
\r
357 Object.defineProperty(exports, "__esModule", { value: true });
\r
358 const Is = __webpack_require__(6);
\r
359 const messages_1 = __webpack_require__(7);
\r
360 exports.RequestType = messages_1.RequestType;
\r
361 exports.RequestType0 = messages_1.RequestType0;
\r
362 exports.RequestType1 = messages_1.RequestType1;
\r
363 exports.RequestType2 = messages_1.RequestType2;
\r
364 exports.RequestType3 = messages_1.RequestType3;
\r
365 exports.RequestType4 = messages_1.RequestType4;
\r
366 exports.RequestType5 = messages_1.RequestType5;
\r
367 exports.RequestType6 = messages_1.RequestType6;
\r
368 exports.RequestType7 = messages_1.RequestType7;
\r
369 exports.RequestType8 = messages_1.RequestType8;
\r
370 exports.RequestType9 = messages_1.RequestType9;
\r
371 exports.ResponseError = messages_1.ResponseError;
\r
372 exports.ErrorCodes = messages_1.ErrorCodes;
\r
373 exports.NotificationType = messages_1.NotificationType;
\r
374 exports.NotificationType0 = messages_1.NotificationType0;
\r
375 exports.NotificationType1 = messages_1.NotificationType1;
\r
376 exports.NotificationType2 = messages_1.NotificationType2;
\r
377 exports.NotificationType3 = messages_1.NotificationType3;
\r
378 exports.NotificationType4 = messages_1.NotificationType4;
\r
379 exports.NotificationType5 = messages_1.NotificationType5;
\r
380 exports.NotificationType6 = messages_1.NotificationType6;
\r
381 exports.NotificationType7 = messages_1.NotificationType7;
\r
382 exports.NotificationType8 = messages_1.NotificationType8;
\r
383 exports.NotificationType9 = messages_1.NotificationType9;
\r
384 const messageReader_1 = __webpack_require__(8);
\r
385 exports.MessageReader = messageReader_1.MessageReader;
\r
386 exports.StreamMessageReader = messageReader_1.StreamMessageReader;
\r
387 exports.IPCMessageReader = messageReader_1.IPCMessageReader;
\r
388 exports.SocketMessageReader = messageReader_1.SocketMessageReader;
\r
389 const messageWriter_1 = __webpack_require__(10);
\r
390 exports.MessageWriter = messageWriter_1.MessageWriter;
\r
391 exports.StreamMessageWriter = messageWriter_1.StreamMessageWriter;
\r
392 exports.IPCMessageWriter = messageWriter_1.IPCMessageWriter;
\r
393 exports.SocketMessageWriter = messageWriter_1.SocketMessageWriter;
\r
394 const events_1 = __webpack_require__(9);
\r
395 exports.Disposable = events_1.Disposable;
\r
396 exports.Event = events_1.Event;
\r
397 exports.Emitter = events_1.Emitter;
\r
398 const cancellation_1 = __webpack_require__(11);
\r
399 exports.CancellationTokenSource = cancellation_1.CancellationTokenSource;
\r
400 exports.CancellationToken = cancellation_1.CancellationToken;
\r
401 const linkedMap_1 = __webpack_require__(12);
\r
402 __export(__webpack_require__(13));
\r
403 __export(__webpack_require__(17));
\r
404 var CancelNotification;
\r
405 (function (CancelNotification) {
\r
406 CancelNotification.type = new messages_1.NotificationType('$/cancelRequest');
\r
407 })(CancelNotification || (CancelNotification = {}));
\r
408 var ProgressNotification;
\r
409 (function (ProgressNotification) {
\r
410 ProgressNotification.type = new messages_1.NotificationType('$/progress');
\r
411 })(ProgressNotification || (ProgressNotification = {}));
\r
412 class ProgressType {
\r
416 exports.ProgressType = ProgressType;
\r
417 exports.NullLogger = Object.freeze({
\r
424 (function (Trace) {
\r
425 Trace[Trace["Off"] = 0] = "Off";
\r
426 Trace[Trace["Messages"] = 1] = "Messages";
\r
427 Trace[Trace["Verbose"] = 2] = "Verbose";
\r
428 })(Trace = exports.Trace || (exports.Trace = {}));
\r
429 (function (Trace) {
\r
430 function fromString(value) {
\r
431 if (!Is.string(value)) {
\r
434 value = value.toLowerCase();
\r
439 return Trace.Messages;
\r
441 return Trace.Verbose;
\r
446 Trace.fromString = fromString;
\r
447 function toString(value) {
\r
451 case Trace.Messages:
\r
453 case Trace.Verbose:
\r
459 Trace.toString = toString;
\r
460 })(Trace = exports.Trace || (exports.Trace = {}));
\r
462 (function (TraceFormat) {
\r
463 TraceFormat["Text"] = "text";
\r
464 TraceFormat["JSON"] = "json";
\r
465 })(TraceFormat = exports.TraceFormat || (exports.TraceFormat = {}));
\r
466 (function (TraceFormat) {
\r
467 function fromString(value) {
\r
468 value = value.toLowerCase();
\r
469 if (value === 'json') {
\r
470 return TraceFormat.JSON;
\r
473 return TraceFormat.Text;
\r
476 TraceFormat.fromString = fromString;
\r
477 })(TraceFormat = exports.TraceFormat || (exports.TraceFormat = {}));
\r
478 var SetTraceNotification;
\r
479 (function (SetTraceNotification) {
\r
480 SetTraceNotification.type = new messages_1.NotificationType('$/setTraceNotification');
\r
481 })(SetTraceNotification = exports.SetTraceNotification || (exports.SetTraceNotification = {}));
\r
482 var LogTraceNotification;
\r
483 (function (LogTraceNotification) {
\r
484 LogTraceNotification.type = new messages_1.NotificationType('$/logTraceNotification');
\r
485 })(LogTraceNotification = exports.LogTraceNotification || (exports.LogTraceNotification = {}));
\r
486 var ConnectionErrors;
\r
487 (function (ConnectionErrors) {
\r
489 * The connection is closed.
\r
491 ConnectionErrors[ConnectionErrors["Closed"] = 1] = "Closed";
\r
493 * The connection got disposed.
\r
495 ConnectionErrors[ConnectionErrors["Disposed"] = 2] = "Disposed";
\r
497 * The connection is already in listening mode.
\r
499 ConnectionErrors[ConnectionErrors["AlreadyListening"] = 3] = "AlreadyListening";
\r
500 })(ConnectionErrors = exports.ConnectionErrors || (exports.ConnectionErrors = {}));
\r
501 class ConnectionError extends Error {
\r
502 constructor(code, message) {
\r
505 Object.setPrototypeOf(this, ConnectionError.prototype);
\r
508 exports.ConnectionError = ConnectionError;
\r
509 var ConnectionStrategy;
\r
510 (function (ConnectionStrategy) {
\r
511 function is(value) {
\r
512 let candidate = value;
\r
513 return candidate && Is.func(candidate.cancelUndispatched);
\r
515 ConnectionStrategy.is = is;
\r
516 })(ConnectionStrategy = exports.ConnectionStrategy || (exports.ConnectionStrategy = {}));
\r
517 var ConnectionState;
\r
518 (function (ConnectionState) {
\r
519 ConnectionState[ConnectionState["New"] = 1] = "New";
\r
520 ConnectionState[ConnectionState["Listening"] = 2] = "Listening";
\r
521 ConnectionState[ConnectionState["Closed"] = 3] = "Closed";
\r
522 ConnectionState[ConnectionState["Disposed"] = 4] = "Disposed";
\r
523 })(ConnectionState || (ConnectionState = {}));
\r
524 function _createMessageConnection(messageReader, messageWriter, logger, strategy) {
\r
525 let sequenceNumber = 0;
\r
526 let notificationSquenceNumber = 0;
\r
527 let unknownResponseSquenceNumber = 0;
\r
528 const version = '2.0';
\r
529 let starRequestHandler = undefined;
\r
530 let requestHandlers = Object.create(null);
\r
531 let starNotificationHandler = undefined;
\r
532 let notificationHandlers = Object.create(null);
\r
533 let progressHandlers = new Map();
\r
535 let messageQueue = new linkedMap_1.LinkedMap();
\r
536 let responsePromises = Object.create(null);
\r
537 let requestTokens = Object.create(null);
\r
538 let trace = Trace.Off;
\r
539 let traceFormat = TraceFormat.Text;
\r
541 let state = ConnectionState.New;
\r
542 let errorEmitter = new events_1.Emitter();
\r
543 let closeEmitter = new events_1.Emitter();
\r
544 let unhandledNotificationEmitter = new events_1.Emitter();
\r
545 let unhandledProgressEmitter = new events_1.Emitter();
\r
546 let disposeEmitter = new events_1.Emitter();
\r
547 function createRequestQueueKey(id) {
\r
548 return 'req-' + id.toString();
\r
550 function createResponseQueueKey(id) {
\r
552 return 'res-unknown-' + (++unknownResponseSquenceNumber).toString();
\r
555 return 'res-' + id.toString();
\r
558 function createNotificationQueueKey() {
\r
559 return 'not-' + (++notificationSquenceNumber).toString();
\r
561 function addMessageToQueue(queue, message) {
\r
562 if (messages_1.isRequestMessage(message)) {
\r
563 queue.set(createRequestQueueKey(message.id), message);
\r
565 else if (messages_1.isResponseMessage(message)) {
\r
566 queue.set(createResponseQueueKey(message.id), message);
\r
569 queue.set(createNotificationQueueKey(), message);
\r
572 function cancelUndispatched(_message) {
\r
575 function isListening() {
\r
576 return state === ConnectionState.Listening;
\r
578 function isClosed() {
\r
579 return state === ConnectionState.Closed;
\r
581 function isDisposed() {
\r
582 return state === ConnectionState.Disposed;
\r
584 function closeHandler() {
\r
585 if (state === ConnectionState.New || state === ConnectionState.Listening) {
\r
586 state = ConnectionState.Closed;
\r
587 closeEmitter.fire(undefined);
\r
589 // If the connection is disposed don't sent close events.
\r
591 function readErrorHandler(error) {
\r
592 errorEmitter.fire([error, undefined, undefined]);
\r
594 function writeErrorHandler(data) {
\r
595 errorEmitter.fire(data);
\r
597 messageReader.onClose(closeHandler);
\r
598 messageReader.onError(readErrorHandler);
\r
599 messageWriter.onClose(closeHandler);
\r
600 messageWriter.onError(writeErrorHandler);
\r
601 function triggerMessageQueue() {
\r
602 if (timer || messageQueue.size === 0) {
\r
605 timer = setImmediate(() => {
\r
607 processMessageQueue();
\r
610 function processMessageQueue() {
\r
611 if (messageQueue.size === 0) {
\r
614 let message = messageQueue.shift();
\r
616 if (messages_1.isRequestMessage(message)) {
\r
617 handleRequest(message);
\r
619 else if (messages_1.isNotificationMessage(message)) {
\r
620 handleNotification(message);
\r
622 else if (messages_1.isResponseMessage(message)) {
\r
623 handleResponse(message);
\r
626 handleInvalidMessage(message);
\r
630 triggerMessageQueue();
\r
633 let callback = (message) => {
\r
635 // We have received a cancellation message. Check if the message is still in the queue
\r
636 // and cancel it if allowed to do so.
\r
637 if (messages_1.isNotificationMessage(message) && message.method === CancelNotification.type.method) {
\r
638 let key = createRequestQueueKey(message.params.id);
\r
639 let toCancel = messageQueue.get(key);
\r
640 if (messages_1.isRequestMessage(toCancel)) {
\r
641 let response = strategy && strategy.cancelUndispatched ? strategy.cancelUndispatched(toCancel, cancelUndispatched) : cancelUndispatched(toCancel);
\r
642 if (response && (response.error !== void 0 || response.result !== void 0)) {
\r
643 messageQueue.delete(key);
\r
644 response.id = toCancel.id;
\r
645 traceSendingResponse(response, message.method, Date.now());
\r
646 messageWriter.write(response);
\r
651 addMessageToQueue(messageQueue, message);
\r
654 triggerMessageQueue();
\r
657 function handleRequest(requestMessage) {
\r
658 if (isDisposed()) {
\r
659 // we return here silently since we fired an event when the
\r
660 // connection got disposed.
\r
663 function reply(resultOrError, method, startTime) {
\r
666 id: requestMessage.id
\r
668 if (resultOrError instanceof messages_1.ResponseError) {
\r
669 message.error = resultOrError.toJson();
\r
672 message.result = resultOrError === void 0 ? null : resultOrError;
\r
674 traceSendingResponse(message, method, startTime);
\r
675 messageWriter.write(message);
\r
677 function replyError(error, method, startTime) {
\r
680 id: requestMessage.id,
\r
681 error: error.toJson()
\r
683 traceSendingResponse(message, method, startTime);
\r
684 messageWriter.write(message);
\r
686 function replySuccess(result, method, startTime) {
\r
687 // The JSON RPC defines that a response must either have a result or an error
\r
688 // So we can't treat undefined as a valid response result.
\r
689 if (result === void 0) {
\r
694 id: requestMessage.id,
\r
697 traceSendingResponse(message, method, startTime);
\r
698 messageWriter.write(message);
\r
700 traceReceivedRequest(requestMessage);
\r
701 let element = requestHandlers[requestMessage.method];
\r
703 let requestHandler;
\r
705 type = element.type;
\r
706 requestHandler = element.handler;
\r
708 let startTime = Date.now();
\r
709 if (requestHandler || starRequestHandler) {
\r
710 let cancellationSource = new cancellation_1.CancellationTokenSource();
\r
711 let tokenKey = String(requestMessage.id);
\r
712 requestTokens[tokenKey] = cancellationSource;
\r
715 if (requestMessage.params === void 0 || (type !== void 0 && type.numberOfParams === 0)) {
\r
716 handlerResult = requestHandler
\r
717 ? requestHandler(cancellationSource.token)
\r
718 : starRequestHandler(requestMessage.method, cancellationSource.token);
\r
720 else if (Is.array(requestMessage.params) && (type === void 0 || type.numberOfParams > 1)) {
\r
721 handlerResult = requestHandler
\r
722 ? requestHandler(...requestMessage.params, cancellationSource.token)
\r
723 : starRequestHandler(requestMessage.method, ...requestMessage.params, cancellationSource.token);
\r
726 handlerResult = requestHandler
\r
727 ? requestHandler(requestMessage.params, cancellationSource.token)
\r
728 : starRequestHandler(requestMessage.method, requestMessage.params, cancellationSource.token);
\r
730 let promise = handlerResult;
\r
731 if (!handlerResult) {
\r
732 delete requestTokens[tokenKey];
\r
733 replySuccess(handlerResult, requestMessage.method, startTime);
\r
735 else if (promise.then) {
\r
736 promise.then((resultOrError) => {
\r
737 delete requestTokens[tokenKey];
\r
738 reply(resultOrError, requestMessage.method, startTime);
\r
740 delete requestTokens[tokenKey];
\r
741 if (error instanceof messages_1.ResponseError) {
\r
742 replyError(error, requestMessage.method, startTime);
\r
744 else if (error && Is.string(error.message)) {
\r
745 replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed with message: ${error.message}`), requestMessage.method, startTime);
\r
748 replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed unexpectedly without providing any details.`), requestMessage.method, startTime);
\r
753 delete requestTokens[tokenKey];
\r
754 reply(handlerResult, requestMessage.method, startTime);
\r
758 delete requestTokens[tokenKey];
\r
759 if (error instanceof messages_1.ResponseError) {
\r
760 reply(error, requestMessage.method, startTime);
\r
762 else if (error && Is.string(error.message)) {
\r
763 replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed with message: ${error.message}`), requestMessage.method, startTime);
\r
766 replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed unexpectedly without providing any details.`), requestMessage.method, startTime);
\r
771 replyError(new messages_1.ResponseError(messages_1.ErrorCodes.MethodNotFound, `Unhandled method ${requestMessage.method}`), requestMessage.method, startTime);
\r
774 function handleResponse(responseMessage) {
\r
775 if (isDisposed()) {
\r
776 // See handle request.
\r
779 if (responseMessage.id === null) {
\r
780 if (responseMessage.error) {
\r
781 logger.error(`Received response message without id: Error is: \n${JSON.stringify(responseMessage.error, undefined, 4)}`);
\r
784 logger.error(`Received response message without id. No further error information provided.`);
\r
788 let key = String(responseMessage.id);
\r
789 let responsePromise = responsePromises[key];
\r
790 traceReceivedResponse(responseMessage, responsePromise);
\r
791 if (responsePromise) {
\r
792 delete responsePromises[key];
\r
794 if (responseMessage.error) {
\r
795 let error = responseMessage.error;
\r
796 responsePromise.reject(new messages_1.ResponseError(error.code, error.message, error.data));
\r
798 else if (responseMessage.result !== void 0) {
\r
799 responsePromise.resolve(responseMessage.result);
\r
802 throw new Error('Should never happen.');
\r
806 if (error.message) {
\r
807 logger.error(`Response handler '${responsePromise.method}' failed with message: ${error.message}`);
\r
810 logger.error(`Response handler '${responsePromise.method}' failed unexpectedly.`);
\r
816 function handleNotification(message) {
\r
817 if (isDisposed()) {
\r
818 // See handle request.
\r
821 let type = undefined;
\r
822 let notificationHandler;
\r
823 if (message.method === CancelNotification.type.method) {
\r
824 notificationHandler = (params) => {
\r
825 let id = params.id;
\r
826 let source = requestTokens[String(id)];
\r
833 let element = notificationHandlers[message.method];
\r
835 notificationHandler = element.handler;
\r
836 type = element.type;
\r
839 if (notificationHandler || starNotificationHandler) {
\r
841 traceReceivedNotification(message);
\r
842 if (message.params === void 0 || (type !== void 0 && type.numberOfParams === 0)) {
\r
843 notificationHandler ? notificationHandler() : starNotificationHandler(message.method);
\r
845 else if (Is.array(message.params) && (type === void 0 || type.numberOfParams > 1)) {
\r
846 notificationHandler ? notificationHandler(...message.params) : starNotificationHandler(message.method, ...message.params);
\r
849 notificationHandler ? notificationHandler(message.params) : starNotificationHandler(message.method, message.params);
\r
853 if (error.message) {
\r
854 logger.error(`Notification handler '${message.method}' failed with message: ${error.message}`);
\r
857 logger.error(`Notification handler '${message.method}' failed unexpectedly.`);
\r
862 unhandledNotificationEmitter.fire(message);
\r
865 function handleInvalidMessage(message) {
\r
867 logger.error('Received empty message.');
\r
870 logger.error(`Received message which is neither a response nor a notification message:\n${JSON.stringify(message, null, 4)}`);
\r
871 // Test whether we find an id to reject the promise
\r
872 let responseMessage = message;
\r
873 if (Is.string(responseMessage.id) || Is.number(responseMessage.id)) {
\r
874 let key = String(responseMessage.id);
\r
875 let responseHandler = responsePromises[key];
\r
876 if (responseHandler) {
\r
877 responseHandler.reject(new Error('The received response has neither a result nor an error property.'));
\r
881 function traceSendingRequest(message) {
\r
882 if (trace === Trace.Off || !tracer) {
\r
885 if (traceFormat === TraceFormat.Text) {
\r
886 let data = undefined;
\r
887 if (trace === Trace.Verbose && message.params) {
\r
888 data = `Params: ${JSON.stringify(message.params, null, 4)}\n\n`;
\r
890 tracer.log(`Sending request '${message.method} - (${message.id})'.`, data);
\r
893 logLSPMessage('send-request', message);
\r
896 function traceSendingNotification(message) {
\r
897 if (trace === Trace.Off || !tracer) {
\r
900 if (traceFormat === TraceFormat.Text) {
\r
901 let data = undefined;
\r
902 if (trace === Trace.Verbose) {
\r
903 if (message.params) {
\r
904 data = `Params: ${JSON.stringify(message.params, null, 4)}\n\n`;
\r
907 data = 'No parameters provided.\n\n';
\r
910 tracer.log(`Sending notification '${message.method}'.`, data);
\r
913 logLSPMessage('send-notification', message);
\r
916 function traceSendingResponse(message, method, startTime) {
\r
917 if (trace === Trace.Off || !tracer) {
\r
920 if (traceFormat === TraceFormat.Text) {
\r
921 let data = undefined;
\r
922 if (trace === Trace.Verbose) {
\r
923 if (message.error && message.error.data) {
\r
924 data = `Error data: ${JSON.stringify(message.error.data, null, 4)}\n\n`;
\r
927 if (message.result) {
\r
928 data = `Result: ${JSON.stringify(message.result, null, 4)}\n\n`;
\r
930 else if (message.error === void 0) {
\r
931 data = 'No result returned.\n\n';
\r
935 tracer.log(`Sending response '${method} - (${message.id})'. Processing request took ${Date.now() - startTime}ms`, data);
\r
938 logLSPMessage('send-response', message);
\r
941 function traceReceivedRequest(message) {
\r
942 if (trace === Trace.Off || !tracer) {
\r
945 if (traceFormat === TraceFormat.Text) {
\r
946 let data = undefined;
\r
947 if (trace === Trace.Verbose && message.params) {
\r
948 data = `Params: ${JSON.stringify(message.params, null, 4)}\n\n`;
\r
950 tracer.log(`Received request '${message.method} - (${message.id})'.`, data);
\r
953 logLSPMessage('receive-request', message);
\r
956 function traceReceivedNotification(message) {
\r
957 if (trace === Trace.Off || !tracer || message.method === LogTraceNotification.type.method) {
\r
960 if (traceFormat === TraceFormat.Text) {
\r
961 let data = undefined;
\r
962 if (trace === Trace.Verbose) {
\r
963 if (message.params) {
\r
964 data = `Params: ${JSON.stringify(message.params, null, 4)}\n\n`;
\r
967 data = 'No parameters provided.\n\n';
\r
970 tracer.log(`Received notification '${message.method}'.`, data);
\r
973 logLSPMessage('receive-notification', message);
\r
976 function traceReceivedResponse(message, responsePromise) {
\r
977 if (trace === Trace.Off || !tracer) {
\r
980 if (traceFormat === TraceFormat.Text) {
\r
981 let data = undefined;
\r
982 if (trace === Trace.Verbose) {
\r
983 if (message.error && message.error.data) {
\r
984 data = `Error data: ${JSON.stringify(message.error.data, null, 4)}\n\n`;
\r
987 if (message.result) {
\r
988 data = `Result: ${JSON.stringify(message.result, null, 4)}\n\n`;
\r
990 else if (message.error === void 0) {
\r
991 data = 'No result returned.\n\n';
\r
995 if (responsePromise) {
\r
996 let error = message.error ? ` Request failed: ${message.error.message} (${message.error.code}).` : '';
\r
997 tracer.log(`Received response '${responsePromise.method} - (${message.id})' in ${Date.now() - responsePromise.timerStart}ms.${error}`, data);
\r
1000 tracer.log(`Received response ${message.id} without active response promise.`, data);
\r
1004 logLSPMessage('receive-response', message);
\r
1007 function logLSPMessage(type, message) {
\r
1008 if (!tracer || trace === Trace.Off) {
\r
1011 const lspMessage = {
\r
1012 isLSPMessage: true,
\r
1015 timestamp: Date.now()
\r
1017 tracer.log(lspMessage);
\r
1019 function throwIfClosedOrDisposed() {
\r
1021 throw new ConnectionError(ConnectionErrors.Closed, 'Connection is closed.');
\r
1023 if (isDisposed()) {
\r
1024 throw new ConnectionError(ConnectionErrors.Disposed, 'Connection is disposed.');
\r
1027 function throwIfListening() {
\r
1028 if (isListening()) {
\r
1029 throw new ConnectionError(ConnectionErrors.AlreadyListening, 'Connection is already listening');
\r
1032 function throwIfNotListening() {
\r
1033 if (!isListening()) {
\r
1034 throw new Error('Call listen() first.');
\r
1037 function undefinedToNull(param) {
\r
1038 if (param === void 0) {
\r
1045 function computeMessageParams(type, params) {
\r
1047 let numberOfParams = type.numberOfParams;
\r
1048 switch (numberOfParams) {
\r
1053 result = undefinedToNull(params[0]);
\r
1057 for (let i = 0; i < params.length && i < numberOfParams; i++) {
\r
1058 result.push(undefinedToNull(params[i]));
\r
1060 if (params.length < numberOfParams) {
\r
1061 for (let i = params.length; i < numberOfParams; i++) {
\r
1062 result.push(null);
\r
1069 let connection = {
\r
1070 sendNotification: (type, ...params) => {
\r
1071 throwIfClosedOrDisposed();
\r
1073 let messageParams;
\r
1074 if (Is.string(type)) {
\r
1076 switch (params.length) {
\r
1078 messageParams = null;
\r
1081 messageParams = params[0];
\r
1084 messageParams = params;
\r
1089 method = type.method;
\r
1090 messageParams = computeMessageParams(type, params);
\r
1092 let notificationMessage = {
\r
1095 params: messageParams
\r
1097 traceSendingNotification(notificationMessage);
\r
1098 messageWriter.write(notificationMessage);
\r
1100 onNotification: (type, handler) => {
\r
1101 throwIfClosedOrDisposed();
\r
1102 if (Is.func(type)) {
\r
1103 starNotificationHandler = type;
\r
1105 else if (handler) {
\r
1106 if (Is.string(type)) {
\r
1107 notificationHandlers[type] = { type: undefined, handler };
\r
1110 notificationHandlers[type.method] = { type, handler };
\r
1114 onProgress: (_type, token, handler) => {
\r
1115 if (progressHandlers.has(token)) {
\r
1116 throw new Error(`Progress handler for token ${token} already registered`);
\r
1118 progressHandlers.set(token, handler);
\r
1121 progressHandlers.delete(token);
\r
1125 sendProgress: (_type, token, value) => {
\r
1126 connection.sendNotification(ProgressNotification.type, { token, value });
\r
1128 onUnhandledProgress: unhandledProgressEmitter.event,
\r
1129 sendRequest: (type, ...params) => {
\r
1130 throwIfClosedOrDisposed();
\r
1131 throwIfNotListening();
\r
1133 let messageParams;
\r
1134 let token = undefined;
\r
1135 if (Is.string(type)) {
\r
1137 switch (params.length) {
\r
1139 messageParams = null;
\r
1142 // The cancellation token is optional so it can also be undefined.
\r
1143 if (cancellation_1.CancellationToken.is(params[0])) {
\r
1144 messageParams = null;
\r
1145 token = params[0];
\r
1148 messageParams = undefinedToNull(params[0]);
\r
1152 const last = params.length - 1;
\r
1153 if (cancellation_1.CancellationToken.is(params[last])) {
\r
1154 token = params[last];
\r
1155 if (params.length === 2) {
\r
1156 messageParams = undefinedToNull(params[0]);
\r
1159 messageParams = params.slice(0, last).map(value => undefinedToNull(value));
\r
1163 messageParams = params.map(value => undefinedToNull(value));
\r
1169 method = type.method;
\r
1170 messageParams = computeMessageParams(type, params);
\r
1171 let numberOfParams = type.numberOfParams;
\r
1172 token = cancellation_1.CancellationToken.is(params[numberOfParams]) ? params[numberOfParams] : undefined;
\r
1174 let id = sequenceNumber++;
\r
1175 let result = new Promise((resolve, reject) => {
\r
1176 let requestMessage = {
\r
1180 params: messageParams
\r
1182 let responsePromise = { method: method, timerStart: Date.now(), resolve, reject };
\r
1183 traceSendingRequest(requestMessage);
\r
1185 messageWriter.write(requestMessage);
\r
1188 // Writing the message failed. So we need to reject the promise.
\r
1189 responsePromise.reject(new messages_1.ResponseError(messages_1.ErrorCodes.MessageWriteError, e.message ? e.message : 'Unknown reason'));
\r
1190 responsePromise = null;
\r
1192 if (responsePromise) {
\r
1193 responsePromises[String(id)] = responsePromise;
\r
1197 token.onCancellationRequested(() => {
\r
1198 connection.sendNotification(CancelNotification.type, { id });
\r
1203 onRequest: (type, handler) => {
\r
1204 throwIfClosedOrDisposed();
\r
1205 if (Is.func(type)) {
\r
1206 starRequestHandler = type;
\r
1208 else if (handler) {
\r
1209 if (Is.string(type)) {
\r
1210 requestHandlers[type] = { type: undefined, handler };
\r
1213 requestHandlers[type.method] = { type, handler };
\r
1217 trace: (_value, _tracer, sendNotificationOrTraceOptions) => {
\r
1218 let _sendNotification = false;
\r
1219 let _traceFormat = TraceFormat.Text;
\r
1220 if (sendNotificationOrTraceOptions !== void 0) {
\r
1221 if (Is.boolean(sendNotificationOrTraceOptions)) {
\r
1222 _sendNotification = sendNotificationOrTraceOptions;
\r
1225 _sendNotification = sendNotificationOrTraceOptions.sendNotification || false;
\r
1226 _traceFormat = sendNotificationOrTraceOptions.traceFormat || TraceFormat.Text;
\r
1230 traceFormat = _traceFormat;
\r
1231 if (trace === Trace.Off) {
\r
1232 tracer = undefined;
\r
1237 if (_sendNotification && !isClosed() && !isDisposed()) {
\r
1238 connection.sendNotification(SetTraceNotification.type, { value: Trace.toString(_value) });
\r
1241 onError: errorEmitter.event,
\r
1242 onClose: closeEmitter.event,
\r
1243 onUnhandledNotification: unhandledNotificationEmitter.event,
\r
1244 onDispose: disposeEmitter.event,
\r
1246 if (isDisposed()) {
\r
1249 state = ConnectionState.Disposed;
\r
1250 disposeEmitter.fire(undefined);
\r
1251 let error = new Error('Connection got disposed.');
\r
1252 Object.keys(responsePromises).forEach((key) => {
\r
1253 responsePromises[key].reject(error);
\r
1255 responsePromises = Object.create(null);
\r
1256 requestTokens = Object.create(null);
\r
1257 messageQueue = new linkedMap_1.LinkedMap();
\r
1258 // Test for backwards compatibility
\r
1259 if (Is.func(messageWriter.dispose)) {
\r
1260 messageWriter.dispose();
\r
1262 if (Is.func(messageReader.dispose)) {
\r
1263 messageReader.dispose();
\r
1267 throwIfClosedOrDisposed();
\r
1268 throwIfListening();
\r
1269 state = ConnectionState.Listening;
\r
1270 messageReader.listen(callback);
\r
1273 // eslint-disable-next-line no-console
\r
1274 console.log('inspect');
\r
1277 connection.onNotification(LogTraceNotification.type, (params) => {
\r
1278 if (trace === Trace.Off || !tracer) {
\r
1281 tracer.log(params.message, trace === Trace.Verbose ? params.verbose : undefined);
\r
1283 connection.onNotification(ProgressNotification.type, (params) => {
\r
1284 const handler = progressHandlers.get(params.token);
\r
1286 handler(params.value);
\r
1289 unhandledProgressEmitter.fire(params);
\r
1292 return connection;
\r
1294 function isMessageReader(value) {
\r
1295 return value.listen !== void 0 && value.read === void 0;
\r
1297 function isMessageWriter(value) {
\r
1298 return value.write !== void 0 && value.end === void 0;
\r
1300 function createMessageConnection(input, output, logger, strategy) {
\r
1302 logger = exports.NullLogger;
\r
1304 let reader = isMessageReader(input) ? input : new messageReader_1.StreamMessageReader(input);
\r
1305 let writer = isMessageWriter(output) ? output : new messageWriter_1.StreamMessageWriter(output);
\r
1306 return _createMessageConnection(reader, writer, logger, strategy);
\r
1308 exports.createMessageConnection = createMessageConnection;
\r
1313 /***/ (function(module, exports, __webpack_require__) {
1316 /* --------------------------------------------------------------------------------------------
\r
1317 * Copyright (c) Microsoft Corporation. All rights reserved.
\r
1318 * Licensed under the MIT License. See License.txt in the project root for license information.
\r
1319 * ------------------------------------------------------------------------------------------ */
\r
1321 Object.defineProperty(exports, "__esModule", { value: true });
\r
1322 function boolean(value) {
\r
1323 return value === true || value === false;
\r
1325 exports.boolean = boolean;
\r
1326 function string(value) {
\r
1327 return typeof value === 'string' || value instanceof String;
\r
1329 exports.string = string;
\r
1330 function number(value) {
\r
1331 return typeof value === 'number' || value instanceof Number;
\r
1333 exports.number = number;
\r
1334 function error(value) {
\r
1335 return value instanceof Error;
\r
1337 exports.error = error;
\r
1338 function func(value) {
\r
1339 return typeof value === 'function';
\r
1341 exports.func = func;
\r
1342 function array(value) {
\r
1343 return Array.isArray(value);
\r
1345 exports.array = array;
\r
1346 function stringArray(value) {
\r
1347 return array(value) && value.every(elem => string(elem));
\r
1349 exports.stringArray = stringArray;
\r
1354 /***/ (function(module, exports, __webpack_require__) {
1357 /* --------------------------------------------------------------------------------------------
\r
1358 * Copyright (c) Microsoft Corporation. All rights reserved.
\r
1359 * Licensed under the MIT License. See License.txt in the project root for license information.
\r
1360 * ------------------------------------------------------------------------------------------ */
\r
1362 Object.defineProperty(exports, "__esModule", { value: true });
\r
1363 const is = __webpack_require__(6);
\r
1365 * Predefined error codes.
\r
1368 (function (ErrorCodes) {
\r
1369 // Defined by JSON RPC
\r
1370 ErrorCodes.ParseError = -32700;
\r
1371 ErrorCodes.InvalidRequest = -32600;
\r
1372 ErrorCodes.MethodNotFound = -32601;
\r
1373 ErrorCodes.InvalidParams = -32602;
\r
1374 ErrorCodes.InternalError = -32603;
\r
1375 ErrorCodes.serverErrorStart = -32099;
\r
1376 ErrorCodes.serverErrorEnd = -32000;
\r
1377 ErrorCodes.ServerNotInitialized = -32002;
\r
1378 ErrorCodes.UnknownErrorCode = -32001;
\r
1379 // Defined by the protocol.
\r
1380 ErrorCodes.RequestCancelled = -32800;
\r
1381 ErrorCodes.ContentModified = -32801;
\r
1382 // Defined by VSCode library.
\r
1383 ErrorCodes.MessageWriteError = 1;
\r
1384 ErrorCodes.MessageReadError = 2;
\r
1385 })(ErrorCodes = exports.ErrorCodes || (exports.ErrorCodes = {}));
\r
1387 * An error object return in a response in case a request
\r
1390 class ResponseError extends Error {
\r
1391 constructor(code, message, data) {
\r
1393 this.code = is.number(code) ? code : ErrorCodes.UnknownErrorCode;
\r
1395 Object.setPrototypeOf(this, ResponseError.prototype);
\r
1400 message: this.message,
\r
1405 exports.ResponseError = ResponseError;
\r
1407 * An abstract implementation of a MessageType.
\r
1409 class AbstractMessageType {
\r
1410 constructor(_method, _numberOfParams) {
\r
1411 this._method = _method;
\r
1412 this._numberOfParams = _numberOfParams;
\r
1415 return this._method;
\r
1417 get numberOfParams() {
\r
1418 return this._numberOfParams;
\r
1421 exports.AbstractMessageType = AbstractMessageType;
\r
1423 * Classes to type request response pairs
\r
1425 * The type parameter RO will be removed in the next major version
\r
1426 * of the JSON RPC library since it is a LSP concept and doesn't
\r
1427 * belong here. For now it is tagged as default never.
\r
1429 class RequestType0 extends AbstractMessageType {
\r
1430 constructor(method) {
\r
1434 exports.RequestType0 = RequestType0;
\r
1435 class RequestType extends AbstractMessageType {
\r
1436 constructor(method) {
\r
1440 exports.RequestType = RequestType;
\r
1441 class RequestType1 extends AbstractMessageType {
\r
1442 constructor(method) {
\r
1446 exports.RequestType1 = RequestType1;
\r
1447 class RequestType2 extends AbstractMessageType {
\r
1448 constructor(method) {
\r
1452 exports.RequestType2 = RequestType2;
\r
1453 class RequestType3 extends AbstractMessageType {
\r
1454 constructor(method) {
\r
1458 exports.RequestType3 = RequestType3;
\r
1459 class RequestType4 extends AbstractMessageType {
\r
1460 constructor(method) {
\r
1464 exports.RequestType4 = RequestType4;
\r
1465 class RequestType5 extends AbstractMessageType {
\r
1466 constructor(method) {
\r
1470 exports.RequestType5 = RequestType5;
\r
1471 class RequestType6 extends AbstractMessageType {
\r
1472 constructor(method) {
\r
1476 exports.RequestType6 = RequestType6;
\r
1477 class RequestType7 extends AbstractMessageType {
\r
1478 constructor(method) {
\r
1482 exports.RequestType7 = RequestType7;
\r
1483 class RequestType8 extends AbstractMessageType {
\r
1484 constructor(method) {
\r
1488 exports.RequestType8 = RequestType8;
\r
1489 class RequestType9 extends AbstractMessageType {
\r
1490 constructor(method) {
\r
1494 exports.RequestType9 = RequestType9;
\r
1496 * The type parameter RO will be removed in the next major version
\r
1497 * of the JSON RPC library since it is a LSP concept and doesn't
\r
1498 * belong here. For now it is tagged as default never.
\r
1500 class NotificationType extends AbstractMessageType {
\r
1501 constructor(method) {
\r
1503 this._ = undefined;
\r
1506 exports.NotificationType = NotificationType;
\r
1507 class NotificationType0 extends AbstractMessageType {
\r
1508 constructor(method) {
\r
1512 exports.NotificationType0 = NotificationType0;
\r
1513 class NotificationType1 extends AbstractMessageType {
\r
1514 constructor(method) {
\r
1518 exports.NotificationType1 = NotificationType1;
\r
1519 class NotificationType2 extends AbstractMessageType {
\r
1520 constructor(method) {
\r
1524 exports.NotificationType2 = NotificationType2;
\r
1525 class NotificationType3 extends AbstractMessageType {
\r
1526 constructor(method) {
\r
1530 exports.NotificationType3 = NotificationType3;
\r
1531 class NotificationType4 extends AbstractMessageType {
\r
1532 constructor(method) {
\r
1536 exports.NotificationType4 = NotificationType4;
\r
1537 class NotificationType5 extends AbstractMessageType {
\r
1538 constructor(method) {
\r
1542 exports.NotificationType5 = NotificationType5;
\r
1543 class NotificationType6 extends AbstractMessageType {
\r
1544 constructor(method) {
\r
1548 exports.NotificationType6 = NotificationType6;
\r
1549 class NotificationType7 extends AbstractMessageType {
\r
1550 constructor(method) {
\r
1554 exports.NotificationType7 = NotificationType7;
\r
1555 class NotificationType8 extends AbstractMessageType {
\r
1556 constructor(method) {
\r
1560 exports.NotificationType8 = NotificationType8;
\r
1561 class NotificationType9 extends AbstractMessageType {
\r
1562 constructor(method) {
\r
1566 exports.NotificationType9 = NotificationType9;
\r
1568 * Tests if the given message is a request message
\r
1570 function isRequestMessage(message) {
\r
1571 let candidate = message;
\r
1572 return candidate && is.string(candidate.method) && (is.string(candidate.id) || is.number(candidate.id));
\r
1574 exports.isRequestMessage = isRequestMessage;
\r
1576 * Tests if the given message is a notification message
\r
1578 function isNotificationMessage(message) {
\r
1579 let candidate = message;
\r
1580 return candidate && is.string(candidate.method) && message.id === void 0;
\r
1582 exports.isNotificationMessage = isNotificationMessage;
\r
1584 * Tests if the given message is a response message
\r
1586 function isResponseMessage(message) {
\r
1587 let candidate = message;
\r
1588 return candidate && (candidate.result !== void 0 || !!candidate.error) && (is.string(candidate.id) || is.number(candidate.id) || candidate.id === null);
\r
1590 exports.isResponseMessage = isResponseMessage;
\r
1595 /***/ (function(module, exports, __webpack_require__) {
1598 /* --------------------------------------------------------------------------------------------
\r
1599 * Copyright (c) Microsoft Corporation. All rights reserved.
\r
1600 * Licensed under the MIT License. See License.txt in the project root for license information.
\r
1601 * ------------------------------------------------------------------------------------------ */
\r
1603 Object.defineProperty(exports, "__esModule", { value: true });
\r
1604 const events_1 = __webpack_require__(9);
\r
1605 const Is = __webpack_require__(6);
\r
1606 let DefaultSize = 8192;
\r
1607 let CR = Buffer.from('\r', 'ascii')[0];
\r
1608 let LF = Buffer.from('\n', 'ascii')[0];
\r
1609 let CRLF = '\r\n';
\r
1610 class MessageBuffer {
\r
1611 constructor(encoding = 'utf8') {
\r
1612 this.encoding = encoding;
\r
1614 this.buffer = Buffer.allocUnsafe(DefaultSize);
\r
1617 var toAppend = chunk;
\r
1618 if (typeof (chunk) === 'string') {
\r
1620 var bufferLen = Buffer.byteLength(str, this.encoding);
\r
1621 toAppend = Buffer.allocUnsafe(bufferLen);
\r
1622 toAppend.write(str, 0, bufferLen, this.encoding);
\r
1624 if (this.buffer.length - this.index >= toAppend.length) {
\r
1625 toAppend.copy(this.buffer, this.index, 0, toAppend.length);
\r
1628 var newSize = (Math.ceil((this.index + toAppend.length) / DefaultSize) + 1) * DefaultSize;
\r
1629 if (this.index === 0) {
\r
1630 this.buffer = Buffer.allocUnsafe(newSize);
\r
1631 toAppend.copy(this.buffer, 0, 0, toAppend.length);
\r
1634 this.buffer = Buffer.concat([this.buffer.slice(0, this.index), toAppend], newSize);
\r
1637 this.index += toAppend.length;
\r
1639 tryReadHeaders() {
\r
1640 let result = undefined;
\r
1642 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
1645 // No header / body separator found (e.g CRLFCRLF)
\r
1646 if (current + 3 >= this.index) {
\r
1649 result = Object.create(null);
\r
1650 let headers = this.buffer.toString('ascii', 0, current).split(CRLF);
\r
1651 headers.forEach((header) => {
\r
1652 let index = header.indexOf(':');
\r
1653 if (index === -1) {
\r
1654 throw new Error('Message header must separate key and value using :');
\r
1656 let key = header.substr(0, index);
\r
1657 let value = header.substr(index + 1).trim();
\r
1658 result[key] = value;
\r
1660 let nextStart = current + 4;
\r
1661 this.buffer = this.buffer.slice(nextStart);
\r
1662 this.index = this.index - nextStart;
\r
1665 tryReadContent(length) {
\r
1666 if (this.index < length) {
\r
1669 let result = this.buffer.toString(this.encoding, 0, length);
\r
1670 let nextStart = length;
\r
1671 this.buffer.copy(this.buffer, 0, nextStart);
\r
1672 this.index = this.index - nextStart;
\r
1675 get numberOfBytes() {
\r
1676 return this.index;
\r
1679 var MessageReader;
\r
1680 (function (MessageReader) {
\r
1681 function is(value) {
\r
1682 let candidate = value;
\r
1683 return candidate && Is.func(candidate.listen) && Is.func(candidate.dispose) &&
\r
1684 Is.func(candidate.onError) && Is.func(candidate.onClose) && Is.func(candidate.onPartialMessage);
\r
1686 MessageReader.is = is;
\r
1687 })(MessageReader = exports.MessageReader || (exports.MessageReader = {}));
\r
1688 class AbstractMessageReader {
\r
1690 this.errorEmitter = new events_1.Emitter();
\r
1691 this.closeEmitter = new events_1.Emitter();
\r
1692 this.partialMessageEmitter = new events_1.Emitter();
\r
1695 this.errorEmitter.dispose();
\r
1696 this.closeEmitter.dispose();
\r
1699 return this.errorEmitter.event;
\r
1701 fireError(error) {
\r
1702 this.errorEmitter.fire(this.asError(error));
\r
1705 return this.closeEmitter.event;
\r
1708 this.closeEmitter.fire(undefined);
\r
1710 get onPartialMessage() {
\r
1711 return this.partialMessageEmitter.event;
\r
1713 firePartialMessage(info) {
\r
1714 this.partialMessageEmitter.fire(info);
\r
1717 if (error instanceof Error) {
\r
1721 return new Error(`Reader received error. Reason: ${Is.string(error.message) ? error.message : 'unknown'}`);
\r
1725 exports.AbstractMessageReader = AbstractMessageReader;
\r
1726 class StreamMessageReader extends AbstractMessageReader {
\r
1727 constructor(readable, encoding = 'utf8') {
\r
1729 this.readable = readable;
\r
1730 this.buffer = new MessageBuffer(encoding);
\r
1731 this._partialMessageTimeout = 10000;
\r
1733 set partialMessageTimeout(timeout) {
\r
1734 this._partialMessageTimeout = timeout;
\r
1736 get partialMessageTimeout() {
\r
1737 return this._partialMessageTimeout;
\r
1739 listen(callback) {
\r
1740 this.nextMessageLength = -1;
\r
1741 this.messageToken = 0;
\r
1742 this.partialMessageTimer = undefined;
\r
1743 this.callback = callback;
\r
1744 this.readable.on('data', (data) => {
\r
1745 this.onData(data);
\r
1747 this.readable.on('error', (error) => this.fireError(error));
\r
1748 this.readable.on('close', () => this.fireClose());
\r
1751 this.buffer.append(data);
\r
1753 if (this.nextMessageLength === -1) {
\r
1754 let headers = this.buffer.tryReadHeaders();
\r
1758 let contentLength = headers['Content-Length'];
\r
1759 if (!contentLength) {
\r
1760 throw new Error('Header must provide a Content-Length property.');
\r
1762 let length = parseInt(contentLength);
\r
1763 if (isNaN(length)) {
\r
1764 throw new Error('Content-Length value must be a number.');
\r
1766 this.nextMessageLength = length;
\r
1767 // Take the encoding form the header. For compatibility
\r
1768 // treat both utf-8 and utf8 as node utf8
\r
1770 var msg = this.buffer.tryReadContent(this.nextMessageLength);
\r
1771 if (msg === null) {
\r
1772 /** We haven't received the full message yet. */
\r
1773 this.setPartialMessageTimer();
\r
1776 this.clearPartialMessageTimer();
\r
1777 this.nextMessageLength = -1;
\r
1778 this.messageToken++;
\r
1779 var json = JSON.parse(msg);
\r
1780 this.callback(json);
\r
1783 clearPartialMessageTimer() {
\r
1784 if (this.partialMessageTimer) {
\r
1785 clearTimeout(this.partialMessageTimer);
\r
1786 this.partialMessageTimer = undefined;
\r
1789 setPartialMessageTimer() {
\r
1790 this.clearPartialMessageTimer();
\r
1791 if (this._partialMessageTimeout <= 0) {
\r
1794 this.partialMessageTimer = setTimeout((token, timeout) => {
\r
1795 this.partialMessageTimer = undefined;
\r
1796 if (token === this.messageToken) {
\r
1797 this.firePartialMessage({ messageToken: token, waitingTime: timeout });
\r
1798 this.setPartialMessageTimer();
\r
1800 }, this._partialMessageTimeout, this.messageToken, this._partialMessageTimeout);
\r
1803 exports.StreamMessageReader = StreamMessageReader;
\r
1804 class IPCMessageReader extends AbstractMessageReader {
\r
1805 constructor(process) {
\r
1807 this.process = process;
\r
1808 let eventEmitter = this.process;
\r
1809 eventEmitter.on('error', (error) => this.fireError(error));
\r
1810 eventEmitter.on('close', () => this.fireClose());
\r
1812 listen(callback) {
\r
1813 this.process.on('message', callback);
\r
1816 exports.IPCMessageReader = IPCMessageReader;
\r
1817 class SocketMessageReader extends StreamMessageReader {
\r
1818 constructor(socket, encoding = 'utf-8') {
\r
1819 super(socket, encoding);
\r
1822 exports.SocketMessageReader = SocketMessageReader;
\r
1827 /***/ (function(module, exports, __webpack_require__) {
1830 /* --------------------------------------------------------------------------------------------
\r
1831 * Copyright (c) Microsoft Corporation. All rights reserved.
\r
1832 * Licensed under the MIT License. See License.txt in the project root for license information.
\r
1833 * ------------------------------------------------------------------------------------------ */
\r
1835 Object.defineProperty(exports, "__esModule", { value: true });
\r
1837 (function (Disposable) {
\r
1838 function create(func) {
\r
1843 Disposable.create = create;
\r
1844 })(Disposable = exports.Disposable || (exports.Disposable = {}));
\r
1846 (function (Event) {
\r
1847 const _disposable = { dispose() { } };
\r
1848 Event.None = function () { return _disposable; };
\r
1849 })(Event = exports.Event || (exports.Event = {}));
\r
1850 class CallbackList {
\r
1851 add(callback, context = null, bucket) {
\r
1852 if (!this._callbacks) {
\r
1853 this._callbacks = [];
\r
1854 this._contexts = [];
\r
1856 this._callbacks.push(callback);
\r
1857 this._contexts.push(context);
\r
1858 if (Array.isArray(bucket)) {
\r
1859 bucket.push({ dispose: () => this.remove(callback, context) });
\r
1862 remove(callback, context = null) {
\r
1863 if (!this._callbacks) {
\r
1866 var foundCallbackWithDifferentContext = false;
\r
1867 for (var i = 0, len = this._callbacks.length; i < len; i++) {
\r
1868 if (this._callbacks[i] === callback) {
\r
1869 if (this._contexts[i] === context) {
\r
1870 // callback & context match => remove it
\r
1871 this._callbacks.splice(i, 1);
\r
1872 this._contexts.splice(i, 1);
\r
1876 foundCallbackWithDifferentContext = true;
\r
1880 if (foundCallbackWithDifferentContext) {
\r
1881 throw new Error('When adding a listener with a context, you should remove it with the same context');
\r
1885 if (!this._callbacks) {
\r
1888 var ret = [], callbacks = this._callbacks.slice(0), contexts = this._contexts.slice(0);
\r
1889 for (var i = 0, len = callbacks.length; i < len; i++) {
\r
1891 ret.push(callbacks[i].apply(contexts[i], args));
\r
1894 // eslint-disable-next-line no-console
\r
1901 return !this._callbacks || this._callbacks.length === 0;
\r
1904 this._callbacks = undefined;
\r
1905 this._contexts = undefined;
\r
1909 constructor(_options) {
\r
1910 this._options = _options;
\r
1913 * For the public to allow to subscribe
\r
1914 * to events from this Emitter
\r
1917 if (!this._event) {
\r
1918 this._event = (listener, thisArgs, disposables) => {
\r
1919 if (!this._callbacks) {
\r
1920 this._callbacks = new CallbackList();
\r
1922 if (this._options && this._options.onFirstListenerAdd && this._callbacks.isEmpty()) {
\r
1923 this._options.onFirstListenerAdd(this);
\r
1925 this._callbacks.add(listener, thisArgs);
\r
1929 this._callbacks.remove(listener, thisArgs);
\r
1930 result.dispose = Emitter._noop;
\r
1931 if (this._options && this._options.onLastListenerRemove && this._callbacks.isEmpty()) {
\r
1932 this._options.onLastListenerRemove(this);
\r
1936 if (Array.isArray(disposables)) {
\r
1937 disposables.push(result);
\r
1942 return this._event;
\r
1945 * To be kept private to fire an event to
\r
1949 if (this._callbacks) {
\r
1950 this._callbacks.invoke.call(this._callbacks, event);
\r
1954 if (this._callbacks) {
\r
1955 this._callbacks.dispose();
\r
1956 this._callbacks = undefined;
\r
1960 exports.Emitter = Emitter;
\r
1961 Emitter._noop = function () { };
\r
1966 /***/ (function(module, exports, __webpack_require__) {
1969 /* --------------------------------------------------------------------------------------------
\r
1970 * Copyright (c) Microsoft Corporation. All rights reserved.
\r
1971 * Licensed under the MIT License. See License.txt in the project root for license information.
\r
1972 * ------------------------------------------------------------------------------------------ */
\r
1974 Object.defineProperty(exports, "__esModule", { value: true });
\r
1975 const events_1 = __webpack_require__(9);
\r
1976 const Is = __webpack_require__(6);
\r
1977 let ContentLength = 'Content-Length: ';
\r
1978 let CRLF = '\r\n';
\r
1979 var MessageWriter;
\r
1980 (function (MessageWriter) {
\r
1981 function is(value) {
\r
1982 let candidate = value;
\r
1983 return candidate && Is.func(candidate.dispose) && Is.func(candidate.onClose) &&
\r
1984 Is.func(candidate.onError) && Is.func(candidate.write);
\r
1986 MessageWriter.is = is;
\r
1987 })(MessageWriter = exports.MessageWriter || (exports.MessageWriter = {}));
\r
1988 class AbstractMessageWriter {
\r
1990 this.errorEmitter = new events_1.Emitter();
\r
1991 this.closeEmitter = new events_1.Emitter();
\r
1994 this.errorEmitter.dispose();
\r
1995 this.closeEmitter.dispose();
\r
1998 return this.errorEmitter.event;
\r
2000 fireError(error, message, count) {
\r
2001 this.errorEmitter.fire([this.asError(error), message, count]);
\r
2004 return this.closeEmitter.event;
\r
2007 this.closeEmitter.fire(undefined);
\r
2010 if (error instanceof Error) {
\r
2014 return new Error(`Writer received error. Reason: ${Is.string(error.message) ? error.message : 'unknown'}`);
\r
2018 exports.AbstractMessageWriter = AbstractMessageWriter;
\r
2019 class StreamMessageWriter extends AbstractMessageWriter {
\r
2020 constructor(writable, encoding = 'utf8') {
\r
2022 this.writable = writable;
\r
2023 this.encoding = encoding;
\r
2024 this.errorCount = 0;
\r
2025 this.writable.on('error', (error) => this.fireError(error));
\r
2026 this.writable.on('close', () => this.fireClose());
\r
2029 let json = JSON.stringify(msg);
\r
2030 let contentLength = Buffer.byteLength(json, this.encoding);
\r
2032 ContentLength, contentLength.toString(), CRLF,
\r
2036 // Header must be written in ASCII encoding
\r
2037 this.writable.write(headers.join(''), 'ascii');
\r
2038 // Now write the content. This can be written in any encoding
\r
2039 this.writable.write(json, this.encoding);
\r
2040 this.errorCount = 0;
\r
2043 this.errorCount++;
\r
2044 this.fireError(error, msg, this.errorCount);
\r
2048 exports.StreamMessageWriter = StreamMessageWriter;
\r
2049 class IPCMessageWriter extends AbstractMessageWriter {
\r
2050 constructor(process) {
\r
2052 this.process = process;
\r
2053 this.errorCount = 0;
\r
2055 this.sending = false;
\r
2056 let eventEmitter = this.process;
\r
2057 eventEmitter.on('error', (error) => this.fireError(error));
\r
2058 eventEmitter.on('close', () => this.fireClose);
\r
2061 if (!this.sending && this.queue.length === 0) {
\r
2062 // See https://github.com/nodejs/node/issues/7657
\r
2063 this.doWriteMessage(msg);
\r
2066 this.queue.push(msg);
\r
2069 doWriteMessage(msg) {
\r
2071 if (this.process.send) {
\r
2072 this.sending = true;
\r
2073 this.process.send(msg, undefined, undefined, (error) => {
\r
2074 this.sending = false;
\r
2076 this.errorCount++;
\r
2077 this.fireError(error, msg, this.errorCount);
\r
2080 this.errorCount = 0;
\r
2082 if (this.queue.length > 0) {
\r
2083 this.doWriteMessage(this.queue.shift());
\r
2089 this.errorCount++;
\r
2090 this.fireError(error, msg, this.errorCount);
\r
2094 exports.IPCMessageWriter = IPCMessageWriter;
\r
2095 class SocketMessageWriter extends AbstractMessageWriter {
\r
2096 constructor(socket, encoding = 'utf8') {
\r
2098 this.socket = socket;
\r
2100 this.sending = false;
\r
2101 this.encoding = encoding;
\r
2102 this.errorCount = 0;
\r
2103 this.socket.on('error', (error) => this.fireError(error));
\r
2104 this.socket.on('close', () => this.fireClose());
\r
2108 this.socket.destroy();
\r
2111 if (!this.sending && this.queue.length === 0) {
\r
2112 // See https://github.com/nodejs/node/issues/7657
\r
2113 this.doWriteMessage(msg);
\r
2116 this.queue.push(msg);
\r
2119 doWriteMessage(msg) {
\r
2120 let json = JSON.stringify(msg);
\r
2121 let contentLength = Buffer.byteLength(json, this.encoding);
\r
2123 ContentLength, contentLength.toString(), CRLF,
\r
2127 // Header must be written in ASCII encoding
\r
2128 this.sending = true;
\r
2129 this.socket.write(headers.join(''), 'ascii', (error) => {
\r
2131 this.handleError(error, msg);
\r
2134 // Now write the content. This can be written in any encoding
\r
2135 this.socket.write(json, this.encoding, (error) => {
\r
2136 this.sending = false;
\r
2138 this.handleError(error, msg);
\r
2141 this.errorCount = 0;
\r
2143 if (this.queue.length > 0) {
\r
2144 this.doWriteMessage(this.queue.shift());
\r
2149 this.handleError(error, msg);
\r
2154 this.handleError(error, msg);
\r
2157 handleError(error, msg) {
\r
2158 this.errorCount++;
\r
2159 this.fireError(error, msg, this.errorCount);
\r
2162 exports.SocketMessageWriter = SocketMessageWriter;
\r
2167 /***/ (function(module, exports, __webpack_require__) {
2170 /*---------------------------------------------------------------------------------------------
\r
2171 * Copyright (c) Microsoft Corporation. All rights reserved.
\r
2172 * Licensed under the MIT License. See License.txt in the project root for license information.
\r
2173 *--------------------------------------------------------------------------------------------*/
\r
2175 Object.defineProperty(exports, "__esModule", { value: true });
\r
2176 const events_1 = __webpack_require__(9);
\r
2177 const Is = __webpack_require__(6);
\r
2178 var CancellationToken;
\r
2179 (function (CancellationToken) {
\r
2180 CancellationToken.None = Object.freeze({
\r
2181 isCancellationRequested: false,
\r
2182 onCancellationRequested: events_1.Event.None
\r
2184 CancellationToken.Cancelled = Object.freeze({
\r
2185 isCancellationRequested: true,
\r
2186 onCancellationRequested: events_1.Event.None
\r
2188 function is(value) {
\r
2189 let candidate = value;
\r
2190 return candidate && (candidate === CancellationToken.None
\r
2191 || candidate === CancellationToken.Cancelled
\r
2192 || (Is.boolean(candidate.isCancellationRequested) && !!candidate.onCancellationRequested));
\r
2194 CancellationToken.is = is;
\r
2195 })(CancellationToken = exports.CancellationToken || (exports.CancellationToken = {}));
\r
2196 const shortcutEvent = Object.freeze(function (callback, context) {
\r
2197 let handle = setTimeout(callback.bind(context), 0);
\r
2198 return { dispose() { clearTimeout(handle); } };
\r
2200 class MutableToken {
\r
2202 this._isCancelled = false;
\r
2205 if (!this._isCancelled) {
\r
2206 this._isCancelled = true;
\r
2207 if (this._emitter) {
\r
2208 this._emitter.fire(undefined);
\r
2213 get isCancellationRequested() {
\r
2214 return this._isCancelled;
\r
2216 get onCancellationRequested() {
\r
2217 if (this._isCancelled) {
\r
2218 return shortcutEvent;
\r
2220 if (!this._emitter) {
\r
2221 this._emitter = new events_1.Emitter();
\r
2223 return this._emitter.event;
\r
2226 if (this._emitter) {
\r
2227 this._emitter.dispose();
\r
2228 this._emitter = undefined;
\r
2232 class CancellationTokenSource {
\r
2234 if (!this._token) {
\r
2235 // be lazy and create the token only when
\r
2236 // actually needed
\r
2237 this._token = new MutableToken();
\r
2239 return this._token;
\r
2242 if (!this._token) {
\r
2243 // save an object by returning the default
\r
2244 // cancelled token when cancellation happens
\r
2245 // before someone asks for the token
\r
2246 this._token = CancellationToken.Cancelled;
\r
2249 this._token.cancel();
\r
2253 if (!this._token) {
\r
2254 // ensure to initialize with an empty token if we had none
\r
2255 this._token = CancellationToken.None;
\r
2257 else if (this._token instanceof MutableToken) {
\r
2258 // actually dispose
\r
2259 this._token.dispose();
\r
2263 exports.CancellationTokenSource = CancellationTokenSource;
\r
2268 /***/ (function(module, exports, __webpack_require__) {
2272 /*---------------------------------------------------------------------------------------------
\r
2273 * Copyright (c) Microsoft Corporation. All rights reserved.
\r
2274 * Licensed under the MIT License. See License.txt in the project root for license information.
\r
2275 *--------------------------------------------------------------------------------------------*/
\r
2276 Object.defineProperty(exports, "__esModule", { value: true });
\r
2278 (function (Touch) {
\r
2282 })(Touch = exports.Touch || (exports.Touch = {}));
\r
2285 this._map = new Map();
\r
2286 this._head = undefined;
\r
2287 this._tail = undefined;
\r
2291 this._map.clear();
\r
2292 this._head = undefined;
\r
2293 this._tail = undefined;
\r
2297 return !this._head && !this._tail;
\r
2300 return this._size;
\r
2303 return this._map.has(key);
\r
2306 const item = this._map.get(key);
\r
2310 return item.value;
\r
2312 set(key, value, touch = Touch.None) {
\r
2313 let item = this._map.get(key);
\r
2315 item.value = value;
\r
2316 if (touch !== Touch.None) {
\r
2317 this.touch(item, touch);
\r
2321 item = { key, value, next: undefined, previous: undefined };
\r
2324 this.addItemLast(item);
\r
2327 this.addItemFirst(item);
\r
2330 this.addItemLast(item);
\r
2333 this.addItemLast(item);
\r
2336 this._map.set(key, item);
\r
2341 const item = this._map.get(key);
\r
2345 this._map.delete(key);
\r
2346 this.removeItem(item);
\r
2351 if (!this._head && !this._tail) {
\r
2354 if (!this._head || !this._tail) {
\r
2355 throw new Error('Invalid list');
\r
2357 const item = this._head;
\r
2358 this._map.delete(item.key);
\r
2359 this.removeItem(item);
\r
2361 return item.value;
\r
2363 forEach(callbackfn, thisArg) {
\r
2364 let current = this._head;
\r
2367 callbackfn.bind(thisArg)(current.value, current.key, this);
\r
2370 callbackfn(current.value, current.key, this);
\r
2372 current = current.next;
\r
2375 forEachReverse(callbackfn, thisArg) {
\r
2376 let current = this._tail;
\r
2379 callbackfn.bind(thisArg)(current.value, current.key, this);
\r
2382 callbackfn(current.value, current.key, this);
\r
2384 current = current.previous;
\r
2389 let current = this._head;
\r
2391 result.push(current.value);
\r
2392 current = current.next;
\r
2398 let current = this._head;
\r
2400 result.push(current.key);
\r
2401 current = current.next;
\r
2405 /* JSON RPC run on es5 which has no Symbol.iterator
\r
2406 public keys(): IterableIterator<K> {
\r
2407 let current = this._head;
\r
2408 let iterator: IterableIterator<K> = {
\r
2409 [Symbol.iterator]() {
\r
2412 next():IteratorResult<K> {
\r
2414 let result = { value: current.key, done: false };
\r
2415 current = current.next;
\r
2418 return { value: undefined, done: true };
\r
2425 public values(): IterableIterator<V> {
\r
2426 let current = this._head;
\r
2427 let iterator: IterableIterator<V> = {
\r
2428 [Symbol.iterator]() {
\r
2431 next():IteratorResult<V> {
\r
2433 let result = { value: current.value, done: false };
\r
2434 current = current.next;
\r
2437 return { value: undefined, done: true };
\r
2444 addItemFirst(item) {
\r
2445 // First time Insert
\r
2446 if (!this._head && !this._tail) {
\r
2447 this._tail = item;
\r
2449 else if (!this._head) {
\r
2450 throw new Error('Invalid list');
\r
2453 item.next = this._head;
\r
2454 this._head.previous = item;
\r
2456 this._head = item;
\r
2458 addItemLast(item) {
\r
2459 // First time Insert
\r
2460 if (!this._head && !this._tail) {
\r
2461 this._head = item;
\r
2463 else if (!this._tail) {
\r
2464 throw new Error('Invalid list');
\r
2467 item.previous = this._tail;
\r
2468 this._tail.next = item;
\r
2470 this._tail = item;
\r
2472 removeItem(item) {
\r
2473 if (item === this._head && item === this._tail) {
\r
2474 this._head = undefined;
\r
2475 this._tail = undefined;
\r
2477 else if (item === this._head) {
\r
2478 this._head = item.next;
\r
2480 else if (item === this._tail) {
\r
2481 this._tail = item.previous;
\r
2484 const next = item.next;
\r
2485 const previous = item.previous;
\r
2486 if (!next || !previous) {
\r
2487 throw new Error('Invalid list');
\r
2489 next.previous = previous;
\r
2490 previous.next = next;
\r
2493 touch(item, touch) {
\r
2494 if (!this._head || !this._tail) {
\r
2495 throw new Error('Invalid list');
\r
2497 if ((touch !== Touch.First && touch !== Touch.Last)) {
\r
2500 if (touch === Touch.First) {
\r
2501 if (item === this._head) {
\r
2504 const next = item.next;
\r
2505 const previous = item.previous;
\r
2506 // Unlink the item
\r
2507 if (item === this._tail) {
\r
2508 // previous must be defined since item was not head but is tail
\r
2509 // So there are more than on item in the map
\r
2510 previous.next = undefined;
\r
2511 this._tail = previous;
\r
2514 // Both next and previous are not undefined since item was neither head nor tail.
\r
2515 next.previous = previous;
\r
2516 previous.next = next;
\r
2518 // Insert the node at head
\r
2519 item.previous = undefined;
\r
2520 item.next = this._head;
\r
2521 this._head.previous = item;
\r
2522 this._head = item;
\r
2524 else if (touch === Touch.Last) {
\r
2525 if (item === this._tail) {
\r
2528 const next = item.next;
\r
2529 const previous = item.previous;
\r
2530 // Unlink the item.
\r
2531 if (item === this._head) {
\r
2532 // next must be defined since item was not tail but is head
\r
2533 // So there are more than on item in the map
\r
2534 next.previous = undefined;
\r
2535 this._head = next;
\r
2538 // Both next and previous are not undefined since item was neither head nor tail.
\r
2539 next.previous = previous;
\r
2540 previous.next = next;
\r
2542 item.next = undefined;
\r
2543 item.previous = this._tail;
\r
2544 this._tail.next = item;
\r
2545 this._tail = item;
\r
2549 exports.LinkedMap = LinkedMap;
\r
2554 /***/ (function(module, exports, __webpack_require__) {
2557 /* --------------------------------------------------------------------------------------------
\r
2558 * Copyright (c) Microsoft Corporation. All rights reserved.
\r
2559 * Licensed under the MIT License. See License.txt in the project root for license information.
\r
2560 * ------------------------------------------------------------------------------------------ */
\r
2562 Object.defineProperty(exports, "__esModule", { value: true });
\r
2563 const path_1 = __webpack_require__(3);
\r
2564 const os_1 = __webpack_require__(14);
\r
2565 const crypto_1 = __webpack_require__(15);
\r
2566 const net_1 = __webpack_require__(16);
\r
2567 const messageReader_1 = __webpack_require__(8);
\r
2568 const messageWriter_1 = __webpack_require__(10);
\r
2569 function generateRandomPipeName() {
\r
2570 const randomSuffix = crypto_1.randomBytes(21).toString('hex');
\r
2571 if (process.platform === 'win32') {
\r
2572 return `\\\\.\\pipe\\vscode-jsonrpc-${randomSuffix}-sock`;
\r
2575 // Mac/Unix: use socket file
\r
2576 return path_1.join(os_1.tmpdir(), `vscode-${randomSuffix}.sock`);
\r
2579 exports.generateRandomPipeName = generateRandomPipeName;
\r
2580 function createClientPipeTransport(pipeName, encoding = 'utf-8') {
\r
2581 let connectResolve;
\r
2582 let connected = new Promise((resolve, _reject) => {
\r
2583 connectResolve = resolve;
\r
2585 return new Promise((resolve, reject) => {
\r
2586 let server = net_1.createServer((socket) => {
\r
2589 new messageReader_1.SocketMessageReader(socket, encoding),
\r
2590 new messageWriter_1.SocketMessageWriter(socket, encoding)
\r
2593 server.on('error', reject);
\r
2594 server.listen(pipeName, () => {
\r
2595 server.removeListener('error', reject);
\r
2597 onConnected: () => { return connected; }
\r
2602 exports.createClientPipeTransport = createClientPipeTransport;
\r
2603 function createServerPipeTransport(pipeName, encoding = 'utf-8') {
\r
2604 const socket = net_1.createConnection(pipeName);
\r
2606 new messageReader_1.SocketMessageReader(socket, encoding),
\r
2607 new messageWriter_1.SocketMessageWriter(socket, encoding)
\r
2610 exports.createServerPipeTransport = createServerPipeTransport;
\r
2615 /***/ (function(module, exports) {
2617 module.exports = require("os");
2621 /***/ (function(module, exports) {
2623 module.exports = require("crypto");
2627 /***/ (function(module, exports) {
2629 module.exports = require("net");
2633 /***/ (function(module, exports, __webpack_require__) {
2636 /* --------------------------------------------------------------------------------------------
\r
2637 * Copyright (c) Microsoft Corporation. All rights reserved.
\r
2638 * Licensed under the MIT License. See License.txt in the project root for license information.
\r
2639 * ------------------------------------------------------------------------------------------ */
\r
2641 Object.defineProperty(exports, "__esModule", { value: true });
\r
2642 const net_1 = __webpack_require__(16);
\r
2643 const messageReader_1 = __webpack_require__(8);
\r
2644 const messageWriter_1 = __webpack_require__(10);
\r
2645 function createClientSocketTransport(port, encoding = 'utf-8') {
\r
2646 let connectResolve;
\r
2647 let connected = new Promise((resolve, _reject) => {
\r
2648 connectResolve = resolve;
\r
2650 return new Promise((resolve, reject) => {
\r
2651 let server = net_1.createServer((socket) => {
\r
2654 new messageReader_1.SocketMessageReader(socket, encoding),
\r
2655 new messageWriter_1.SocketMessageWriter(socket, encoding)
\r
2658 server.on('error', reject);
\r
2659 server.listen(port, '127.0.0.1', () => {
\r
2660 server.removeListener('error', reject);
\r
2662 onConnected: () => { return connected; }
\r
2667 exports.createClientSocketTransport = createClientSocketTransport;
\r
2668 function createServerSocketTransport(port, encoding = 'utf-8') {
\r
2669 const socket = net_1.createConnection(port, '127.0.0.1');
\r
2671 new messageReader_1.SocketMessageReader(socket, encoding),
\r
2672 new messageWriter_1.SocketMessageWriter(socket, encoding)
\r
2675 exports.createServerSocketTransport = createServerSocketTransport;
\r
2680 /***/ (function(module, __webpack_exports__, __webpack_require__) {
2683 __webpack_require__.r(__webpack_exports__);
2684 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Position", function() { return Position; });
2685 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Range", function() { return Range; });
2686 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Location", function() { return Location; });
2687 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LocationLink", function() { return LocationLink; });
2688 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Color", function() { return Color; });
2689 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ColorInformation", function() { return ColorInformation; });
2690 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ColorPresentation", function() { return ColorPresentation; });
2691 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FoldingRangeKind", function() { return FoldingRangeKind; });
2692 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FoldingRange", function() { return FoldingRange; });
2693 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DiagnosticRelatedInformation", function() { return DiagnosticRelatedInformation; });
2694 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DiagnosticSeverity", function() { return DiagnosticSeverity; });
2695 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DiagnosticTag", function() { return DiagnosticTag; });
2696 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Diagnostic", function() { return Diagnostic; });
2697 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Command", function() { return Command; });
2698 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TextEdit", function() { return TextEdit; });
2699 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TextDocumentEdit", function() { return TextDocumentEdit; });
2700 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CreateFile", function() { return CreateFile; });
2701 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RenameFile", function() { return RenameFile; });
2702 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DeleteFile", function() { return DeleteFile; });
2703 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "WorkspaceEdit", function() { return WorkspaceEdit; });
2704 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "WorkspaceChange", function() { return WorkspaceChange; });
2705 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TextDocumentIdentifier", function() { return TextDocumentIdentifier; });
2706 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "VersionedTextDocumentIdentifier", function() { return VersionedTextDocumentIdentifier; });
2707 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TextDocumentItem", function() { return TextDocumentItem; });
2708 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MarkupKind", function() { return MarkupKind; });
2709 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MarkupContent", function() { return MarkupContent; });
2710 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CompletionItemKind", function() { return CompletionItemKind; });
2711 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "InsertTextFormat", function() { return InsertTextFormat; });
2712 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CompletionItemTag", function() { return CompletionItemTag; });
2713 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CompletionItem", function() { return CompletionItem; });
2714 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CompletionList", function() { return CompletionList; });
2715 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MarkedString", function() { return MarkedString; });
2716 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Hover", function() { return Hover; });
2717 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ParameterInformation", function() { return ParameterInformation; });
2718 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SignatureInformation", function() { return SignatureInformation; });
2719 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DocumentHighlightKind", function() { return DocumentHighlightKind; });
2720 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DocumentHighlight", function() { return DocumentHighlight; });
2721 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SymbolKind", function() { return SymbolKind; });
2722 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SymbolTag", function() { return SymbolTag; });
2723 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SymbolInformation", function() { return SymbolInformation; });
2724 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DocumentSymbol", function() { return DocumentSymbol; });
2725 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CodeActionKind", function() { return CodeActionKind; });
2726 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CodeActionContext", function() { return CodeActionContext; });
2727 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CodeAction", function() { return CodeAction; });
2728 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CodeLens", function() { return CodeLens; });
2729 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FormattingOptions", function() { return FormattingOptions; });
2730 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DocumentLink", function() { return DocumentLink; });
2731 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SelectionRange", function() { return SelectionRange; });
2732 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "EOL", function() { return EOL; });
2733 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TextDocument", function() { return TextDocument; });
2734 /* --------------------------------------------------------------------------------------------
\r
2735 * Copyright (c) Microsoft Corporation. All rights reserved.
\r
2736 * Licensed under the MIT License. See License.txt in the project root for license information.
\r
2737 * ------------------------------------------------------------------------------------------ */
\r
2740 * The Position namespace provides helper functions to work with
\r
2741 * [Position](#Position) literals.
\r
2744 (function (Position) {
\r
2746 * Creates a new Position literal from the given line and character.
\r
2747 * @param line The position's line.
\r
2748 * @param character The position's character.
\r
2750 function create(line, character) {
\r
2751 return { line: line, character: character };
\r
2753 Position.create = create;
\r
2755 * Checks whether the given liternal conforms to the [Position](#Position) interface.
\r
2757 function is(value) {
\r
2758 var candidate = value;
\r
2759 return Is.objectLiteral(candidate) && Is.number(candidate.line) && Is.number(candidate.character);
\r
2762 })(Position || (Position = {}));
\r
2764 * The Range namespace provides helper functions to work with
\r
2765 * [Range](#Range) literals.
\r
2768 (function (Range) {
\r
2769 function create(one, two, three, four) {
\r
2770 if (Is.number(one) && Is.number(two) && Is.number(three) && Is.number(four)) {
\r
2771 return { start: Position.create(one, two), end: Position.create(three, four) };
\r
2773 else if (Position.is(one) && Position.is(two)) {
\r
2774 return { start: one, end: two };
\r
2777 throw new Error("Range#create called with invalid arguments[" + one + ", " + two + ", " + three + ", " + four + "]");
\r
2780 Range.create = create;
\r
2782 * Checks whether the given literal conforms to the [Range](#Range) interface.
\r
2784 function is(value) {
\r
2785 var candidate = value;
\r
2786 return Is.objectLiteral(candidate) && Position.is(candidate.start) && Position.is(candidate.end);
\r
2789 })(Range || (Range = {}));
\r
2791 * The Location namespace provides helper functions to work with
\r
2792 * [Location](#Location) literals.
\r
2795 (function (Location) {
\r
2797 * Creates a Location literal.
\r
2798 * @param uri The location's uri.
\r
2799 * @param range The location's range.
\r
2801 function create(uri, range) {
\r
2802 return { uri: uri, range: range };
\r
2804 Location.create = create;
\r
2806 * Checks whether the given literal conforms to the [Location](#Location) interface.
\r
2808 function is(value) {
\r
2809 var candidate = value;
\r
2810 return Is.defined(candidate) && Range.is(candidate.range) && (Is.string(candidate.uri) || Is.undefined(candidate.uri));
\r
2813 })(Location || (Location = {}));
\r
2815 * The LocationLink namespace provides helper functions to work with
\r
2816 * [LocationLink](#LocationLink) literals.
\r
2819 (function (LocationLink) {
\r
2821 * Creates a LocationLink literal.
\r
2822 * @param targetUri The definition's uri.
\r
2823 * @param targetRange The full range of the definition.
\r
2824 * @param targetSelectionRange The span of the symbol definition at the target.
\r
2825 * @param originSelectionRange The span of the symbol being defined in the originating source file.
\r
2827 function create(targetUri, targetRange, targetSelectionRange, originSelectionRange) {
\r
2828 return { targetUri: targetUri, targetRange: targetRange, targetSelectionRange: targetSelectionRange, originSelectionRange: originSelectionRange };
\r
2830 LocationLink.create = create;
\r
2832 * Checks whether the given literal conforms to the [LocationLink](#LocationLink) interface.
\r
2834 function is(value) {
\r
2835 var candidate = value;
\r
2836 return Is.defined(candidate) && Range.is(candidate.targetRange) && Is.string(candidate.targetUri)
\r
2837 && (Range.is(candidate.targetSelectionRange) || Is.undefined(candidate.targetSelectionRange))
\r
2838 && (Range.is(candidate.originSelectionRange) || Is.undefined(candidate.originSelectionRange));
\r
2840 LocationLink.is = is;
\r
2841 })(LocationLink || (LocationLink = {}));
\r
2843 * The Color namespace provides helper functions to work with
\r
2844 * [Color](#Color) literals.
\r
2847 (function (Color) {
\r
2849 * Creates a new Color literal.
\r
2851 function create(red, green, blue, alpha) {
\r
2859 Color.create = create;
\r
2861 * Checks whether the given literal conforms to the [Color](#Color) interface.
\r
2863 function is(value) {
\r
2864 var candidate = value;
\r
2865 return Is.number(candidate.red)
\r
2866 && Is.number(candidate.green)
\r
2867 && Is.number(candidate.blue)
\r
2868 && Is.number(candidate.alpha);
\r
2871 })(Color || (Color = {}));
\r
2873 * The ColorInformation namespace provides helper functions to work with
\r
2874 * [ColorInformation](#ColorInformation) literals.
\r
2876 var ColorInformation;
\r
2877 (function (ColorInformation) {
\r
2879 * Creates a new ColorInformation literal.
\r
2881 function create(range, color) {
\r
2887 ColorInformation.create = create;
\r
2889 * Checks whether the given literal conforms to the [ColorInformation](#ColorInformation) interface.
\r
2891 function is(value) {
\r
2892 var candidate = value;
\r
2893 return Range.is(candidate.range) && Color.is(candidate.color);
\r
2895 ColorInformation.is = is;
\r
2896 })(ColorInformation || (ColorInformation = {}));
\r
2898 * The Color namespace provides helper functions to work with
\r
2899 * [ColorPresentation](#ColorPresentation) literals.
\r
2901 var ColorPresentation;
\r
2902 (function (ColorPresentation) {
\r
2904 * Creates a new ColorInformation literal.
\r
2906 function create(label, textEdit, additionalTextEdits) {
\r
2909 textEdit: textEdit,
\r
2910 additionalTextEdits: additionalTextEdits,
\r
2913 ColorPresentation.create = create;
\r
2915 * Checks whether the given literal conforms to the [ColorInformation](#ColorInformation) interface.
\r
2917 function is(value) {
\r
2918 var candidate = value;
\r
2919 return Is.string(candidate.label)
\r
2920 && (Is.undefined(candidate.textEdit) || TextEdit.is(candidate))
\r
2921 && (Is.undefined(candidate.additionalTextEdits) || Is.typedArray(candidate.additionalTextEdits, TextEdit.is));
\r
2923 ColorPresentation.is = is;
\r
2924 })(ColorPresentation || (ColorPresentation = {}));
\r
2926 * Enum of known range kinds
\r
2928 var FoldingRangeKind;
\r
2929 (function (FoldingRangeKind) {
\r
2931 * Folding range for a comment
\r
2933 FoldingRangeKind["Comment"] = "comment";
\r
2935 * Folding range for a imports or includes
\r
2937 FoldingRangeKind["Imports"] = "imports";
\r
2939 * Folding range for a region (e.g. `#region`)
\r
2941 FoldingRangeKind["Region"] = "region";
\r
2942 })(FoldingRangeKind || (FoldingRangeKind = {}));
\r
2944 * The folding range namespace provides helper functions to work with
\r
2945 * [FoldingRange](#FoldingRange) literals.
\r
2948 (function (FoldingRange) {
\r
2950 * Creates a new FoldingRange literal.
\r
2952 function create(startLine, endLine, startCharacter, endCharacter, kind) {
\r
2954 startLine: startLine,
\r
2957 if (Is.defined(startCharacter)) {
\r
2958 result.startCharacter = startCharacter;
\r
2960 if (Is.defined(endCharacter)) {
\r
2961 result.endCharacter = endCharacter;
\r
2963 if (Is.defined(kind)) {
\r
2964 result.kind = kind;
\r
2968 FoldingRange.create = create;
\r
2970 * Checks whether the given literal conforms to the [FoldingRange](#FoldingRange) interface.
\r
2972 function is(value) {
\r
2973 var candidate = value;
\r
2974 return Is.number(candidate.startLine) && Is.number(candidate.startLine)
\r
2975 && (Is.undefined(candidate.startCharacter) || Is.number(candidate.startCharacter))
\r
2976 && (Is.undefined(candidate.endCharacter) || Is.number(candidate.endCharacter))
\r
2977 && (Is.undefined(candidate.kind) || Is.string(candidate.kind));
\r
2979 FoldingRange.is = is;
\r
2980 })(FoldingRange || (FoldingRange = {}));
\r
2982 * The DiagnosticRelatedInformation namespace provides helper functions to work with
\r
2983 * [DiagnosticRelatedInformation](#DiagnosticRelatedInformation) literals.
\r
2985 var DiagnosticRelatedInformation;
\r
2986 (function (DiagnosticRelatedInformation) {
\r
2988 * Creates a new DiagnosticRelatedInformation literal.
\r
2990 function create(location, message) {
\r
2992 location: location,
\r
2996 DiagnosticRelatedInformation.create = create;
\r
2998 * Checks whether the given literal conforms to the [DiagnosticRelatedInformation](#DiagnosticRelatedInformation) interface.
\r
3000 function is(value) {
\r
3001 var candidate = value;
\r
3002 return Is.defined(candidate) && Location.is(candidate.location) && Is.string(candidate.message);
\r
3004 DiagnosticRelatedInformation.is = is;
\r
3005 })(DiagnosticRelatedInformation || (DiagnosticRelatedInformation = {}));
\r
3007 * The diagnostic's severity.
\r
3009 var DiagnosticSeverity;
\r
3010 (function (DiagnosticSeverity) {
\r
3012 * Reports an error.
\r
3014 DiagnosticSeverity.Error = 1;
\r
3016 * Reports a warning.
\r
3018 DiagnosticSeverity.Warning = 2;
\r
3020 * Reports an information.
\r
3022 DiagnosticSeverity.Information = 3;
\r
3026 DiagnosticSeverity.Hint = 4;
\r
3027 })(DiagnosticSeverity || (DiagnosticSeverity = {}));
\r
3029 * The diagnostic tags.
\r
3033 var DiagnosticTag;
\r
3034 (function (DiagnosticTag) {
\r
3036 * Unused or unnecessary code.
\r
3038 * Clients are allowed to render diagnostics with this tag faded out instead of having
\r
3039 * an error squiggle.
\r
3041 DiagnosticTag.Unnecessary = 1;
\r
3043 * Deprecated or obsolete code.
\r
3045 * Clients are allowed to rendered diagnostics with this tag strike through.
\r
3047 DiagnosticTag.Deprecated = 2;
\r
3048 })(DiagnosticTag || (DiagnosticTag = {}));
\r
3050 * The Diagnostic namespace provides helper functions to work with
\r
3051 * [Diagnostic](#Diagnostic) literals.
\r
3054 (function (Diagnostic) {
\r
3056 * Creates a new Diagnostic literal.
\r
3058 function create(range, message, severity, code, source, relatedInformation) {
\r
3059 var result = { range: range, message: message };
\r
3060 if (Is.defined(severity)) {
\r
3061 result.severity = severity;
\r
3063 if (Is.defined(code)) {
\r
3064 result.code = code;
\r
3066 if (Is.defined(source)) {
\r
3067 result.source = source;
\r
3069 if (Is.defined(relatedInformation)) {
\r
3070 result.relatedInformation = relatedInformation;
\r
3074 Diagnostic.create = create;
\r
3076 * Checks whether the given literal conforms to the [Diagnostic](#Diagnostic) interface.
\r
3078 function is(value) {
\r
3079 var candidate = value;
\r
3080 return Is.defined(candidate)
\r
3081 && Range.is(candidate.range)
\r
3082 && Is.string(candidate.message)
\r
3083 && (Is.number(candidate.severity) || Is.undefined(candidate.severity))
\r
3084 && (Is.number(candidate.code) || Is.string(candidate.code) || Is.undefined(candidate.code))
\r
3085 && (Is.string(candidate.source) || Is.undefined(candidate.source))
\r
3086 && (Is.undefined(candidate.relatedInformation) || Is.typedArray(candidate.relatedInformation, DiagnosticRelatedInformation.is));
\r
3088 Diagnostic.is = is;
\r
3089 })(Diagnostic || (Diagnostic = {}));
\r
3091 * The Command namespace provides helper functions to work with
\r
3092 * [Command](#Command) literals.
\r
3095 (function (Command) {
\r
3097 * Creates a new Command literal.
\r
3099 function create(title, command) {
\r
3101 for (var _i = 2; _i < arguments.length; _i++) {
\r
3102 args[_i - 2] = arguments[_i];
\r
3104 var result = { title: title, command: command };
\r
3105 if (Is.defined(args) && args.length > 0) {
\r
3106 result.arguments = args;
\r
3110 Command.create = create;
\r
3112 * Checks whether the given literal conforms to the [Command](#Command) interface.
\r
3114 function is(value) {
\r
3115 var candidate = value;
\r
3116 return Is.defined(candidate) && Is.string(candidate.title) && Is.string(candidate.command);
\r
3119 })(Command || (Command = {}));
\r
3121 * The TextEdit namespace provides helper function to create replace,
\r
3122 * insert and delete edits more easily.
\r
3125 (function (TextEdit) {
\r
3127 * Creates a replace text edit.
\r
3128 * @param range The range of text to be replaced.
\r
3129 * @param newText The new text.
\r
3131 function replace(range, newText) {
\r
3132 return { range: range, newText: newText };
\r
3134 TextEdit.replace = replace;
\r
3136 * Creates a insert text edit.
\r
3137 * @param position The position to insert the text at.
\r
3138 * @param newText The text to be inserted.
\r
3140 function insert(position, newText) {
\r
3141 return { range: { start: position, end: position }, newText: newText };
\r
3143 TextEdit.insert = insert;
\r
3145 * Creates a delete text edit.
\r
3146 * @param range The range of text to be deleted.
\r
3148 function del(range) {
\r
3149 return { range: range, newText: '' };
\r
3151 TextEdit.del = del;
\r
3152 function is(value) {
\r
3153 var candidate = value;
\r
3154 return Is.objectLiteral(candidate)
\r
3155 && Is.string(candidate.newText)
\r
3156 && Range.is(candidate.range);
\r
3159 })(TextEdit || (TextEdit = {}));
\r
3161 * The TextDocumentEdit namespace provides helper function to create
\r
3162 * an edit that manipulates a text document.
\r
3164 var TextDocumentEdit;
\r
3165 (function (TextDocumentEdit) {
\r
3167 * Creates a new `TextDocumentEdit`
\r
3169 function create(textDocument, edits) {
\r
3170 return { textDocument: textDocument, edits: edits };
\r
3172 TextDocumentEdit.create = create;
\r
3173 function is(value) {
\r
3174 var candidate = value;
\r
3175 return Is.defined(candidate)
\r
3176 && VersionedTextDocumentIdentifier.is(candidate.textDocument)
\r
3177 && Array.isArray(candidate.edits);
\r
3179 TextDocumentEdit.is = is;
\r
3180 })(TextDocumentEdit || (TextDocumentEdit = {}));
\r
3182 (function (CreateFile) {
\r
3183 function create(uri, options) {
\r
3188 if (options !== void 0 && (options.overwrite !== void 0 || options.ignoreIfExists !== void 0)) {
\r
3189 result.options = options;
\r
3193 CreateFile.create = create;
\r
3194 function is(value) {
\r
3195 var candidate = value;
\r
3196 return candidate && candidate.kind === 'create' && Is.string(candidate.uri) &&
\r
3197 (candidate.options === void 0 ||
\r
3198 ((candidate.options.overwrite === void 0 || Is.boolean(candidate.options.overwrite)) && (candidate.options.ignoreIfExists === void 0 || Is.boolean(candidate.options.ignoreIfExists))));
\r
3200 CreateFile.is = is;
\r
3201 })(CreateFile || (CreateFile = {}));
\r
3203 (function (RenameFile) {
\r
3204 function create(oldUri, newUri, options) {
\r
3210 if (options !== void 0 && (options.overwrite !== void 0 || options.ignoreIfExists !== void 0)) {
\r
3211 result.options = options;
\r
3215 RenameFile.create = create;
\r
3216 function is(value) {
\r
3217 var candidate = value;
\r
3218 return candidate && candidate.kind === 'rename' && Is.string(candidate.oldUri) && Is.string(candidate.newUri) &&
\r
3219 (candidate.options === void 0 ||
\r
3220 ((candidate.options.overwrite === void 0 || Is.boolean(candidate.options.overwrite)) && (candidate.options.ignoreIfExists === void 0 || Is.boolean(candidate.options.ignoreIfExists))));
\r
3222 RenameFile.is = is;
\r
3223 })(RenameFile || (RenameFile = {}));
\r
3225 (function (DeleteFile) {
\r
3226 function create(uri, options) {
\r
3231 if (options !== void 0 && (options.recursive !== void 0 || options.ignoreIfNotExists !== void 0)) {
\r
3232 result.options = options;
\r
3236 DeleteFile.create = create;
\r
3237 function is(value) {
\r
3238 var candidate = value;
\r
3239 return candidate && candidate.kind === 'delete' && Is.string(candidate.uri) &&
\r
3240 (candidate.options === void 0 ||
\r
3241 ((candidate.options.recursive === void 0 || Is.boolean(candidate.options.recursive)) && (candidate.options.ignoreIfNotExists === void 0 || Is.boolean(candidate.options.ignoreIfNotExists))));
\r
3243 DeleteFile.is = is;
\r
3244 })(DeleteFile || (DeleteFile = {}));
\r
3245 var WorkspaceEdit;
\r
3246 (function (WorkspaceEdit) {
\r
3247 function is(value) {
\r
3248 var candidate = value;
\r
3249 return candidate &&
\r
3250 (candidate.changes !== void 0 || candidate.documentChanges !== void 0) &&
\r
3251 (candidate.documentChanges === void 0 || candidate.documentChanges.every(function (change) {
\r
3252 if (Is.string(change.kind)) {
\r
3253 return CreateFile.is(change) || RenameFile.is(change) || DeleteFile.is(change);
\r
3256 return TextDocumentEdit.is(change);
\r
3260 WorkspaceEdit.is = is;
\r
3261 })(WorkspaceEdit || (WorkspaceEdit = {}));
\r
3262 var TextEditChangeImpl = /** @class */ (function () {
\r
3263 function TextEditChangeImpl(edits) {
\r
3264 this.edits = edits;
\r
3266 TextEditChangeImpl.prototype.insert = function (position, newText) {
\r
3267 this.edits.push(TextEdit.insert(position, newText));
\r
3269 TextEditChangeImpl.prototype.replace = function (range, newText) {
\r
3270 this.edits.push(TextEdit.replace(range, newText));
\r
3272 TextEditChangeImpl.prototype.delete = function (range) {
\r
3273 this.edits.push(TextEdit.del(range));
\r
3275 TextEditChangeImpl.prototype.add = function (edit) {
\r
3276 this.edits.push(edit);
\r
3278 TextEditChangeImpl.prototype.all = function () {
\r
3279 return this.edits;
\r
3281 TextEditChangeImpl.prototype.clear = function () {
\r
3282 this.edits.splice(0, this.edits.length);
\r
3284 return TextEditChangeImpl;
\r
3287 * A workspace change helps constructing changes to a workspace.
\r
3289 var WorkspaceChange = /** @class */ (function () {
\r
3290 function WorkspaceChange(workspaceEdit) {
\r
3292 this._textEditChanges = Object.create(null);
\r
3293 if (workspaceEdit) {
\r
3294 this._workspaceEdit = workspaceEdit;
\r
3295 if (workspaceEdit.documentChanges) {
\r
3296 workspaceEdit.documentChanges.forEach(function (change) {
\r
3297 if (TextDocumentEdit.is(change)) {
\r
3298 var textEditChange = new TextEditChangeImpl(change.edits);
\r
3299 _this._textEditChanges[change.textDocument.uri] = textEditChange;
\r
3303 else if (workspaceEdit.changes) {
\r
3304 Object.keys(workspaceEdit.changes).forEach(function (key) {
\r
3305 var textEditChange = new TextEditChangeImpl(workspaceEdit.changes[key]);
\r
3306 _this._textEditChanges[key] = textEditChange;
\r
3311 Object.defineProperty(WorkspaceChange.prototype, "edit", {
\r
3313 * Returns the underlying [WorkspaceEdit](#WorkspaceEdit) literal
\r
3314 * use to be returned from a workspace edit operation like rename.
\r
3316 get: function () {
\r
3317 return this._workspaceEdit;
\r
3320 configurable: true
\r
3322 WorkspaceChange.prototype.getTextEditChange = function (key) {
\r
3323 if (VersionedTextDocumentIdentifier.is(key)) {
\r
3324 if (!this._workspaceEdit) {
\r
3325 this._workspaceEdit = {
\r
3326 documentChanges: []
\r
3329 if (!this._workspaceEdit.documentChanges) {
\r
3330 throw new Error('Workspace edit is not configured for document changes.');
\r
3332 var textDocument = key;
\r
3333 var result = this._textEditChanges[textDocument.uri];
\r
3336 var textDocumentEdit = {
\r
3337 textDocument: textDocument,
\r
3340 this._workspaceEdit.documentChanges.push(textDocumentEdit);
\r
3341 result = new TextEditChangeImpl(edits);
\r
3342 this._textEditChanges[textDocument.uri] = result;
\r
3347 if (!this._workspaceEdit) {
\r
3348 this._workspaceEdit = {
\r
3349 changes: Object.create(null)
\r
3352 if (!this._workspaceEdit.changes) {
\r
3353 throw new Error('Workspace edit is not configured for normal text edit changes.');
\r
3355 var result = this._textEditChanges[key];
\r
3358 this._workspaceEdit.changes[key] = edits;
\r
3359 result = new TextEditChangeImpl(edits);
\r
3360 this._textEditChanges[key] = result;
\r
3365 WorkspaceChange.prototype.createFile = function (uri, options) {
\r
3366 this.checkDocumentChanges();
\r
3367 this._workspaceEdit.documentChanges.push(CreateFile.create(uri, options));
\r
3369 WorkspaceChange.prototype.renameFile = function (oldUri, newUri, options) {
\r
3370 this.checkDocumentChanges();
\r
3371 this._workspaceEdit.documentChanges.push(RenameFile.create(oldUri, newUri, options));
\r
3373 WorkspaceChange.prototype.deleteFile = function (uri, options) {
\r
3374 this.checkDocumentChanges();
\r
3375 this._workspaceEdit.documentChanges.push(DeleteFile.create(uri, options));
\r
3377 WorkspaceChange.prototype.checkDocumentChanges = function () {
\r
3378 if (!this._workspaceEdit || !this._workspaceEdit.documentChanges) {
\r
3379 throw new Error('Workspace edit is not configured for document changes.');
\r
3382 return WorkspaceChange;
\r
3386 * The TextDocumentIdentifier namespace provides helper functions to work with
\r
3387 * [TextDocumentIdentifier](#TextDocumentIdentifier) literals.
\r
3389 var TextDocumentIdentifier;
\r
3390 (function (TextDocumentIdentifier) {
\r
3392 * Creates a new TextDocumentIdentifier literal.
\r
3393 * @param uri The document's uri.
\r
3395 function create(uri) {
\r
3396 return { uri: uri };
\r
3398 TextDocumentIdentifier.create = create;
\r
3400 * Checks whether the given literal conforms to the [TextDocumentIdentifier](#TextDocumentIdentifier) interface.
\r
3402 function is(value) {
\r
3403 var candidate = value;
\r
3404 return Is.defined(candidate) && Is.string(candidate.uri);
\r
3406 TextDocumentIdentifier.is = is;
\r
3407 })(TextDocumentIdentifier || (TextDocumentIdentifier = {}));
\r
3409 * The VersionedTextDocumentIdentifier namespace provides helper functions to work with
\r
3410 * [VersionedTextDocumentIdentifier](#VersionedTextDocumentIdentifier) literals.
\r
3412 var VersionedTextDocumentIdentifier;
\r
3413 (function (VersionedTextDocumentIdentifier) {
\r
3415 * Creates a new VersionedTextDocumentIdentifier literal.
\r
3416 * @param uri The document's uri.
\r
3417 * @param uri The document's text.
\r
3419 function create(uri, version) {
\r
3420 return { uri: uri, version: version };
\r
3422 VersionedTextDocumentIdentifier.create = create;
\r
3424 * Checks whether the given literal conforms to the [VersionedTextDocumentIdentifier](#VersionedTextDocumentIdentifier) interface.
\r
3426 function is(value) {
\r
3427 var candidate = value;
\r
3428 return Is.defined(candidate) && Is.string(candidate.uri) && (candidate.version === null || Is.number(candidate.version));
\r
3430 VersionedTextDocumentIdentifier.is = is;
\r
3431 })(VersionedTextDocumentIdentifier || (VersionedTextDocumentIdentifier = {}));
\r
3433 * The TextDocumentItem namespace provides helper functions to work with
\r
3434 * [TextDocumentItem](#TextDocumentItem) literals.
\r
3436 var TextDocumentItem;
\r
3437 (function (TextDocumentItem) {
\r
3439 * Creates a new TextDocumentItem literal.
\r
3440 * @param uri The document's uri.
\r
3441 * @param languageId The document's language identifier.
\r
3442 * @param version The document's version number.
\r
3443 * @param text The document's text.
\r
3445 function create(uri, languageId, version, text) {
\r
3446 return { uri: uri, languageId: languageId, version: version, text: text };
\r
3448 TextDocumentItem.create = create;
\r
3450 * Checks whether the given literal conforms to the [TextDocumentItem](#TextDocumentItem) interface.
\r
3452 function is(value) {
\r
3453 var candidate = value;
\r
3454 return Is.defined(candidate) && Is.string(candidate.uri) && Is.string(candidate.languageId) && Is.number(candidate.version) && Is.string(candidate.text);
\r
3456 TextDocumentItem.is = is;
\r
3457 })(TextDocumentItem || (TextDocumentItem = {}));
\r
3459 * Describes the content type that a client supports in various
\r
3460 * result literals like `Hover`, `ParameterInfo` or `CompletionItem`.
\r
3462 * Please note that `MarkupKinds` must not start with a `$`. This kinds
\r
3463 * are reserved for internal usage.
\r
3466 (function (MarkupKind) {
\r
3468 * Plain text is supported as a content format
\r
3470 MarkupKind.PlainText = 'plaintext';
\r
3472 * Markdown is supported as a content format
\r
3474 MarkupKind.Markdown = 'markdown';
\r
3475 })(MarkupKind || (MarkupKind = {}));
\r
3476 (function (MarkupKind) {
\r
3478 * Checks whether the given value is a value of the [MarkupKind](#MarkupKind) type.
\r
3480 function is(value) {
\r
3481 var candidate = value;
\r
3482 return candidate === MarkupKind.PlainText || candidate === MarkupKind.Markdown;
\r
3484 MarkupKind.is = is;
\r
3485 })(MarkupKind || (MarkupKind = {}));
\r
3486 var MarkupContent;
\r
3487 (function (MarkupContent) {
\r
3489 * Checks whether the given value conforms to the [MarkupContent](#MarkupContent) interface.
\r
3491 function is(value) {
\r
3492 var candidate = value;
\r
3493 return Is.objectLiteral(value) && MarkupKind.is(candidate.kind) && Is.string(candidate.value);
\r
3495 MarkupContent.is = is;
\r
3496 })(MarkupContent || (MarkupContent = {}));
\r
3498 * The kind of a completion entry.
\r
3500 var CompletionItemKind;
\r
3501 (function (CompletionItemKind) {
\r
3502 CompletionItemKind.Text = 1;
\r
3503 CompletionItemKind.Method = 2;
\r
3504 CompletionItemKind.Function = 3;
\r
3505 CompletionItemKind.Constructor = 4;
\r
3506 CompletionItemKind.Field = 5;
\r
3507 CompletionItemKind.Variable = 6;
\r
3508 CompletionItemKind.Class = 7;
\r
3509 CompletionItemKind.Interface = 8;
\r
3510 CompletionItemKind.Module = 9;
\r
3511 CompletionItemKind.Property = 10;
\r
3512 CompletionItemKind.Unit = 11;
\r
3513 CompletionItemKind.Value = 12;
\r
3514 CompletionItemKind.Enum = 13;
\r
3515 CompletionItemKind.Keyword = 14;
\r
3516 CompletionItemKind.Snippet = 15;
\r
3517 CompletionItemKind.Color = 16;
\r
3518 CompletionItemKind.File = 17;
\r
3519 CompletionItemKind.Reference = 18;
\r
3520 CompletionItemKind.Folder = 19;
\r
3521 CompletionItemKind.EnumMember = 20;
\r
3522 CompletionItemKind.Constant = 21;
\r
3523 CompletionItemKind.Struct = 22;
\r
3524 CompletionItemKind.Event = 23;
\r
3525 CompletionItemKind.Operator = 24;
\r
3526 CompletionItemKind.TypeParameter = 25;
\r
3527 })(CompletionItemKind || (CompletionItemKind = {}));
\r
3529 * Defines whether the insert text in a completion item should be interpreted as
\r
3530 * plain text or a snippet.
\r
3532 var InsertTextFormat;
\r
3533 (function (InsertTextFormat) {
\r
3535 * The primary text to be inserted is treated as a plain string.
\r
3537 InsertTextFormat.PlainText = 1;
\r
3539 * The primary text to be inserted is treated as a snippet.
\r
3541 * A snippet can define tab stops and placeholders with `$1`, `$2`
\r
3542 * and `${3:foo}`. `$0` defines the final tab stop, it defaults to
\r
3543 * the end of the snippet. Placeholders with equal identifiers are linked,
\r
3544 * that is typing in one will update others too.
\r
3546 * See also: https://github.com/Microsoft/vscode/blob/master/src/vs/editor/contrib/snippet/common/snippet.md
\r
3548 InsertTextFormat.Snippet = 2;
\r
3549 })(InsertTextFormat || (InsertTextFormat = {}));
\r
3551 * Completion item tags are extra annotations that tweak the rendering of a completion
\r
3556 var CompletionItemTag;
\r
3557 (function (CompletionItemTag) {
\r
3559 * Render a completion as obsolete, usually using a strike-out.
\r
3561 CompletionItemTag.Deprecated = 1;
\r
3562 })(CompletionItemTag || (CompletionItemTag = {}));
\r
3564 * The CompletionItem namespace provides functions to deal with
\r
3565 * completion items.
\r
3567 var CompletionItem;
\r
3568 (function (CompletionItem) {
\r
3570 * Create a completion item and seed it with a label.
\r
3571 * @param label The completion item's label
\r
3573 function create(label) {
\r
3574 return { label: label };
\r
3576 CompletionItem.create = create;
\r
3577 })(CompletionItem || (CompletionItem = {}));
\r
3579 * The CompletionList namespace provides functions to deal with
\r
3580 * completion lists.
\r
3582 var CompletionList;
\r
3583 (function (CompletionList) {
\r
3585 * Creates a new completion list.
\r
3587 * @param items The completion items.
\r
3588 * @param isIncomplete The list is not complete.
\r
3590 function create(items, isIncomplete) {
\r
3591 return { items: items ? items : [], isIncomplete: !!isIncomplete };
\r
3593 CompletionList.create = create;
\r
3594 })(CompletionList || (CompletionList = {}));
\r
3596 (function (MarkedString) {
\r
3598 * Creates a marked string from plain text.
\r
3600 * @param plainText The plain text.
\r
3602 function fromPlainText(plainText) {
\r
3603 return plainText.replace(/[\\`*_{}[\]()#+\-.!]/g, '\\$&'); // escape markdown syntax tokens: http://daringfireball.net/projects/markdown/syntax#backslash
\r
3605 MarkedString.fromPlainText = fromPlainText;
\r
3607 * Checks whether the given value conforms to the [MarkedString](#MarkedString) type.
\r
3609 function is(value) {
\r
3610 var candidate = value;
\r
3611 return Is.string(candidate) || (Is.objectLiteral(candidate) && Is.string(candidate.language) && Is.string(candidate.value));
\r
3613 MarkedString.is = is;
\r
3614 })(MarkedString || (MarkedString = {}));
\r
3616 (function (Hover) {
\r
3618 * Checks whether the given value conforms to the [Hover](#Hover) interface.
\r
3620 function is(value) {
\r
3621 var candidate = value;
\r
3622 return !!candidate && Is.objectLiteral(candidate) && (MarkupContent.is(candidate.contents) ||
\r
3623 MarkedString.is(candidate.contents) ||
\r
3624 Is.typedArray(candidate.contents, MarkedString.is)) && (value.range === void 0 || Range.is(value.range));
\r
3627 })(Hover || (Hover = {}));
\r
3629 * The ParameterInformation namespace provides helper functions to work with
\r
3630 * [ParameterInformation](#ParameterInformation) literals.
\r
3632 var ParameterInformation;
\r
3633 (function (ParameterInformation) {
\r
3635 * Creates a new parameter information literal.
\r
3637 * @param label A label string.
\r
3638 * @param documentation A doc string.
\r
3640 function create(label, documentation) {
\r
3641 return documentation ? { label: label, documentation: documentation } : { label: label };
\r
3643 ParameterInformation.create = create;
\r
3644 })(ParameterInformation || (ParameterInformation = {}));
\r
3646 * The SignatureInformation namespace provides helper functions to work with
\r
3647 * [SignatureInformation](#SignatureInformation) literals.
\r
3649 var SignatureInformation;
\r
3650 (function (SignatureInformation) {
\r
3651 function create(label, documentation) {
\r
3652 var parameters = [];
\r
3653 for (var _i = 2; _i < arguments.length; _i++) {
\r
3654 parameters[_i - 2] = arguments[_i];
\r
3656 var result = { label: label };
\r
3657 if (Is.defined(documentation)) {
\r
3658 result.documentation = documentation;
\r
3660 if (Is.defined(parameters)) {
\r
3661 result.parameters = parameters;
\r
3664 result.parameters = [];
\r
3668 SignatureInformation.create = create;
\r
3669 })(SignatureInformation || (SignatureInformation = {}));
\r
3671 * A document highlight kind.
\r
3673 var DocumentHighlightKind;
\r
3674 (function (DocumentHighlightKind) {
\r
3676 * A textual occurrence.
\r
3678 DocumentHighlightKind.Text = 1;
\r
3680 * Read-access of a symbol, like reading a variable.
\r
3682 DocumentHighlightKind.Read = 2;
\r
3684 * Write-access of a symbol, like writing to a variable.
\r
3686 DocumentHighlightKind.Write = 3;
\r
3687 })(DocumentHighlightKind || (DocumentHighlightKind = {}));
\r
3689 * DocumentHighlight namespace to provide helper functions to work with
\r
3690 * [DocumentHighlight](#DocumentHighlight) literals.
\r
3692 var DocumentHighlight;
\r
3693 (function (DocumentHighlight) {
\r
3695 * Create a DocumentHighlight object.
\r
3696 * @param range The range the highlight applies to.
\r
3698 function create(range, kind) {
\r
3699 var result = { range: range };
\r
3700 if (Is.number(kind)) {
\r
3701 result.kind = kind;
\r
3705 DocumentHighlight.create = create;
\r
3706 })(DocumentHighlight || (DocumentHighlight = {}));
\r
3711 (function (SymbolKind) {
\r
3712 SymbolKind.File = 1;
\r
3713 SymbolKind.Module = 2;
\r
3714 SymbolKind.Namespace = 3;
\r
3715 SymbolKind.Package = 4;
\r
3716 SymbolKind.Class = 5;
\r
3717 SymbolKind.Method = 6;
\r
3718 SymbolKind.Property = 7;
\r
3719 SymbolKind.Field = 8;
\r
3720 SymbolKind.Constructor = 9;
\r
3721 SymbolKind.Enum = 10;
\r
3722 SymbolKind.Interface = 11;
\r
3723 SymbolKind.Function = 12;
\r
3724 SymbolKind.Variable = 13;
\r
3725 SymbolKind.Constant = 14;
\r
3726 SymbolKind.String = 15;
\r
3727 SymbolKind.Number = 16;
\r
3728 SymbolKind.Boolean = 17;
\r
3729 SymbolKind.Array = 18;
\r
3730 SymbolKind.Object = 19;
\r
3731 SymbolKind.Key = 20;
\r
3732 SymbolKind.Null = 21;
\r
3733 SymbolKind.EnumMember = 22;
\r
3734 SymbolKind.Struct = 23;
\r
3735 SymbolKind.Event = 24;
\r
3736 SymbolKind.Operator = 25;
\r
3737 SymbolKind.TypeParameter = 26;
\r
3738 })(SymbolKind || (SymbolKind = {}));
\r
3740 * Symbol tags are extra annotations that tweak the rendering of a symbol.
\r
3744 (function (SymbolTag) {
\r
3746 * Render a symbol as obsolete, usually using a strike-out.
\r
3748 SymbolTag.Deprecated = 1;
\r
3749 })(SymbolTag || (SymbolTag = {}));
\r
3750 var SymbolInformation;
\r
3751 (function (SymbolInformation) {
\r
3753 * Creates a new symbol information literal.
\r
3755 * @param name The name of the symbol.
\r
3756 * @param kind The kind of the symbol.
\r
3757 * @param range The range of the location of the symbol.
\r
3758 * @param uri The resource of the location of symbol, defaults to the current document.
\r
3759 * @param containerName The name of the symbol containing the symbol.
\r
3761 function create(name, kind, range, uri, containerName) {
\r
3765 location: { uri: uri, range: range }
\r
3767 if (containerName) {
\r
3768 result.containerName = containerName;
\r
3772 SymbolInformation.create = create;
\r
3773 })(SymbolInformation || (SymbolInformation = {}));
\r
3774 var DocumentSymbol;
\r
3775 (function (DocumentSymbol) {
\r
3777 * Creates a new symbol information literal.
\r
3779 * @param name The name of the symbol.
\r
3780 * @param detail The detail of the symbol.
\r
3781 * @param kind The kind of the symbol.
\r
3782 * @param range The range of the symbol.
\r
3783 * @param selectionRange The selectionRange of the symbol.
\r
3784 * @param children Children of the symbol.
\r
3786 function create(name, detail, kind, range, selectionRange, children) {
\r
3792 selectionRange: selectionRange
\r
3794 if (children !== void 0) {
\r
3795 result.children = children;
\r
3799 DocumentSymbol.create = create;
\r
3801 * Checks whether the given literal conforms to the [DocumentSymbol](#DocumentSymbol) interface.
\r
3803 function is(value) {
\r
3804 var candidate = value;
\r
3805 return candidate &&
\r
3806 Is.string(candidate.name) && Is.number(candidate.kind) &&
\r
3807 Range.is(candidate.range) && Range.is(candidate.selectionRange) &&
\r
3808 (candidate.detail === void 0 || Is.string(candidate.detail)) &&
\r
3809 (candidate.deprecated === void 0 || Is.boolean(candidate.deprecated)) &&
\r
3810 (candidate.children === void 0 || Array.isArray(candidate.children));
\r
3812 DocumentSymbol.is = is;
\r
3813 })(DocumentSymbol || (DocumentSymbol = {}));
\r
3815 * A set of predefined code action kinds
\r
3817 var CodeActionKind;
\r
3818 (function (CodeActionKind) {
\r
3822 CodeActionKind.Empty = '';
\r
3824 * Base kind for quickfix actions: 'quickfix'
\r
3826 CodeActionKind.QuickFix = 'quickfix';
\r
3828 * Base kind for refactoring actions: 'refactor'
\r
3830 CodeActionKind.Refactor = 'refactor';
\r
3832 * Base kind for refactoring extraction actions: 'refactor.extract'
\r
3834 * Example extract actions:
\r
3836 * - Extract method
\r
3837 * - Extract function
\r
3838 * - Extract variable
\r
3839 * - Extract interface from class
\r
3842 CodeActionKind.RefactorExtract = 'refactor.extract';
\r
3844 * Base kind for refactoring inline actions: 'refactor.inline'
\r
3846 * Example inline actions:
\r
3848 * - Inline function
\r
3849 * - Inline variable
\r
3850 * - Inline constant
\r
3853 CodeActionKind.RefactorInline = 'refactor.inline';
\r
3855 * Base kind for refactoring rewrite actions: 'refactor.rewrite'
\r
3857 * Example rewrite actions:
\r
3859 * - Convert JavaScript function to class
\r
3860 * - Add or remove parameter
\r
3861 * - Encapsulate field
\r
3862 * - Make method static
\r
3863 * - Move method to base class
\r
3866 CodeActionKind.RefactorRewrite = 'refactor.rewrite';
\r
3868 * Base kind for source actions: `source`
\r
3870 * Source code actions apply to the entire file.
\r
3872 CodeActionKind.Source = 'source';
\r
3874 * Base kind for an organize imports source action: `source.organizeImports`
\r
3876 CodeActionKind.SourceOrganizeImports = 'source.organizeImports';
\r
3878 * Base kind for auto-fix source actions: `source.fixAll`.
\r
3880 * Fix all actions automatically fix errors that have a clear fix that do not require user input.
\r
3881 * They should not suppress errors or perform unsafe fixes such as generating new types or classes.
\r
3885 CodeActionKind.SourceFixAll = 'source.fixAll';
\r
3886 })(CodeActionKind || (CodeActionKind = {}));
\r
3888 * The CodeActionContext namespace provides helper functions to work with
\r
3889 * [CodeActionContext](#CodeActionContext) literals.
\r
3891 var CodeActionContext;
\r
3892 (function (CodeActionContext) {
\r
3894 * Creates a new CodeActionContext literal.
\r
3896 function create(diagnostics, only) {
\r
3897 var result = { diagnostics: diagnostics };
\r
3898 if (only !== void 0 && only !== null) {
\r
3899 result.only = only;
\r
3903 CodeActionContext.create = create;
\r
3905 * Checks whether the given literal conforms to the [CodeActionContext](#CodeActionContext) interface.
\r
3907 function is(value) {
\r
3908 var candidate = value;
\r
3909 return Is.defined(candidate) && Is.typedArray(candidate.diagnostics, Diagnostic.is) && (candidate.only === void 0 || Is.typedArray(candidate.only, Is.string));
\r
3911 CodeActionContext.is = is;
\r
3912 })(CodeActionContext || (CodeActionContext = {}));
\r
3914 (function (CodeAction) {
\r
3915 function create(title, commandOrEdit, kind) {
\r
3916 var result = { title: title };
\r
3917 if (Command.is(commandOrEdit)) {
\r
3918 result.command = commandOrEdit;
\r
3921 result.edit = commandOrEdit;
\r
3923 if (kind !== void 0) {
\r
3924 result.kind = kind;
\r
3928 CodeAction.create = create;
\r
3929 function is(value) {
\r
3930 var candidate = value;
\r
3931 return candidate && Is.string(candidate.title) &&
\r
3932 (candidate.diagnostics === void 0 || Is.typedArray(candidate.diagnostics, Diagnostic.is)) &&
\r
3933 (candidate.kind === void 0 || Is.string(candidate.kind)) &&
\r
3934 (candidate.edit !== void 0 || candidate.command !== void 0) &&
\r
3935 (candidate.command === void 0 || Command.is(candidate.command)) &&
\r
3936 (candidate.isPreferred === void 0 || Is.boolean(candidate.isPreferred)) &&
\r
3937 (candidate.edit === void 0 || WorkspaceEdit.is(candidate.edit));
\r
3939 CodeAction.is = is;
\r
3940 })(CodeAction || (CodeAction = {}));
\r
3942 * The CodeLens namespace provides helper functions to work with
\r
3943 * [CodeLens](#CodeLens) literals.
\r
3946 (function (CodeLens) {
\r
3948 * Creates a new CodeLens literal.
\r
3950 function create(range, data) {
\r
3951 var result = { range: range };
\r
3952 if (Is.defined(data)) {
\r
3953 result.data = data;
\r
3957 CodeLens.create = create;
\r
3959 * Checks whether the given literal conforms to the [CodeLens](#CodeLens) interface.
\r
3961 function is(value) {
\r
3962 var candidate = value;
\r
3963 return Is.defined(candidate) && Range.is(candidate.range) && (Is.undefined(candidate.command) || Command.is(candidate.command));
\r
3966 })(CodeLens || (CodeLens = {}));
\r
3968 * The FormattingOptions namespace provides helper functions to work with
\r
3969 * [FormattingOptions](#FormattingOptions) literals.
\r
3971 var FormattingOptions;
\r
3972 (function (FormattingOptions) {
\r
3974 * Creates a new FormattingOptions literal.
\r
3976 function create(tabSize, insertSpaces) {
\r
3977 return { tabSize: tabSize, insertSpaces: insertSpaces };
\r
3979 FormattingOptions.create = create;
\r
3981 * Checks whether the given literal conforms to the [FormattingOptions](#FormattingOptions) interface.
\r
3983 function is(value) {
\r
3984 var candidate = value;
\r
3985 return Is.defined(candidate) && Is.number(candidate.tabSize) && Is.boolean(candidate.insertSpaces);
\r
3987 FormattingOptions.is = is;
\r
3988 })(FormattingOptions || (FormattingOptions = {}));
\r
3990 * The DocumentLink namespace provides helper functions to work with
\r
3991 * [DocumentLink](#DocumentLink) literals.
\r
3994 (function (DocumentLink) {
\r
3996 * Creates a new DocumentLink literal.
\r
3998 function create(range, target, data) {
\r
3999 return { range: range, target: target, data: data };
\r
4001 DocumentLink.create = create;
\r
4003 * Checks whether the given literal conforms to the [DocumentLink](#DocumentLink) interface.
\r
4005 function is(value) {
\r
4006 var candidate = value;
\r
4007 return Is.defined(candidate) && Range.is(candidate.range) && (Is.undefined(candidate.target) || Is.string(candidate.target));
\r
4009 DocumentLink.is = is;
\r
4010 })(DocumentLink || (DocumentLink = {}));
\r
4012 * The SelectionRange namespace provides helper function to work with
\r
4013 * SelectionRange literals.
\r
4015 var SelectionRange;
\r
4016 (function (SelectionRange) {
\r
4018 * Creates a new SelectionRange
\r
4019 * @param range the range.
\r
4020 * @param parent an optional parent.
\r
4022 function create(range, parent) {
\r
4023 return { range: range, parent: parent };
\r
4025 SelectionRange.create = create;
\r
4026 function is(value) {
\r
4027 var candidate = value;
\r
4028 return candidate !== undefined && Range.is(candidate.range) && (candidate.parent === undefined || SelectionRange.is(candidate.parent));
\r
4030 SelectionRange.is = is;
\r
4031 })(SelectionRange || (SelectionRange = {}));
\r
4032 var EOL = ['\n', '\r\n', '\r'];
\r
4034 * @deprecated Use the text document from the new vscode-languageserver-textdocument package.
\r
4037 (function (TextDocument) {
\r
4039 * Creates a new ITextDocument literal from the given uri and content.
\r
4040 * @param uri The document's uri.
\r
4041 * @param languageId The document's language Id.
\r
4042 * @param content The document's content.
\r
4044 function create(uri, languageId, version, content) {
\r
4045 return new FullTextDocument(uri, languageId, version, content);
\r
4047 TextDocument.create = create;
\r
4049 * Checks whether the given literal conforms to the [ITextDocument](#ITextDocument) interface.
\r
4051 function is(value) {
\r
4052 var candidate = value;
\r
4053 return Is.defined(candidate) && Is.string(candidate.uri) && (Is.undefined(candidate.languageId) || Is.string(candidate.languageId)) && Is.number(candidate.lineCount)
\r
4054 && Is.func(candidate.getText) && Is.func(candidate.positionAt) && Is.func(candidate.offsetAt) ? true : false;
\r
4056 TextDocument.is = is;
\r
4057 function applyEdits(document, edits) {
\r
4058 var text = document.getText();
\r
4059 var sortedEdits = mergeSort(edits, function (a, b) {
\r
4060 var diff = a.range.start.line - b.range.start.line;
\r
4062 return a.range.start.character - b.range.start.character;
\r
4066 var lastModifiedOffset = text.length;
\r
4067 for (var i = sortedEdits.length - 1; i >= 0; i--) {
\r
4068 var e = sortedEdits[i];
\r
4069 var startOffset = document.offsetAt(e.range.start);
\r
4070 var endOffset = document.offsetAt(e.range.end);
\r
4071 if (endOffset <= lastModifiedOffset) {
\r
4072 text = text.substring(0, startOffset) + e.newText + text.substring(endOffset, text.length);
\r
4075 throw new Error('Overlapping edit');
\r
4077 lastModifiedOffset = startOffset;
\r
4081 TextDocument.applyEdits = applyEdits;
\r
4082 function mergeSort(data, compare) {
\r
4083 if (data.length <= 1) {
\r
4087 var p = (data.length / 2) | 0;
\r
4088 var left = data.slice(0, p);
\r
4089 var right = data.slice(p);
\r
4090 mergeSort(left, compare);
\r
4091 mergeSort(right, compare);
\r
4095 while (leftIdx < left.length && rightIdx < right.length) {
\r
4096 var ret = compare(left[leftIdx], right[rightIdx]);
\r
4098 // smaller_equal -> take left to preserve order
\r
4099 data[i++] = left[leftIdx++];
\r
4102 // greater -> take right
\r
4103 data[i++] = right[rightIdx++];
\r
4106 while (leftIdx < left.length) {
\r
4107 data[i++] = left[leftIdx++];
\r
4109 while (rightIdx < right.length) {
\r
4110 data[i++] = right[rightIdx++];
\r
4114 })(TextDocument || (TextDocument = {}));
\r
4115 var FullTextDocument = /** @class */ (function () {
\r
4116 function FullTextDocument(uri, languageId, version, content) {
\r
4118 this._languageId = languageId;
\r
4119 this._version = version;
\r
4120 this._content = content;
\r
4121 this._lineOffsets = undefined;
\r
4123 Object.defineProperty(FullTextDocument.prototype, "uri", {
\r
4124 get: function () {
\r
4128 configurable: true
\r
4130 Object.defineProperty(FullTextDocument.prototype, "languageId", {
\r
4131 get: function () {
\r
4132 return this._languageId;
\r
4135 configurable: true
\r
4137 Object.defineProperty(FullTextDocument.prototype, "version", {
\r
4138 get: function () {
\r
4139 return this._version;
\r
4142 configurable: true
\r
4144 FullTextDocument.prototype.getText = function (range) {
\r
4146 var start = this.offsetAt(range.start);
\r
4147 var end = this.offsetAt(range.end);
\r
4148 return this._content.substring(start, end);
\r
4150 return this._content;
\r
4152 FullTextDocument.prototype.update = function (event, version) {
\r
4153 this._content = event.text;
\r
4154 this._version = version;
\r
4155 this._lineOffsets = undefined;
\r
4157 FullTextDocument.prototype.getLineOffsets = function () {
\r
4158 if (this._lineOffsets === undefined) {
\r
4159 var lineOffsets = [];
\r
4160 var text = this._content;
\r
4161 var isLineStart = true;
\r
4162 for (var i = 0; i < text.length; i++) {
\r
4163 if (isLineStart) {
\r
4164 lineOffsets.push(i);
\r
4165 isLineStart = false;
\r
4167 var ch = text.charAt(i);
\r
4168 isLineStart = (ch === '\r' || ch === '\n');
\r
4169 if (ch === '\r' && i + 1 < text.length && text.charAt(i + 1) === '\n') {
\r
4173 if (isLineStart && text.length > 0) {
\r
4174 lineOffsets.push(text.length);
\r
4176 this._lineOffsets = lineOffsets;
\r
4178 return this._lineOffsets;
\r
4180 FullTextDocument.prototype.positionAt = function (offset) {
\r
4181 offset = Math.max(Math.min(offset, this._content.length), 0);
\r
4182 var lineOffsets = this.getLineOffsets();
\r
4183 var low = 0, high = lineOffsets.length;
\r
4185 return Position.create(0, offset);
\r
4187 while (low < high) {
\r
4188 var mid = Math.floor((low + high) / 2);
\r
4189 if (lineOffsets[mid] > offset) {
\r
4196 // low is the least x for which the line offset is larger than the current offset
\r
4197 // or array.length if no line offset is larger than the current offset
\r
4198 var line = low - 1;
\r
4199 return Position.create(line, offset - lineOffsets[line]);
\r
4201 FullTextDocument.prototype.offsetAt = function (position) {
\r
4202 var lineOffsets = this.getLineOffsets();
\r
4203 if (position.line >= lineOffsets.length) {
\r
4204 return this._content.length;
\r
4206 else if (position.line < 0) {
\r
4209 var lineOffset = lineOffsets[position.line];
\r
4210 var nextLineOffset = (position.line + 1 < lineOffsets.length) ? lineOffsets[position.line + 1] : this._content.length;
\r
4211 return Math.max(Math.min(lineOffset + position.character, nextLineOffset), lineOffset);
\r
4213 Object.defineProperty(FullTextDocument.prototype, "lineCount", {
\r
4214 get: function () {
\r
4215 return this.getLineOffsets().length;
\r
4218 configurable: true
\r
4220 return FullTextDocument;
\r
4224 var toString = Object.prototype.toString;
\r
4225 function defined(value) {
\r
4226 return typeof value !== 'undefined';
\r
4228 Is.defined = defined;
\r
4229 function undefined(value) {
\r
4230 return typeof value === 'undefined';
\r
4232 Is.undefined = undefined;
\r
4233 function boolean(value) {
\r
4234 return value === true || value === false;
\r
4236 Is.boolean = boolean;
\r
4237 function string(value) {
\r
4238 return toString.call(value) === '[object String]';
\r
4240 Is.string = string;
\r
4241 function number(value) {
\r
4242 return toString.call(value) === '[object Number]';
\r
4244 Is.number = number;
\r
4245 function func(value) {
\r
4246 return toString.call(value) === '[object Function]';
\r
4249 function objectLiteral(value) {
\r
4250 // Strictly speaking class instances pass this check as well. Since the LSP
\r
4251 // doesn't use classes we ignore this for now. If we do we need to add something
\r
4252 // like this: `Object.getPrototypeOf(Object.getPrototypeOf(x)) === null`
\r
4253 return value !== null && typeof value === 'object';
\r
4255 Is.objectLiteral = objectLiteral;
\r
4256 function typedArray(value, check) {
\r
4257 return Array.isArray(value) && value.every(check);
\r
4259 Is.typedArray = typedArray;
\r
4260 })(Is || (Is = {}));
\r
4265 /***/ (function(module, exports, __webpack_require__) {
4268 /* --------------------------------------------------------------------------------------------
\r
4269 * Copyright (c) Microsoft Corporation. All rights reserved.
\r
4270 * Licensed under the MIT License. See License.txt in the project root for license information.
\r
4271 * ------------------------------------------------------------------------------------------ */
\r
4273 Object.defineProperty(exports, "__esModule", { value: true });
\r
4274 const Is = __webpack_require__(20);
\r
4275 const vscode_jsonrpc_1 = __webpack_require__(5);
\r
4276 const messages_1 = __webpack_require__(21);
\r
4277 const protocol_implementation_1 = __webpack_require__(22);
\r
4278 exports.ImplementationRequest = protocol_implementation_1.ImplementationRequest;
\r
4279 const protocol_typeDefinition_1 = __webpack_require__(23);
\r
4280 exports.TypeDefinitionRequest = protocol_typeDefinition_1.TypeDefinitionRequest;
\r
4281 const protocol_workspaceFolders_1 = __webpack_require__(24);
\r
4282 exports.WorkspaceFoldersRequest = protocol_workspaceFolders_1.WorkspaceFoldersRequest;
\r
4283 exports.DidChangeWorkspaceFoldersNotification = protocol_workspaceFolders_1.DidChangeWorkspaceFoldersNotification;
\r
4284 const protocol_configuration_1 = __webpack_require__(25);
\r
4285 exports.ConfigurationRequest = protocol_configuration_1.ConfigurationRequest;
\r
4286 const protocol_colorProvider_1 = __webpack_require__(26);
\r
4287 exports.DocumentColorRequest = protocol_colorProvider_1.DocumentColorRequest;
\r
4288 exports.ColorPresentationRequest = protocol_colorProvider_1.ColorPresentationRequest;
\r
4289 const protocol_foldingRange_1 = __webpack_require__(27);
\r
4290 exports.FoldingRangeRequest = protocol_foldingRange_1.FoldingRangeRequest;
\r
4291 const protocol_declaration_1 = __webpack_require__(28);
\r
4292 exports.DeclarationRequest = protocol_declaration_1.DeclarationRequest;
\r
4293 const protocol_selectionRange_1 = __webpack_require__(29);
\r
4294 exports.SelectionRangeRequest = protocol_selectionRange_1.SelectionRangeRequest;
\r
4295 const protocol_progress_1 = __webpack_require__(30);
\r
4296 exports.WorkDoneProgress = protocol_progress_1.WorkDoneProgress;
\r
4297 exports.WorkDoneProgressCreateRequest = protocol_progress_1.WorkDoneProgressCreateRequest;
\r
4298 exports.WorkDoneProgressCancelNotification = protocol_progress_1.WorkDoneProgressCancelNotification;
\r
4299 // @ts-ignore: to avoid inlining LocatioLink as dynamic import
\r
4300 let __noDynamicImport;
\r
4302 * The DocumentFilter namespace provides helper functions to work with
\r
4303 * [DocumentFilter](#DocumentFilter) literals.
\r
4305 var DocumentFilter;
\r
4306 (function (DocumentFilter) {
\r
4307 function is(value) {
\r
4308 const candidate = value;
\r
4309 return Is.string(candidate.language) || Is.string(candidate.scheme) || Is.string(candidate.pattern);
\r
4311 DocumentFilter.is = is;
\r
4312 })(DocumentFilter = exports.DocumentFilter || (exports.DocumentFilter = {}));
\r
4314 * The DocumentSelector namespace provides helper functions to work with
\r
4315 * [DocumentSelector](#DocumentSelector)s.
\r
4317 var DocumentSelector;
\r
4318 (function (DocumentSelector) {
\r
4319 function is(value) {
\r
4320 if (!Array.isArray(value)) {
\r
4323 for (let elem of value) {
\r
4324 if (!Is.string(elem) && !DocumentFilter.is(elem)) {
\r
4330 DocumentSelector.is = is;
\r
4331 })(DocumentSelector = exports.DocumentSelector || (exports.DocumentSelector = {}));
\r
4333 * The `client/registerCapability` request is sent from the server to the client to register a new capability
\r
4334 * handler on the client side.
\r
4336 var RegistrationRequest;
\r
4337 (function (RegistrationRequest) {
\r
4338 RegistrationRequest.type = new messages_1.ProtocolRequestType('client/registerCapability');
\r
4339 })(RegistrationRequest = exports.RegistrationRequest || (exports.RegistrationRequest = {}));
\r
4341 * The `client/unregisterCapability` request is sent from the server to the client to unregister a previously registered capability
\r
4342 * handler on the client side.
\r
4344 var UnregistrationRequest;
\r
4345 (function (UnregistrationRequest) {
\r
4346 UnregistrationRequest.type = new messages_1.ProtocolRequestType('client/unregisterCapability');
\r
4347 })(UnregistrationRequest = exports.UnregistrationRequest || (exports.UnregistrationRequest = {}));
\r
4348 var ResourceOperationKind;
\r
4349 (function (ResourceOperationKind) {
\r
4351 * Supports creating new files and folders.
\r
4353 ResourceOperationKind.Create = 'create';
\r
4355 * Supports renaming existing files and folders.
\r
4357 ResourceOperationKind.Rename = 'rename';
\r
4359 * Supports deleting existing files and folders.
\r
4361 ResourceOperationKind.Delete = 'delete';
\r
4362 })(ResourceOperationKind = exports.ResourceOperationKind || (exports.ResourceOperationKind = {}));
\r
4363 var FailureHandlingKind;
\r
4364 (function (FailureHandlingKind) {
\r
4366 * Applying the workspace change is simply aborted if one of the changes provided
\r
4367 * fails. All operations executed before the failing operation stay executed.
\r
4369 FailureHandlingKind.Abort = 'abort';
\r
4371 * All operations are executed transactional. That means they either all
\r
4372 * succeed or no changes at all are applied to the workspace.
\r
4374 FailureHandlingKind.Transactional = 'transactional';
\r
4376 * If the workspace edit contains only textual file changes they are executed transactional.
\r
4377 * If resource changes (create, rename or delete file) are part of the change the failure
\r
4378 * handling startegy is abort.
\r
4380 FailureHandlingKind.TextOnlyTransactional = 'textOnlyTransactional';
\r
4382 * The client tries to undo the operations already executed. But there is no
\r
4383 * guarantee that this is succeeding.
\r
4385 FailureHandlingKind.Undo = 'undo';
\r
4386 })(FailureHandlingKind = exports.FailureHandlingKind || (exports.FailureHandlingKind = {}));
\r
4388 * The StaticRegistrationOptions namespace provides helper functions to work with
\r
4389 * [StaticRegistrationOptions](#StaticRegistrationOptions) literals.
\r
4391 var StaticRegistrationOptions;
\r
4392 (function (StaticRegistrationOptions) {
\r
4393 function hasId(value) {
\r
4394 const candidate = value;
\r
4395 return candidate && Is.string(candidate.id) && candidate.id.length > 0;
\r
4397 StaticRegistrationOptions.hasId = hasId;
\r
4398 })(StaticRegistrationOptions = exports.StaticRegistrationOptions || (exports.StaticRegistrationOptions = {}));
\r
4400 * The TextDocumentRegistrationOptions namespace provides helper functions to work with
\r
4401 * [TextDocumentRegistrationOptions](#TextDocumentRegistrationOptions) literals.
\r
4403 var TextDocumentRegistrationOptions;
\r
4404 (function (TextDocumentRegistrationOptions) {
\r
4405 function is(value) {
\r
4406 const candidate = value;
\r
4407 return candidate && (candidate.documentSelector === null || DocumentSelector.is(candidate.documentSelector));
\r
4409 TextDocumentRegistrationOptions.is = is;
\r
4410 })(TextDocumentRegistrationOptions = exports.TextDocumentRegistrationOptions || (exports.TextDocumentRegistrationOptions = {}));
\r
4412 * The WorkDoneProgressOptions namespace provides helper functions to work with
\r
4413 * [WorkDoneProgressOptions](#WorkDoneProgressOptions) literals.
\r
4415 var WorkDoneProgressOptions;
\r
4416 (function (WorkDoneProgressOptions) {
\r
4417 function is(value) {
\r
4418 const candidate = value;
\r
4419 return Is.objectLiteral(candidate) && (candidate.workDoneProgress === undefined || Is.boolean(candidate.workDoneProgress));
\r
4421 WorkDoneProgressOptions.is = is;
\r
4422 function hasWorkDoneProgress(value) {
\r
4423 const candidate = value;
\r
4424 return candidate && Is.boolean(candidate.workDoneProgress);
\r
4426 WorkDoneProgressOptions.hasWorkDoneProgress = hasWorkDoneProgress;
\r
4427 })(WorkDoneProgressOptions = exports.WorkDoneProgressOptions || (exports.WorkDoneProgressOptions = {}));
\r
4429 * The initialize request is sent from the client to the server.
\r
4430 * It is sent once as the request after starting up the server.
\r
4431 * The requests parameter is of type [InitializeParams](#InitializeParams)
\r
4432 * the response if of type [InitializeResult](#InitializeResult) of a Thenable that
\r
4433 * resolves to such.
\r
4435 var InitializeRequest;
\r
4436 (function (InitializeRequest) {
\r
4437 InitializeRequest.type = new messages_1.ProtocolRequestType('initialize');
\r
4438 })(InitializeRequest = exports.InitializeRequest || (exports.InitializeRequest = {}));
\r
4440 * Known error codes for an `InitializeError`;
\r
4442 var InitializeError;
\r
4443 (function (InitializeError) {
\r
4445 * If the protocol version provided by the client can't be handled by the server.
\r
4446 * @deprecated This initialize error got replaced by client capabilities. There is
\r
4447 * no version handshake in version 3.0x
\r
4449 InitializeError.unknownProtocolVersion = 1;
\r
4450 })(InitializeError = exports.InitializeError || (exports.InitializeError = {}));
\r
4452 * The intialized notification is sent from the client to the
\r
4453 * server after the client is fully initialized and the server
\r
4454 * is allowed to send requests from the server to the client.
\r
4456 var InitializedNotification;
\r
4457 (function (InitializedNotification) {
\r
4458 InitializedNotification.type = new messages_1.ProtocolNotificationType('initialized');
\r
4459 })(InitializedNotification = exports.InitializedNotification || (exports.InitializedNotification = {}));
\r
4460 //---- Shutdown Method ----
\r
4462 * A shutdown request is sent from the client to the server.
\r
4463 * It is sent once when the client decides to shutdown the
\r
4464 * server. The only notification that is sent after a shutdown request
\r
4465 * is the exit event.
\r
4467 var ShutdownRequest;
\r
4468 (function (ShutdownRequest) {
\r
4469 ShutdownRequest.type = new messages_1.ProtocolRequestType0('shutdown');
\r
4470 })(ShutdownRequest = exports.ShutdownRequest || (exports.ShutdownRequest = {}));
\r
4471 //---- Exit Notification ----
\r
4473 * The exit event is sent from the client to the server to
\r
4474 * ask the server to exit its process.
\r
4476 var ExitNotification;
\r
4477 (function (ExitNotification) {
\r
4478 ExitNotification.type = new messages_1.ProtocolNotificationType0('exit');
\r
4479 })(ExitNotification = exports.ExitNotification || (exports.ExitNotification = {}));
\r
4481 * The configuration change notification is sent from the client to the server
\r
4482 * when the client's configuration has changed. The notification contains
\r
4483 * the changed configuration as defined by the language client.
\r
4485 var DidChangeConfigurationNotification;
\r
4486 (function (DidChangeConfigurationNotification) {
\r
4487 DidChangeConfigurationNotification.type = new messages_1.ProtocolNotificationType('workspace/didChangeConfiguration');
\r
4488 })(DidChangeConfigurationNotification = exports.DidChangeConfigurationNotification || (exports.DidChangeConfigurationNotification = {}));
\r
4489 //---- Message show and log notifications ----
\r
4491 * The message type
\r
4494 (function (MessageType) {
\r
4496 * An error message.
\r
4498 MessageType.Error = 1;
\r
4500 * A warning message.
\r
4502 MessageType.Warning = 2;
\r
4504 * An information message.
\r
4506 MessageType.Info = 3;
\r
4510 MessageType.Log = 4;
\r
4511 })(MessageType = exports.MessageType || (exports.MessageType = {}));
\r
4513 * The show message notification is sent from a server to a client to ask
\r
4514 * the client to display a particular message in the user interface.
\r
4516 var ShowMessageNotification;
\r
4517 (function (ShowMessageNotification) {
\r
4518 ShowMessageNotification.type = new messages_1.ProtocolNotificationType('window/showMessage');
\r
4519 })(ShowMessageNotification = exports.ShowMessageNotification || (exports.ShowMessageNotification = {}));
\r
4521 * The show message request is sent from the server to the client to show a message
\r
4522 * and a set of options actions to the user.
\r
4524 var ShowMessageRequest;
\r
4525 (function (ShowMessageRequest) {
\r
4526 ShowMessageRequest.type = new messages_1.ProtocolRequestType('window/showMessageRequest');
\r
4527 })(ShowMessageRequest = exports.ShowMessageRequest || (exports.ShowMessageRequest = {}));
\r
4529 * The log message notification is sent from the server to the client to ask
\r
4530 * the client to log a particular message.
\r
4532 var LogMessageNotification;
\r
4533 (function (LogMessageNotification) {
\r
4534 LogMessageNotification.type = new messages_1.ProtocolNotificationType('window/logMessage');
\r
4535 })(LogMessageNotification = exports.LogMessageNotification || (exports.LogMessageNotification = {}));
\r
4536 //---- Telemetry notification
\r
4538 * The telemetry event notification is sent from the server to the client to ask
\r
4539 * the client to log telemetry data.
\r
4541 var TelemetryEventNotification;
\r
4542 (function (TelemetryEventNotification) {
\r
4543 TelemetryEventNotification.type = new messages_1.ProtocolNotificationType('telemetry/event');
\r
4544 })(TelemetryEventNotification = exports.TelemetryEventNotification || (exports.TelemetryEventNotification = {}));
\r
4546 * Defines how the host (editor) should sync
\r
4547 * document changes to the language server.
\r
4549 var TextDocumentSyncKind;
\r
4550 (function (TextDocumentSyncKind) {
\r
4552 * Documents should not be synced at all.
\r
4554 TextDocumentSyncKind.None = 0;
\r
4556 * Documents are synced by always sending the full content
\r
4557 * of the document.
\r
4559 TextDocumentSyncKind.Full = 1;
\r
4561 * Documents are synced by sending the full content on open.
\r
4562 * After that only incremental updates to the document are
\r
4565 TextDocumentSyncKind.Incremental = 2;
\r
4566 })(TextDocumentSyncKind = exports.TextDocumentSyncKind || (exports.TextDocumentSyncKind = {}));
\r
4568 * The document open notification is sent from the client to the server to signal
\r
4569 * newly opened text documents. The document's truth is now managed by the client
\r
4570 * and the server must not try to read the document's truth using the document's
\r
4571 * uri. Open in this sense means it is managed by the client. It doesn't necessarily
\r
4572 * mean that its content is presented in an editor. An open notification must not
\r
4573 * be sent more than once without a corresponding close notification send before.
\r
4574 * This means open and close notification must be balanced and the max open count
\r
4577 var DidOpenTextDocumentNotification;
\r
4578 (function (DidOpenTextDocumentNotification) {
\r
4579 DidOpenTextDocumentNotification.method = 'textDocument/didOpen';
\r
4580 DidOpenTextDocumentNotification.type = new messages_1.ProtocolNotificationType(DidOpenTextDocumentNotification.method);
\r
4581 })(DidOpenTextDocumentNotification = exports.DidOpenTextDocumentNotification || (exports.DidOpenTextDocumentNotification = {}));
\r
4583 * The document change notification is sent from the client to the server to signal
\r
4584 * changes to a text document.
\r
4586 var DidChangeTextDocumentNotification;
\r
4587 (function (DidChangeTextDocumentNotification) {
\r
4588 DidChangeTextDocumentNotification.method = 'textDocument/didChange';
\r
4589 DidChangeTextDocumentNotification.type = new messages_1.ProtocolNotificationType(DidChangeTextDocumentNotification.method);
\r
4590 })(DidChangeTextDocumentNotification = exports.DidChangeTextDocumentNotification || (exports.DidChangeTextDocumentNotification = {}));
\r
4592 * The document close notification is sent from the client to the server when
\r
4593 * the document got closed in the client. The document's truth now exists where
\r
4594 * the document's uri points to (e.g. if the document's uri is a file uri the
\r
4595 * truth now exists on disk). As with the open notification the close notification
\r
4596 * is about managing the document's content. Receiving a close notification
\r
4597 * doesn't mean that the document was open in an editor before. A close
\r
4598 * notification requires a previous open notification to be sent.
\r
4600 var DidCloseTextDocumentNotification;
\r
4601 (function (DidCloseTextDocumentNotification) {
\r
4602 DidCloseTextDocumentNotification.method = 'textDocument/didClose';
\r
4603 DidCloseTextDocumentNotification.type = new messages_1.ProtocolNotificationType(DidCloseTextDocumentNotification.method);
\r
4604 })(DidCloseTextDocumentNotification = exports.DidCloseTextDocumentNotification || (exports.DidCloseTextDocumentNotification = {}));
\r
4606 * The document save notification is sent from the client to the server when
\r
4607 * the document got saved in the client.
\r
4609 var DidSaveTextDocumentNotification;
\r
4610 (function (DidSaveTextDocumentNotification) {
\r
4611 DidSaveTextDocumentNotification.method = 'textDocument/didSave';
\r
4612 DidSaveTextDocumentNotification.type = new messages_1.ProtocolNotificationType(DidSaveTextDocumentNotification.method);
\r
4613 })(DidSaveTextDocumentNotification = exports.DidSaveTextDocumentNotification || (exports.DidSaveTextDocumentNotification = {}));
\r
4615 * Represents reasons why a text document is saved.
\r
4617 var TextDocumentSaveReason;
\r
4618 (function (TextDocumentSaveReason) {
\r
4620 * Manually triggered, e.g. by the user pressing save, by starting debugging,
\r
4621 * or by an API call.
\r
4623 TextDocumentSaveReason.Manual = 1;
\r
4625 * Automatic after a delay.
\r
4627 TextDocumentSaveReason.AfterDelay = 2;
\r
4629 * When the editor lost focus.
\r
4631 TextDocumentSaveReason.FocusOut = 3;
\r
4632 })(TextDocumentSaveReason = exports.TextDocumentSaveReason || (exports.TextDocumentSaveReason = {}));
\r
4634 * A document will save notification is sent from the client to the server before
\r
4635 * the document is actually saved.
\r
4637 var WillSaveTextDocumentNotification;
\r
4638 (function (WillSaveTextDocumentNotification) {
\r
4639 WillSaveTextDocumentNotification.method = 'textDocument/willSave';
\r
4640 WillSaveTextDocumentNotification.type = new messages_1.ProtocolNotificationType(WillSaveTextDocumentNotification.method);
\r
4641 })(WillSaveTextDocumentNotification = exports.WillSaveTextDocumentNotification || (exports.WillSaveTextDocumentNotification = {}));
\r
4643 * A document will save request is sent from the client to the server before
\r
4644 * the document is actually saved. The request can return an array of TextEdits
\r
4645 * which will be applied to the text document before it is saved. Please note that
\r
4646 * clients might drop results if computing the text edits took too long or if a
\r
4647 * server constantly fails on this request. This is done to keep the save fast and
\r
4650 var WillSaveTextDocumentWaitUntilRequest;
\r
4651 (function (WillSaveTextDocumentWaitUntilRequest) {
\r
4652 WillSaveTextDocumentWaitUntilRequest.method = 'textDocument/willSaveWaitUntil';
\r
4653 WillSaveTextDocumentWaitUntilRequest.type = new messages_1.ProtocolRequestType(WillSaveTextDocumentWaitUntilRequest.method);
\r
4654 })(WillSaveTextDocumentWaitUntilRequest = exports.WillSaveTextDocumentWaitUntilRequest || (exports.WillSaveTextDocumentWaitUntilRequest = {}));
\r
4656 * The watched files notification is sent from the client to the server when
\r
4657 * the client detects changes to file watched by the language client.
\r
4659 var DidChangeWatchedFilesNotification;
\r
4660 (function (DidChangeWatchedFilesNotification) {
\r
4661 DidChangeWatchedFilesNotification.type = new messages_1.ProtocolNotificationType('workspace/didChangeWatchedFiles');
\r
4662 })(DidChangeWatchedFilesNotification = exports.DidChangeWatchedFilesNotification || (exports.DidChangeWatchedFilesNotification = {}));
\r
4664 * The file event type
\r
4666 var FileChangeType;
\r
4667 (function (FileChangeType) {
\r
4669 * The file got created.
\r
4671 FileChangeType.Created = 1;
\r
4673 * The file got changed.
\r
4675 FileChangeType.Changed = 2;
\r
4677 * The file got deleted.
\r
4679 FileChangeType.Deleted = 3;
\r
4680 })(FileChangeType = exports.FileChangeType || (exports.FileChangeType = {}));
\r
4682 (function (WatchKind) {
\r
4684 * Interested in create events.
\r
4686 WatchKind.Create = 1;
\r
4688 * Interested in change events
\r
4690 WatchKind.Change = 2;
\r
4692 * Interested in delete events
\r
4694 WatchKind.Delete = 4;
\r
4695 })(WatchKind = exports.WatchKind || (exports.WatchKind = {}));
\r
4697 * Diagnostics notification are sent from the server to the client to signal
\r
4698 * results of validation runs.
\r
4700 var PublishDiagnosticsNotification;
\r
4701 (function (PublishDiagnosticsNotification) {
\r
4702 PublishDiagnosticsNotification.type = new messages_1.ProtocolNotificationType('textDocument/publishDiagnostics');
\r
4703 })(PublishDiagnosticsNotification = exports.PublishDiagnosticsNotification || (exports.PublishDiagnosticsNotification = {}));
\r
4705 * How a completion was triggered
\r
4707 var CompletionTriggerKind;
\r
4708 (function (CompletionTriggerKind) {
\r
4710 * Completion was triggered by typing an identifier (24x7 code
\r
4711 * complete), manual invocation (e.g Ctrl+Space) or via API.
\r
4713 CompletionTriggerKind.Invoked = 1;
\r
4715 * Completion was triggered by a trigger character specified by
\r
4716 * the `triggerCharacters` properties of the `CompletionRegistrationOptions`.
\r
4718 CompletionTriggerKind.TriggerCharacter = 2;
\r
4720 * Completion was re-triggered as current completion list is incomplete
\r
4722 CompletionTriggerKind.TriggerForIncompleteCompletions = 3;
\r
4723 })(CompletionTriggerKind = exports.CompletionTriggerKind || (exports.CompletionTriggerKind = {}));
\r
4725 * Request to request completion at a given text document position. The request's
\r
4726 * parameter is of type [TextDocumentPosition](#TextDocumentPosition) the response
\r
4727 * is of type [CompletionItem[]](#CompletionItem) or [CompletionList](#CompletionList)
\r
4728 * or a Thenable that resolves to such.
\r
4730 * The request can delay the computation of the [`detail`](#CompletionItem.detail)
\r
4731 * and [`documentation`](#CompletionItem.documentation) properties to the `completionItem/resolve`
\r
4732 * request. However, properties that are needed for the initial sorting and filtering, like `sortText`,
\r
4733 * `filterText`, `insertText`, and `textEdit`, must not be changed during resolve.
\r
4735 var CompletionRequest;
\r
4736 (function (CompletionRequest) {
\r
4737 CompletionRequest.method = 'textDocument/completion';
\r
4738 CompletionRequest.type = new messages_1.ProtocolRequestType(CompletionRequest.method);
\r
4739 /** @deprecated Use CompletionRequest.type */
\r
4740 CompletionRequest.resultType = new vscode_jsonrpc_1.ProgressType();
\r
4741 })(CompletionRequest = exports.CompletionRequest || (exports.CompletionRequest = {}));
\r
4743 * Request to resolve additional information for a given completion item.The request's
\r
4744 * parameter is of type [CompletionItem](#CompletionItem) the response
\r
4745 * is of type [CompletionItem](#CompletionItem) or a Thenable that resolves to such.
\r
4747 var CompletionResolveRequest;
\r
4748 (function (CompletionResolveRequest) {
\r
4749 CompletionResolveRequest.method = 'completionItem/resolve';
\r
4750 CompletionResolveRequest.type = new messages_1.ProtocolRequestType(CompletionResolveRequest.method);
\r
4751 })(CompletionResolveRequest = exports.CompletionResolveRequest || (exports.CompletionResolveRequest = {}));
\r
4753 * Request to request hover information at a given text document position. The request's
\r
4754 * parameter is of type [TextDocumentPosition](#TextDocumentPosition) the response is of
\r
4755 * type [Hover](#Hover) or a Thenable that resolves to such.
\r
4758 (function (HoverRequest) {
\r
4759 HoverRequest.method = 'textDocument/hover';
\r
4760 HoverRequest.type = new messages_1.ProtocolRequestType(HoverRequest.method);
\r
4761 })(HoverRequest = exports.HoverRequest || (exports.HoverRequest = {}));
\r
4763 * How a signature help was triggered.
\r
4767 var SignatureHelpTriggerKind;
\r
4768 (function (SignatureHelpTriggerKind) {
\r
4770 * Signature help was invoked manually by the user or by a command.
\r
4772 SignatureHelpTriggerKind.Invoked = 1;
\r
4774 * Signature help was triggered by a trigger character.
\r
4776 SignatureHelpTriggerKind.TriggerCharacter = 2;
\r
4778 * Signature help was triggered by the cursor moving or by the document content changing.
\r
4780 SignatureHelpTriggerKind.ContentChange = 3;
\r
4781 })(SignatureHelpTriggerKind = exports.SignatureHelpTriggerKind || (exports.SignatureHelpTriggerKind = {}));
\r
4782 var SignatureHelpRequest;
\r
4783 (function (SignatureHelpRequest) {
\r
4784 SignatureHelpRequest.method = 'textDocument/signatureHelp';
\r
4785 SignatureHelpRequest.type = new messages_1.ProtocolRequestType(SignatureHelpRequest.method);
\r
4786 })(SignatureHelpRequest = exports.SignatureHelpRequest || (exports.SignatureHelpRequest = {}));
\r
4788 * A request to resolve the definition location of a symbol at a given text
\r
4789 * document position. The request's parameter is of type [TextDocumentPosition]
\r
4790 * (#TextDocumentPosition) the response is of either type [Definition](#Definition)
\r
4791 * or a typed array of [DefinitionLink](#DefinitionLink) or a Thenable that resolves
\r
4794 var DefinitionRequest;
\r
4795 (function (DefinitionRequest) {
\r
4796 DefinitionRequest.method = 'textDocument/definition';
\r
4797 DefinitionRequest.type = new messages_1.ProtocolRequestType(DefinitionRequest.method);
\r
4798 /** @deprecated Use DefinitionRequest.type */
\r
4799 DefinitionRequest.resultType = new vscode_jsonrpc_1.ProgressType();
\r
4800 })(DefinitionRequest = exports.DefinitionRequest || (exports.DefinitionRequest = {}));
\r
4802 * A request to resolve project-wide references for the symbol denoted
\r
4803 * by the given text document position. The request's parameter is of
\r
4804 * type [ReferenceParams](#ReferenceParams) the response is of type
\r
4805 * [Location[]](#Location) or a Thenable that resolves to such.
\r
4807 var ReferencesRequest;
\r
4808 (function (ReferencesRequest) {
\r
4809 ReferencesRequest.method = 'textDocument/references';
\r
4810 ReferencesRequest.type = new messages_1.ProtocolRequestType(ReferencesRequest.method);
\r
4811 /** @deprecated Use ReferencesRequest.type */
\r
4812 ReferencesRequest.resultType = new vscode_jsonrpc_1.ProgressType();
\r
4813 })(ReferencesRequest = exports.ReferencesRequest || (exports.ReferencesRequest = {}));
\r
4815 * Request to resolve a [DocumentHighlight](#DocumentHighlight) for a given
\r
4816 * text document position. The request's parameter is of type [TextDocumentPosition]
\r
4817 * (#TextDocumentPosition) the request response is of type [DocumentHighlight[]]
\r
4818 * (#DocumentHighlight) or a Thenable that resolves to such.
\r
4820 var DocumentHighlightRequest;
\r
4821 (function (DocumentHighlightRequest) {
\r
4822 DocumentHighlightRequest.method = 'textDocument/documentHighlight';
\r
4823 DocumentHighlightRequest.type = new messages_1.ProtocolRequestType(DocumentHighlightRequest.method);
\r
4824 /** @deprecated Use DocumentHighlightRequest.type */
\r
4825 DocumentHighlightRequest.resultType = new vscode_jsonrpc_1.ProgressType();
\r
4826 })(DocumentHighlightRequest = exports.DocumentHighlightRequest || (exports.DocumentHighlightRequest = {}));
\r
4828 * A request to list all symbols found in a given text document. The request's
\r
4829 * parameter is of type [TextDocumentIdentifier](#TextDocumentIdentifier) the
\r
4830 * response is of type [SymbolInformation[]](#SymbolInformation) or a Thenable
\r
4831 * that resolves to such.
\r
4833 var DocumentSymbolRequest;
\r
4834 (function (DocumentSymbolRequest) {
\r
4835 DocumentSymbolRequest.method = 'textDocument/documentSymbol';
\r
4836 DocumentSymbolRequest.type = new messages_1.ProtocolRequestType(DocumentSymbolRequest.method);
\r
4837 /** @deprecated Use DocumentSymbolRequest.type */
\r
4838 DocumentSymbolRequest.resultType = new vscode_jsonrpc_1.ProgressType();
\r
4839 })(DocumentSymbolRequest = exports.DocumentSymbolRequest || (exports.DocumentSymbolRequest = {}));
\r
4841 * A request to provide commands for the given text document and range.
\r
4843 var CodeActionRequest;
\r
4844 (function (CodeActionRequest) {
\r
4845 CodeActionRequest.method = 'textDocument/codeAction';
\r
4846 CodeActionRequest.type = new messages_1.ProtocolRequestType(CodeActionRequest.method);
\r
4847 /** @deprecated Use CodeActionRequest.type */
\r
4848 CodeActionRequest.resultType = new vscode_jsonrpc_1.ProgressType();
\r
4849 })(CodeActionRequest = exports.CodeActionRequest || (exports.CodeActionRequest = {}));
\r
4851 * A request to list project-wide symbols matching the query string given
\r
4852 * by the [WorkspaceSymbolParams](#WorkspaceSymbolParams). The response is
\r
4853 * of type [SymbolInformation[]](#SymbolInformation) or a Thenable that
\r
4854 * resolves to such.
\r
4856 var WorkspaceSymbolRequest;
\r
4857 (function (WorkspaceSymbolRequest) {
\r
4858 WorkspaceSymbolRequest.method = 'workspace/symbol';
\r
4859 WorkspaceSymbolRequest.type = new messages_1.ProtocolRequestType(WorkspaceSymbolRequest.method);
\r
4860 /** @deprecated Use WorkspaceSymbolRequest.type */
\r
4861 WorkspaceSymbolRequest.resultType = new vscode_jsonrpc_1.ProgressType();
\r
4862 })(WorkspaceSymbolRequest = exports.WorkspaceSymbolRequest || (exports.WorkspaceSymbolRequest = {}));
\r
4864 * A request to provide code lens for the given text document.
\r
4866 var CodeLensRequest;
\r
4867 (function (CodeLensRequest) {
\r
4868 CodeLensRequest.type = new messages_1.ProtocolRequestType('textDocument/codeLens');
\r
4869 /** @deprecated Use CodeLensRequest.type */
\r
4870 CodeLensRequest.resultType = new vscode_jsonrpc_1.ProgressType();
\r
4871 })(CodeLensRequest = exports.CodeLensRequest || (exports.CodeLensRequest = {}));
\r
4873 * A request to resolve a command for a given code lens.
\r
4875 var CodeLensResolveRequest;
\r
4876 (function (CodeLensResolveRequest) {
\r
4877 CodeLensResolveRequest.type = new messages_1.ProtocolRequestType('codeLens/resolve');
\r
4878 })(CodeLensResolveRequest = exports.CodeLensResolveRequest || (exports.CodeLensResolveRequest = {}));
\r
4880 * A request to provide document links
\r
4882 var DocumentLinkRequest;
\r
4883 (function (DocumentLinkRequest) {
\r
4884 DocumentLinkRequest.method = 'textDocument/documentLink';
\r
4885 DocumentLinkRequest.type = new messages_1.ProtocolRequestType(DocumentLinkRequest.method);
\r
4886 /** @deprecated Use DocumentLinkRequest.type */
\r
4887 DocumentLinkRequest.resultType = new vscode_jsonrpc_1.ProgressType();
\r
4888 })(DocumentLinkRequest = exports.DocumentLinkRequest || (exports.DocumentLinkRequest = {}));
\r
4890 * Request to resolve additional information for a given document link. The request's
\r
4891 * parameter is of type [DocumentLink](#DocumentLink) the response
\r
4892 * is of type [DocumentLink](#DocumentLink) or a Thenable that resolves to such.
\r
4894 var DocumentLinkResolveRequest;
\r
4895 (function (DocumentLinkResolveRequest) {
\r
4896 DocumentLinkResolveRequest.type = new messages_1.ProtocolRequestType('documentLink/resolve');
\r
4897 })(DocumentLinkResolveRequest = exports.DocumentLinkResolveRequest || (exports.DocumentLinkResolveRequest = {}));
\r
4899 * A request to to format a whole document.
\r
4901 var DocumentFormattingRequest;
\r
4902 (function (DocumentFormattingRequest) {
\r
4903 DocumentFormattingRequest.method = 'textDocument/formatting';
\r
4904 DocumentFormattingRequest.type = new messages_1.ProtocolRequestType(DocumentFormattingRequest.method);
\r
4905 })(DocumentFormattingRequest = exports.DocumentFormattingRequest || (exports.DocumentFormattingRequest = {}));
\r
4907 * A request to to format a range in a document.
\r
4909 var DocumentRangeFormattingRequest;
\r
4910 (function (DocumentRangeFormattingRequest) {
\r
4911 DocumentRangeFormattingRequest.method = 'textDocument/rangeFormatting';
\r
4912 DocumentRangeFormattingRequest.type = new messages_1.ProtocolRequestType(DocumentRangeFormattingRequest.method);
\r
4913 })(DocumentRangeFormattingRequest = exports.DocumentRangeFormattingRequest || (exports.DocumentRangeFormattingRequest = {}));
\r
4915 * A request to format a document on type.
\r
4917 var DocumentOnTypeFormattingRequest;
\r
4918 (function (DocumentOnTypeFormattingRequest) {
\r
4919 DocumentOnTypeFormattingRequest.method = 'textDocument/onTypeFormatting';
\r
4920 DocumentOnTypeFormattingRequest.type = new messages_1.ProtocolRequestType(DocumentOnTypeFormattingRequest.method);
\r
4921 })(DocumentOnTypeFormattingRequest = exports.DocumentOnTypeFormattingRequest || (exports.DocumentOnTypeFormattingRequest = {}));
\r
4923 * A request to rename a symbol.
\r
4925 var RenameRequest;
\r
4926 (function (RenameRequest) {
\r
4927 RenameRequest.method = 'textDocument/rename';
\r
4928 RenameRequest.type = new messages_1.ProtocolRequestType(RenameRequest.method);
\r
4929 })(RenameRequest = exports.RenameRequest || (exports.RenameRequest = {}));
\r
4931 * A request to test and perform the setup necessary for a rename.
\r
4933 var PrepareRenameRequest;
\r
4934 (function (PrepareRenameRequest) {
\r
4935 PrepareRenameRequest.method = 'textDocument/prepareRename';
\r
4936 PrepareRenameRequest.type = new messages_1.ProtocolRequestType(PrepareRenameRequest.method);
\r
4937 })(PrepareRenameRequest = exports.PrepareRenameRequest || (exports.PrepareRenameRequest = {}));
\r
4939 * A request send from the client to the server to execute a command. The request might return
\r
4940 * a workspace edit which the client will apply to the workspace.
\r
4942 var ExecuteCommandRequest;
\r
4943 (function (ExecuteCommandRequest) {
\r
4944 ExecuteCommandRequest.type = new messages_1.ProtocolRequestType('workspace/executeCommand');
\r
4945 })(ExecuteCommandRequest = exports.ExecuteCommandRequest || (exports.ExecuteCommandRequest = {}));
\r
4947 * A request sent from the server to the client to modified certain resources.
\r
4949 var ApplyWorkspaceEditRequest;
\r
4950 (function (ApplyWorkspaceEditRequest) {
\r
4951 ApplyWorkspaceEditRequest.type = new messages_1.ProtocolRequestType('workspace/applyEdit');
\r
4952 })(ApplyWorkspaceEditRequest = exports.ApplyWorkspaceEditRequest || (exports.ApplyWorkspaceEditRequest = {}));
\r
4957 /***/ (function(module, exports, __webpack_require__) {
4960 /* --------------------------------------------------------------------------------------------
\r
4961 * Copyright (c) Microsoft Corporation. All rights reserved.
\r
4962 * Licensed under the MIT License. See License.txt in the project root for license information.
\r
4963 * ------------------------------------------------------------------------------------------ */
\r
4965 Object.defineProperty(exports, "__esModule", { value: true });
\r
4966 function boolean(value) {
\r
4967 return value === true || value === false;
\r
4969 exports.boolean = boolean;
\r
4970 function string(value) {
\r
4971 return typeof value === 'string' || value instanceof String;
\r
4973 exports.string = string;
\r
4974 function number(value) {
\r
4975 return typeof value === 'number' || value instanceof Number;
\r
4977 exports.number = number;
\r
4978 function error(value) {
\r
4979 return value instanceof Error;
\r
4981 exports.error = error;
\r
4982 function func(value) {
\r
4983 return typeof value === 'function';
\r
4985 exports.func = func;
\r
4986 function array(value) {
\r
4987 return Array.isArray(value);
\r
4989 exports.array = array;
\r
4990 function stringArray(value) {
\r
4991 return array(value) && value.every(elem => string(elem));
\r
4993 exports.stringArray = stringArray;
\r
4994 function typedArray(value, check) {
\r
4995 return Array.isArray(value) && value.every(check);
\r
4997 exports.typedArray = typedArray;
\r
4998 function objectLiteral(value) {
\r
4999 // Strictly speaking class instances pass this check as well. Since the LSP
\r
5000 // doesn't use classes we ignore this for now. If we do we need to add something
\r
5001 // like this: `Object.getPrototypeOf(Object.getPrototypeOf(x)) === null`
\r
5002 return value !== null && typeof value === 'object';
\r
5004 exports.objectLiteral = objectLiteral;
\r
5009 /***/ (function(module, exports, __webpack_require__) {
5012 /* --------------------------------------------------------------------------------------------
\r
5013 * Copyright (c) Microsoft Corporation. All rights reserved.
\r
5014 * Licensed under the MIT License. See License.txt in the project root for license information.
\r
5015 * ------------------------------------------------------------------------------------------ */
\r
5017 Object.defineProperty(exports, "__esModule", { value: true });
\r
5018 const vscode_jsonrpc_1 = __webpack_require__(5);
\r
5019 class ProtocolRequestType0 extends vscode_jsonrpc_1.RequestType0 {
\r
5020 constructor(method) {
\r
5024 exports.ProtocolRequestType0 = ProtocolRequestType0;
\r
5025 class ProtocolRequestType extends vscode_jsonrpc_1.RequestType {
\r
5026 constructor(method) {
\r
5030 exports.ProtocolRequestType = ProtocolRequestType;
\r
5031 class ProtocolNotificationType extends vscode_jsonrpc_1.NotificationType {
\r
5032 constructor(method) {
\r
5036 exports.ProtocolNotificationType = ProtocolNotificationType;
\r
5037 class ProtocolNotificationType0 extends vscode_jsonrpc_1.NotificationType0 {
\r
5038 constructor(method) {
\r
5042 exports.ProtocolNotificationType0 = ProtocolNotificationType0;
\r
5047 /***/ (function(module, exports, __webpack_require__) {
5050 /* --------------------------------------------------------------------------------------------
\r
5051 * Copyright (c) Microsoft Corporation. All rights reserved.
\r
5052 * Licensed under the MIT License. See License.txt in the project root for license information.
\r
5053 * ------------------------------------------------------------------------------------------ */
\r
5055 Object.defineProperty(exports, "__esModule", { value: true });
\r
5056 const vscode_jsonrpc_1 = __webpack_require__(5);
\r
5057 const messages_1 = __webpack_require__(21);
\r
5058 // @ts-ignore: to avoid inlining LocatioLink as dynamic import
\r
5059 let __noDynamicImport;
\r
5061 * A request to resolve the implementation locations of a symbol at a given text
\r
5062 * document position. The request's parameter is of type [TextDocumentPositioParams]
\r
5063 * (#TextDocumentPositionParams) the response is of type [Definition](#Definition) or a
\r
5064 * Thenable that resolves to such.
\r
5066 var ImplementationRequest;
\r
5067 (function (ImplementationRequest) {
\r
5068 ImplementationRequest.method = 'textDocument/implementation';
\r
5069 ImplementationRequest.type = new messages_1.ProtocolRequestType(ImplementationRequest.method);
\r
5070 /** @deprecated Use ImplementationRequest.type */
\r
5071 ImplementationRequest.resultType = new vscode_jsonrpc_1.ProgressType();
\r
5072 })(ImplementationRequest = exports.ImplementationRequest || (exports.ImplementationRequest = {}));
\r
5077 /***/ (function(module, exports, __webpack_require__) {
5080 /* --------------------------------------------------------------------------------------------
\r
5081 * Copyright (c) Microsoft Corporation. All rights reserved.
\r
5082 * Licensed under the MIT License. See License.txt in the project root for license information.
\r
5083 * ------------------------------------------------------------------------------------------ */
\r
5085 Object.defineProperty(exports, "__esModule", { value: true });
\r
5086 const vscode_jsonrpc_1 = __webpack_require__(5);
\r
5087 const messages_1 = __webpack_require__(21);
\r
5088 // @ts-ignore: to avoid inlining LocatioLink as dynamic import
\r
5089 let __noDynamicImport;
\r
5091 * A request to resolve the type definition locations of a symbol at a given text
\r
5092 * document position. The request's parameter is of type [TextDocumentPositioParams]
\r
5093 * (#TextDocumentPositionParams) the response is of type [Definition](#Definition) or a
\r
5094 * Thenable that resolves to such.
\r
5096 var TypeDefinitionRequest;
\r
5097 (function (TypeDefinitionRequest) {
\r
5098 TypeDefinitionRequest.method = 'textDocument/typeDefinition';
\r
5099 TypeDefinitionRequest.type = new messages_1.ProtocolRequestType(TypeDefinitionRequest.method);
\r
5100 /** @deprecated Use TypeDefinitionRequest.type */
\r
5101 TypeDefinitionRequest.resultType = new vscode_jsonrpc_1.ProgressType();
\r
5102 })(TypeDefinitionRequest = exports.TypeDefinitionRequest || (exports.TypeDefinitionRequest = {}));
\r
5107 /***/ (function(module, exports, __webpack_require__) {
5110 /* --------------------------------------------------------------------------------------------
\r
5111 * Copyright (c) Microsoft Corporation. All rights reserved.
\r
5112 * Licensed under the MIT License. See License.txt in the project root for license information.
\r
5113 * ------------------------------------------------------------------------------------------ */
\r
5115 Object.defineProperty(exports, "__esModule", { value: true });
\r
5116 const messages_1 = __webpack_require__(21);
\r
5118 * The `workspace/workspaceFolders` is sent from the server to the client to fetch the open workspace folders.
\r
5120 var WorkspaceFoldersRequest;
\r
5121 (function (WorkspaceFoldersRequest) {
\r
5122 WorkspaceFoldersRequest.type = new messages_1.ProtocolRequestType0('workspace/workspaceFolders');
\r
5123 })(WorkspaceFoldersRequest = exports.WorkspaceFoldersRequest || (exports.WorkspaceFoldersRequest = {}));
\r
5125 * The `workspace/didChangeWorkspaceFolders` notification is sent from the client to the server when the workspace
\r
5126 * folder configuration changes.
\r
5128 var DidChangeWorkspaceFoldersNotification;
\r
5129 (function (DidChangeWorkspaceFoldersNotification) {
\r
5130 DidChangeWorkspaceFoldersNotification.type = new messages_1.ProtocolNotificationType('workspace/didChangeWorkspaceFolders');
\r
5131 })(DidChangeWorkspaceFoldersNotification = exports.DidChangeWorkspaceFoldersNotification || (exports.DidChangeWorkspaceFoldersNotification = {}));
\r
5136 /***/ (function(module, exports, __webpack_require__) {
5139 /* --------------------------------------------------------------------------------------------
\r
5140 * Copyright (c) Microsoft Corporation. All rights reserved.
\r
5141 * Licensed under the MIT License. See License.txt in the project root for license information.
\r
5142 * ------------------------------------------------------------------------------------------ */
\r
5144 Object.defineProperty(exports, "__esModule", { value: true });
\r
5145 const messages_1 = __webpack_require__(21);
\r
5147 * The 'workspace/configuration' request is sent from the server to the client to fetch a certain
\r
5148 * configuration setting.
\r
5150 * This pull model replaces the old push model were the client signaled configuration change via an
\r
5151 * event. If the server still needs to react to configuration changes (since the server caches the
\r
5152 * result of `workspace/configuration` requests) the server should register for an empty configuration
\r
5153 * change event and empty the cache if such an event is received.
\r
5155 var ConfigurationRequest;
\r
5156 (function (ConfigurationRequest) {
\r
5157 ConfigurationRequest.type = new messages_1.ProtocolRequestType('workspace/configuration');
\r
5158 })(ConfigurationRequest = exports.ConfigurationRequest || (exports.ConfigurationRequest = {}));
\r
5163 /***/ (function(module, exports, __webpack_require__) {
5166 /* --------------------------------------------------------------------------------------------
\r
5167 * Copyright (c) Microsoft Corporation. All rights reserved.
\r
5168 * Licensed under the MIT License. See License.txt in the project root for license information.
\r
5169 * ------------------------------------------------------------------------------------------ */
\r
5171 Object.defineProperty(exports, "__esModule", { value: true });
\r
5172 const vscode_jsonrpc_1 = __webpack_require__(5);
\r
5173 const messages_1 = __webpack_require__(21);
\r
5175 * A request to list all color symbols found in a given text document. The request's
\r
5176 * parameter is of type [DocumentColorParams](#DocumentColorParams) the
\r
5177 * response is of type [ColorInformation[]](#ColorInformation) or a Thenable
\r
5178 * that resolves to such.
\r
5180 var DocumentColorRequest;
\r
5181 (function (DocumentColorRequest) {
\r
5182 DocumentColorRequest.method = 'textDocument/documentColor';
\r
5183 DocumentColorRequest.type = new messages_1.ProtocolRequestType(DocumentColorRequest.method);
\r
5184 /** @deprecated Use DocumentColorRequest.type */
\r
5185 DocumentColorRequest.resultType = new vscode_jsonrpc_1.ProgressType();
\r
5186 })(DocumentColorRequest = exports.DocumentColorRequest || (exports.DocumentColorRequest = {}));
\r
5188 * A request to list all presentation for a color. The request's
\r
5189 * parameter is of type [ColorPresentationParams](#ColorPresentationParams) the
\r
5190 * response is of type [ColorInformation[]](#ColorInformation) or a Thenable
\r
5191 * that resolves to such.
\r
5193 var ColorPresentationRequest;
\r
5194 (function (ColorPresentationRequest) {
\r
5195 ColorPresentationRequest.type = new messages_1.ProtocolRequestType('textDocument/colorPresentation');
\r
5196 })(ColorPresentationRequest = exports.ColorPresentationRequest || (exports.ColorPresentationRequest = {}));
\r
5201 /***/ (function(module, exports, __webpack_require__) {
5205 /*---------------------------------------------------------------------------------------------
\r
5206 * Copyright (c) Microsoft Corporation. All rights reserved.
\r
5207 * Licensed under the MIT License. See License.txt in the project root for license information.
\r
5208 *--------------------------------------------------------------------------------------------*/
\r
5209 Object.defineProperty(exports, "__esModule", { value: true });
\r
5210 const vscode_jsonrpc_1 = __webpack_require__(5);
\r
5211 const messages_1 = __webpack_require__(21);
\r
5213 * Enum of known range kinds
\r
5215 var FoldingRangeKind;
\r
5216 (function (FoldingRangeKind) {
\r
5218 * Folding range for a comment
\r
5220 FoldingRangeKind["Comment"] = "comment";
\r
5222 * Folding range for a imports or includes
\r
5224 FoldingRangeKind["Imports"] = "imports";
\r
5226 * Folding range for a region (e.g. `#region`)
\r
5228 FoldingRangeKind["Region"] = "region";
\r
5229 })(FoldingRangeKind = exports.FoldingRangeKind || (exports.FoldingRangeKind = {}));
\r
5231 * A request to provide folding ranges in a document. The request's
\r
5232 * parameter is of type [FoldingRangeParams](#FoldingRangeParams), the
\r
5233 * response is of type [FoldingRangeList](#FoldingRangeList) or a Thenable
\r
5234 * that resolves to such.
\r
5236 var FoldingRangeRequest;
\r
5237 (function (FoldingRangeRequest) {
\r
5238 FoldingRangeRequest.method = 'textDocument/foldingRange';
\r
5239 FoldingRangeRequest.type = new messages_1.ProtocolRequestType(FoldingRangeRequest.method);
\r
5240 /** @deprecated Use FoldingRangeRequest.type */
\r
5241 FoldingRangeRequest.resultType = new vscode_jsonrpc_1.ProgressType();
\r
5242 })(FoldingRangeRequest = exports.FoldingRangeRequest || (exports.FoldingRangeRequest = {}));
\r
5247 /***/ (function(module, exports, __webpack_require__) {
5250 /* --------------------------------------------------------------------------------------------
\r
5251 * Copyright (c) Microsoft Corporation. All rights reserved.
\r
5252 * Licensed under the MIT License. See License.txt in the project root for license information.
\r
5253 * ------------------------------------------------------------------------------------------ */
\r
5255 Object.defineProperty(exports, "__esModule", { value: true });
\r
5256 const vscode_jsonrpc_1 = __webpack_require__(5);
\r
5257 const messages_1 = __webpack_require__(21);
\r
5258 // @ts-ignore: to avoid inlining LocatioLink as dynamic import
\r
5259 let __noDynamicImport;
\r
5261 * A request to resolve the type definition locations of a symbol at a given text
\r
5262 * document position. The request's parameter is of type [TextDocumentPositioParams]
\r
5263 * (#TextDocumentPositionParams) the response is of type [Declaration](#Declaration)
\r
5264 * or a typed array of [DeclarationLink](#DeclarationLink) or a Thenable that resolves
\r
5267 var DeclarationRequest;
\r
5268 (function (DeclarationRequest) {
\r
5269 DeclarationRequest.method = 'textDocument/declaration';
\r
5270 DeclarationRequest.type = new messages_1.ProtocolRequestType(DeclarationRequest.method);
\r
5271 /** @deprecated Use DeclarationRequest.type */
\r
5272 DeclarationRequest.resultType = new vscode_jsonrpc_1.ProgressType();
\r
5273 })(DeclarationRequest = exports.DeclarationRequest || (exports.DeclarationRequest = {}));
\r
5278 /***/ (function(module, exports, __webpack_require__) {
5282 /*---------------------------------------------------------------------------------------------
\r
5283 * Copyright (c) Microsoft Corporation. All rights reserved.
\r
5284 * Licensed under the MIT License. See License.txt in the project root for license information.
\r
5285 *--------------------------------------------------------------------------------------------*/
\r
5286 Object.defineProperty(exports, "__esModule", { value: true });
\r
5287 const vscode_jsonrpc_1 = __webpack_require__(5);
\r
5288 const messages_1 = __webpack_require__(21);
\r
5290 * A request to provide selection ranges in a document. The request's
\r
5291 * parameter is of type [SelectionRangeParams](#SelectionRangeParams), the
\r
5292 * response is of type [SelectionRange[]](#SelectionRange[]) or a Thenable
\r
5293 * that resolves to such.
\r
5295 var SelectionRangeRequest;
\r
5296 (function (SelectionRangeRequest) {
\r
5297 SelectionRangeRequest.method = 'textDocument/selectionRange';
\r
5298 SelectionRangeRequest.type = new messages_1.ProtocolRequestType(SelectionRangeRequest.method);
\r
5299 /** @deprecated Use SelectionRangeRequest.type */
\r
5300 SelectionRangeRequest.resultType = new vscode_jsonrpc_1.ProgressType();
\r
5301 })(SelectionRangeRequest = exports.SelectionRangeRequest || (exports.SelectionRangeRequest = {}));
\r
5306 /***/ (function(module, exports, __webpack_require__) {
5309 /* --------------------------------------------------------------------------------------------
\r
5310 * Copyright (c) Microsoft Corporation. All rights reserved.
\r
5311 * Licensed under the MIT License. See License.txt in the project root for license information.
\r
5312 * ------------------------------------------------------------------------------------------ */
\r
5314 Object.defineProperty(exports, "__esModule", { value: true });
\r
5315 const vscode_jsonrpc_1 = __webpack_require__(5);
\r
5316 const messages_1 = __webpack_require__(21);
\r
5317 var WorkDoneProgress;
\r
5318 (function (WorkDoneProgress) {
\r
5319 WorkDoneProgress.type = new vscode_jsonrpc_1.ProgressType();
\r
5320 })(WorkDoneProgress = exports.WorkDoneProgress || (exports.WorkDoneProgress = {}));
\r
5322 * The `window/workDoneProgress/create` request is sent from the server to the client to initiate progress
\r
5323 * reporting from the server.
\r
5325 var WorkDoneProgressCreateRequest;
\r
5326 (function (WorkDoneProgressCreateRequest) {
\r
5327 WorkDoneProgressCreateRequest.type = new messages_1.ProtocolRequestType('window/workDoneProgress/create');
\r
5328 })(WorkDoneProgressCreateRequest = exports.WorkDoneProgressCreateRequest || (exports.WorkDoneProgressCreateRequest = {}));
\r
5330 * The `window/workDoneProgress/cancel` notification is sent from the client to the server to cancel a progress
\r
5331 * initiated on the server side.
\r
5333 var WorkDoneProgressCancelNotification;
\r
5334 (function (WorkDoneProgressCancelNotification) {
\r
5335 WorkDoneProgressCancelNotification.type = new messages_1.ProtocolNotificationType('window/workDoneProgress/cancel');
\r
5336 })(WorkDoneProgressCancelNotification = exports.WorkDoneProgressCancelNotification || (exports.WorkDoneProgressCancelNotification = {}));
\r
5341 /***/ (function(module, exports, __webpack_require__) {
5344 /* --------------------------------------------------------------------------------------------
\r
5345 * Copyright (c) TypeFox and others. All rights reserved.
\r
5346 * Licensed under the MIT License. See License.txt in the project root for license information.
\r
5347 * ------------------------------------------------------------------------------------------ */
\r
5349 Object.defineProperty(exports, "__esModule", { value: true });
\r
5350 const messages_1 = __webpack_require__(21);
\r
5352 * A request to result a `CallHierarchyItem` in a document at a given position.
\r
5353 * Can be used as an input to a incoming or outgoing call hierarchy.
\r
5355 * @since 3.16.0 - Proposed state
\r
5357 var CallHierarchyPrepareRequest;
\r
5358 (function (CallHierarchyPrepareRequest) {
\r
5359 CallHierarchyPrepareRequest.method = 'textDocument/prepareCallHierarchy';
\r
5360 CallHierarchyPrepareRequest.type = new messages_1.ProtocolRequestType(CallHierarchyPrepareRequest.method);
\r
5361 })(CallHierarchyPrepareRequest = exports.CallHierarchyPrepareRequest || (exports.CallHierarchyPrepareRequest = {}));
\r
5363 * A request to resolve the incoming calls for a given `CallHierarchyItem`.
\r
5365 * @since 3.16.0 - Proposed state
\r
5367 var CallHierarchyIncomingCallsRequest;
\r
5368 (function (CallHierarchyIncomingCallsRequest) {
\r
5369 CallHierarchyIncomingCallsRequest.method = 'callHierarchy/incomingCalls';
\r
5370 CallHierarchyIncomingCallsRequest.type = new messages_1.ProtocolRequestType(CallHierarchyIncomingCallsRequest.method);
\r
5371 })(CallHierarchyIncomingCallsRequest = exports.CallHierarchyIncomingCallsRequest || (exports.CallHierarchyIncomingCallsRequest = {}));
\r
5373 * A request to resolve the outgoing calls for a given `CallHierarchyItem`.
\r
5375 * @since 3.16.0 - Proposed state
\r
5377 var CallHierarchyOutgoingCallsRequest;
\r
5378 (function (CallHierarchyOutgoingCallsRequest) {
\r
5379 CallHierarchyOutgoingCallsRequest.method = 'callHierarchy/outgoingCalls';
\r
5380 CallHierarchyOutgoingCallsRequest.type = new messages_1.ProtocolRequestType(CallHierarchyOutgoingCallsRequest.method);
\r
5381 })(CallHierarchyOutgoingCallsRequest = exports.CallHierarchyOutgoingCallsRequest || (exports.CallHierarchyOutgoingCallsRequest = {}));
\r
5386 /***/ (function(module, exports, __webpack_require__) {
5389 /* --------------------------------------------------------------------------------------------
\r
5390 * Copyright (c) Microsoft Corporation. All rights reserved.
\r
5391 * Licensed under the MIT License. See License.txt in the project root for license information.
\r
5392 * ------------------------------------------------------------------------------------------ */
\r
5394 Object.defineProperty(exports, "__esModule", { value: true });
\r
5395 const messages_1 = __webpack_require__(21);
\r
5397 * A set of predefined token types. This set is not fixed
\r
5398 * an clients can specify additional token types via the
\r
5399 * corresponding client capabilities.
\r
5401 * @since 3.16.0 - Proposed state
\r
5403 var SemanticTokenTypes;
\r
5404 (function (SemanticTokenTypes) {
\r
5405 SemanticTokenTypes["comment"] = "comment";
\r
5406 SemanticTokenTypes["keyword"] = "keyword";
\r
5407 SemanticTokenTypes["string"] = "string";
\r
5408 SemanticTokenTypes["number"] = "number";
\r
5409 SemanticTokenTypes["regexp"] = "regexp";
\r
5410 SemanticTokenTypes["operator"] = "operator";
\r
5411 SemanticTokenTypes["namespace"] = "namespace";
\r
5412 SemanticTokenTypes["type"] = "type";
\r
5413 SemanticTokenTypes["struct"] = "struct";
\r
5414 SemanticTokenTypes["class"] = "class";
\r
5415 SemanticTokenTypes["interface"] = "interface";
\r
5416 SemanticTokenTypes["enum"] = "enum";
\r
5417 SemanticTokenTypes["typeParameter"] = "typeParameter";
\r
5418 SemanticTokenTypes["function"] = "function";
\r
5419 SemanticTokenTypes["member"] = "member";
\r
5420 SemanticTokenTypes["property"] = "property";
\r
5421 SemanticTokenTypes["macro"] = "macro";
\r
5422 SemanticTokenTypes["variable"] = "variable";
\r
5423 SemanticTokenTypes["parameter"] = "parameter";
\r
5424 SemanticTokenTypes["label"] = "label";
\r
5425 })(SemanticTokenTypes = exports.SemanticTokenTypes || (exports.SemanticTokenTypes = {}));
\r
5427 * A set of predefined token modifiers. This set is not fixed
\r
5428 * an clients can specify additional token types via the
\r
5429 * corresponding client capabilities.
\r
5431 * @since 3.16.0 - Proposed state
\r
5433 var SemanticTokenModifiers;
\r
5434 (function (SemanticTokenModifiers) {
\r
5435 SemanticTokenModifiers["documentation"] = "documentation";
\r
5436 SemanticTokenModifiers["declaration"] = "declaration";
\r
5437 SemanticTokenModifiers["definition"] = "definition";
\r
5438 SemanticTokenModifiers["reference"] = "reference";
\r
5439 SemanticTokenModifiers["static"] = "static";
\r
5440 SemanticTokenModifiers["abstract"] = "abstract";
\r
5441 SemanticTokenModifiers["deprecated"] = "deprecated";
\r
5442 SemanticTokenModifiers["async"] = "async";
\r
5443 SemanticTokenModifiers["volatile"] = "volatile";
\r
5444 SemanticTokenModifiers["readonly"] = "readonly";
\r
5445 })(SemanticTokenModifiers = exports.SemanticTokenModifiers || (exports.SemanticTokenModifiers = {}));
\r
5447 * @since 3.16.0 - Proposed state
\r
5449 var SemanticTokens;
\r
5450 (function (SemanticTokens) {
\r
5451 function is(value) {
\r
5452 const candidate = value;
\r
5453 return candidate !== undefined && (candidate.resultId === undefined || typeof candidate.resultId === 'string') &&
\r
5454 Array.isArray(candidate.data) && (candidate.data.length === 0 || typeof candidate.data[0] === 'number');
\r
5456 SemanticTokens.is = is;
\r
5457 })(SemanticTokens = exports.SemanticTokens || (exports.SemanticTokens = {}));
\r
5459 * @since 3.16.0 - Proposed state
\r
5461 var SemanticTokensRequest;
\r
5462 (function (SemanticTokensRequest) {
\r
5463 SemanticTokensRequest.method = 'textDocument/semanticTokens';
\r
5464 SemanticTokensRequest.type = new messages_1.ProtocolRequestType(SemanticTokensRequest.method);
\r
5465 })(SemanticTokensRequest = exports.SemanticTokensRequest || (exports.SemanticTokensRequest = {}));
\r
5467 * @since 3.16.0 - Proposed state
\r
5469 var SemanticTokensEditsRequest;
\r
5470 (function (SemanticTokensEditsRequest) {
\r
5471 SemanticTokensEditsRequest.method = 'textDocument/semanticTokens/edits';
\r
5472 SemanticTokensEditsRequest.type = new messages_1.ProtocolRequestType(SemanticTokensEditsRequest.method);
\r
5473 })(SemanticTokensEditsRequest = exports.SemanticTokensEditsRequest || (exports.SemanticTokensEditsRequest = {}));
\r
5475 * @since 3.16.0 - Proposed state
\r
5477 var SemanticTokensRangeRequest;
\r
5478 (function (SemanticTokensRangeRequest) {
\r
5479 SemanticTokensRangeRequest.method = 'textDocument/semanticTokens/range';
\r
5480 SemanticTokensRangeRequest.type = new messages_1.ProtocolRequestType(SemanticTokensRangeRequest.method);
\r
5481 })(SemanticTokensRangeRequest = exports.SemanticTokensRangeRequest || (exports.SemanticTokensRangeRequest = {}));
\r
5486 /***/ (function(module, exports, __webpack_require__) {
5490 /*---------------------------------------------------------------------------------------------
5491 * Copyright (c) Microsoft Corporation. All rights reserved.
5492 * Licensed under the MIT License. See License.txt in the project root for license information.
5493 *--------------------------------------------------------------------------------------------*/
5494 var __importDefault = (this && this.__importDefault) || function (mod) {
5495 return (mod && mod.__esModule) ? mod : { "default": mod };
5497 Object.defineProperty(exports, "__esModule", { value: true });
5498 exports.joinPath = exports.normalizePath = exports.resolvePath = exports.FileType = void 0;
5499 const path_1 = __importDefault(__webpack_require__(3));
5501 (function (FileType) {
5503 * The file type is unknown.
5505 FileType[FileType["Unknown"] = 0] = "Unknown";
5509 FileType[FileType["File"] = 1] = "File";
5513 FileType[FileType["Directory"] = 2] = "Directory";
5515 * A symbolic link to a file.
5517 FileType[FileType["SymbolicLink"] = 64] = "SymbolicLink";
5518 })(FileType = exports.FileType || (exports.FileType = {}));
5519 const Dot = '.'.charCodeAt(0);
5520 function resolvePath(uri, p) {
5521 if (path_1.default.isAbsolute(p)) {
5522 return uri.with({ path: normalizePath(p.split('/')) });
5524 return joinPath(uri, p);
5526 exports.resolvePath = resolvePath;
5527 function normalizePath(parts) {
5528 const newParts = [];
5529 for (const part of parts) {
5530 if (part.length === 0 || part.length === 1 && part.charCodeAt(0) === Dot) {
5533 else if (part.length === 2 && part.charCodeAt(0) === Dot && part.charCodeAt(1) === Dot) {
5537 newParts.push(part);
5540 if (parts.length > 1 && parts[parts.length - 1].length === 0) {
5543 let res = newParts.join('/');
5544 if (parts[0].length === 0) {
5549 exports.normalizePath = normalizePath;
5550 function joinPath(uri, ...paths) {
5551 const parts = uri.path.split('/');
5552 for (let path of paths) {
5553 parts.push(...path.split('/'));
5555 return uri.with({ path: normalizePath(parts) });
5557 exports.joinPath = joinPath;