@codingame/monaco-languageclient-wrapper 5.0.0-next.1 → 5.0.0-update-monaco.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_virtual/_commonjsHelpers.js +1 -4
- package/dist/_virtual/_rollupPluginBabelHelpers.js +29 -29
- package/dist/_virtual/main3.js +4 -2
- package/dist/_virtual/protocol.inlineCompletion.js +2 -0
- package/dist/extensions/java/extension.js +1 -1
- package/dist/extensions/java/inlayHintsProvider.js +3 -4
- package/dist/extensions/java/protocol.js +15 -16
- package/dist/extensions/java/sourceAction.js +1 -1
- package/dist/index.d.ts +132 -9212
- package/dist/node_modules/delay/index.js +1 -2
- package/dist/node_modules/vscode-jsonrpc/browser.js +1 -1
- package/dist/node_modules/vscode-jsonrpc/lib/browser/main.js +1 -1
- package/dist/node_modules/vscode-jsonrpc/lib/common/api.js +1 -1
- package/dist/node_modules/vscode-jsonrpc/lib/common/cancellation.js +84 -86
- package/dist/node_modules/vscode-jsonrpc/lib/common/connection.js +19 -17
- package/dist/node_modules/vscode-jsonrpc/lib/common/disposable.js +11 -12
- package/dist/node_modules/vscode-jsonrpc/lib/common/events.js +112 -113
- package/dist/node_modules/vscode-jsonrpc/lib/common/is.js +1 -1
- package/dist/node_modules/vscode-jsonrpc/lib/common/linkedMap.js +378 -380
- package/dist/node_modules/vscode-jsonrpc/lib/common/messageBuffer.js +1 -1
- package/dist/node_modules/vscode-jsonrpc/lib/common/messageReader.js +186 -182
- package/dist/node_modules/vscode-jsonrpc/lib/common/messageWriter.js +110 -111
- package/dist/node_modules/vscode-jsonrpc/lib/common/messages.js +231 -232
- package/dist/node_modules/vscode-languageserver-protocol/lib/browser/main.js +1 -1
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/api.js +5 -4
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/connection.js +1 -1
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/messages.js +41 -41
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.callHierarchy.js +22 -20
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.colorProvider.js +16 -15
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.configuration.js +10 -10
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.declaration.js +10 -10
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.diagnostic.js +41 -37
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.fileOperations.js +45 -39
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.foldingRange.js +16 -10
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.implementation.js +10 -10
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.inlayHint.js +22 -20
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.inlineCompletion.js +13 -0
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.inlineValue.js +16 -15
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.js +141 -69
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.linkedEditingRange.js +10 -10
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.moniker.js +24 -22
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.notebook.js +186 -181
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.progress.js +26 -24
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.selectionRange.js +10 -10
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.semanticTokens.js +40 -36
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.showDocument.js +10 -10
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.typeDefinition.js +10 -10
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.typeHierarchy.js +22 -20
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.workspaceFolder.js +16 -15
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/utils/is.js +1 -1
- package/dist/node_modules/vscode-languageserver-types/lib/esm/main.js +363 -338
- package/dist/src/createLanguageClient.js +41 -16
- package/dist/src/extensions/cobol.js +3 -3
- package/dist/src/extensions/tools.js +5 -1
- package/dist/src/extensions.js +6 -3
- package/dist/src/infrastructure.js +17 -2
- package/dist/src/languageClient.js +10 -12
- package/package.json +56 -52
- package/stats.html +32 -28
- package/dist/_virtual/_vscode.js +0 -4
- package/dist/_virtual/api3.js +0 -2
- package/dist/_virtual/async.js +0 -2
- package/dist/_virtual/callHierarchy.js +0 -2
- package/dist/_virtual/client.js +0 -2
- package/dist/_virtual/codeAction.js +0 -2
- package/dist/_virtual/codeConverter.js +0 -2
- package/dist/_virtual/codeLens.js +0 -2
- package/dist/_virtual/colorProvider.js +0 -2
- package/dist/_virtual/completion.js +0 -2
- package/dist/_virtual/configuration.js +0 -2
- package/dist/_virtual/declaration.js +0 -2
- package/dist/_virtual/definition.js +0 -2
- package/dist/_virtual/diagnostic.js +0 -2
- package/dist/_virtual/documentHighlight.js +0 -2
- package/dist/_virtual/documentLink.js +0 -2
- package/dist/_virtual/documentSymbol.js +0 -2
- package/dist/_virtual/executeCommand.js +0 -2
- package/dist/_virtual/features.js +0 -2
- package/dist/_virtual/fileOperations.js +0 -2
- package/dist/_virtual/fileSystemWatcher.js +0 -2
- package/dist/_virtual/foldingRange.js +0 -2
- package/dist/_virtual/formatting.js +0 -2
- package/dist/_virtual/hover.js +0 -2
- package/dist/_virtual/implementation.js +0 -2
- package/dist/_virtual/inlayHint.js +0 -2
- package/dist/_virtual/inlineValue.js +0 -2
- package/dist/_virtual/is3.js +0 -2
- package/dist/_virtual/linkedEditingRange.js +0 -2
- package/dist/_virtual/main4.js +0 -4
- package/dist/_virtual/notebook.js +0 -2
- package/dist/_virtual/path.js +0 -4
- package/dist/_virtual/progress.js +0 -2
- package/dist/_virtual/progressPart.js +0 -2
- package/dist/_virtual/protocolCallHierarchyItem.js +0 -2
- package/dist/_virtual/protocolCodeAction.js +0 -2
- package/dist/_virtual/protocolCodeLens.js +0 -2
- package/dist/_virtual/protocolCompletionItem.js +0 -2
- package/dist/_virtual/protocolConverter.js +0 -2
- package/dist/_virtual/protocolDiagnostic.js +0 -2
- package/dist/_virtual/protocolDocumentLink.js +0 -2
- package/dist/_virtual/protocolInlayHint.js +0 -2
- package/dist/_virtual/protocolTypeHierarchyItem.js +0 -2
- package/dist/_virtual/protocolWorkspaceSymbol.js +0 -2
- package/dist/_virtual/reference.js +0 -2
- package/dist/_virtual/rename.js +0 -2
- package/dist/_virtual/selectionRange.js +0 -2
- package/dist/_virtual/semanticTokens.js +0 -2
- package/dist/_virtual/signatureHelp.js +0 -2
- package/dist/_virtual/textSynchronization.js +0 -2
- package/dist/_virtual/typeDefinition.js +0 -2
- package/dist/_virtual/typeHierarchy.js +0 -2
- package/dist/_virtual/uuid.js +0 -2
- package/dist/_virtual/workspaceFolder.js +0 -2
- package/dist/_virtual/workspaceSymbol.js +0 -2
- package/dist/node_modules/balanced-match/index.js +0 -52
- package/dist/node_modules/monaco-languageclient/lib/monaco-language-client.js +0 -127
- package/dist/node_modules/vscode-languageclient/lib/browser/main.js +0 -49
- package/dist/node_modules/vscode-languageclient/lib/common/api.js +0 -51
- package/dist/node_modules/vscode-languageclient/lib/common/callHierarchy.js +0 -98
- package/dist/node_modules/vscode-languageclient/lib/common/client.js +0 -1527
- package/dist/node_modules/vscode-languageclient/lib/common/codeAction.js +0 -92
- package/dist/node_modules/vscode-languageclient/lib/common/codeConverter.js +0 -881
- package/dist/node_modules/vscode-languageclient/lib/common/codeLens.js +0 -84
- package/dist/node_modules/vscode-languageclient/lib/common/colorProvider.js +0 -77
- package/dist/node_modules/vscode-languageclient/lib/common/completion.js +0 -105
- package/dist/node_modules/vscode-languageclient/lib/common/configuration.js +0 -214
- package/dist/node_modules/vscode-languageclient/lib/common/declaration.js +0 -59
- package/dist/node_modules/vscode-languageclient/lib/common/definition.js +0 -62
- package/dist/node_modules/vscode-languageclient/lib/common/diagnostic.js +0 -839
- package/dist/node_modules/vscode-languageclient/lib/common/documentHighlight.js +0 -57
- package/dist/node_modules/vscode-languageclient/lib/common/documentLink.js +0 -74
- package/dist/node_modules/vscode-languageclient/lib/common/documentSymbol.js +0 -82
- package/dist/node_modules/vscode-languageclient/lib/common/executeCommand.js +0 -83
- package/dist/node_modules/vscode-languageclient/lib/common/features.js +0 -310
- package/dist/node_modules/vscode-languageclient/lib/common/fileOperations.js +0 -319
- package/dist/node_modules/vscode-languageclient/lib/common/fileSystemWatcher.js +0 -104
- package/dist/node_modules/vscode-languageclient/lib/common/foldingRange.js +0 -66
- package/dist/node_modules/vscode-languageclient/lib/common/formatting.js +0 -165
- package/dist/node_modules/vscode-languageclient/lib/common/hover.js +0 -62
- package/dist/node_modules/vscode-languageclient/lib/common/implementation.js +0 -59
- package/dist/node_modules/vscode-languageclient/lib/common/inlayHint.js +0 -94
- package/dist/node_modules/vscode-languageclient/lib/common/inlineValue.js +0 -73
- package/dist/node_modules/vscode-languageclient/lib/common/linkedEditingRange.js +0 -58
- package/dist/node_modules/vscode-languageclient/lib/common/notebook.js +0 -858
- package/dist/node_modules/vscode-languageclient/lib/common/progress.js +0 -51
- package/dist/node_modules/vscode-languageclient/lib/common/progressPart.js +0 -107
- package/dist/node_modules/vscode-languageclient/lib/common/protocolCallHierarchyItem.js +0 -15
- package/dist/node_modules/vscode-languageclient/lib/common/protocolCodeAction.js +0 -13
- package/dist/node_modules/vscode-languageclient/lib/common/protocolCodeLens.js +0 -12
- package/dist/node_modules/vscode-languageclient/lib/common/protocolCompletionItem.js +0 -12
- package/dist/node_modules/vscode-languageclient/lib/common/protocolConverter.js +0 -1129
- package/dist/node_modules/vscode-languageclient/lib/common/protocolDiagnostic.js +0 -27
- package/dist/node_modules/vscode-languageclient/lib/common/protocolDocumentLink.js +0 -12
- package/dist/node_modules/vscode-languageclient/lib/common/protocolInlayHint.js +0 -12
- package/dist/node_modules/vscode-languageclient/lib/common/protocolTypeHierarchyItem.js +0 -15
- package/dist/node_modules/vscode-languageclient/lib/common/protocolWorkspaceSymbol.js +0 -17
- package/dist/node_modules/vscode-languageclient/lib/common/reference.js +0 -60
- package/dist/node_modules/vscode-languageclient/lib/common/rename.js +0 -112
- package/dist/node_modules/vscode-languageclient/lib/common/selectionRange.js +0 -62
- package/dist/node_modules/vscode-languageclient/lib/common/semanticTokens.js +0 -144
- package/dist/node_modules/vscode-languageclient/lib/common/signatureHelp.js +0 -78
- package/dist/node_modules/vscode-languageclient/lib/common/textSynchronization.js +0 -422
- package/dist/node_modules/vscode-languageclient/lib/common/typeDefinition.js +0 -60
- package/dist/node_modules/vscode-languageclient/lib/common/typeHierarchy.js +0 -97
- package/dist/node_modules/vscode-languageclient/lib/common/utils/async.js +0 -269
- package/dist/node_modules/vscode-languageclient/lib/common/utils/is.js +0 -54
- package/dist/node_modules/vscode-languageclient/lib/common/utils/uuid.js +0 -51
- package/dist/node_modules/vscode-languageclient/lib/common/workspaceFolder.js +0 -154
- package/dist/node_modules/vscode-languageclient/lib/common/workspaceSymbol.js +0 -87
- package/dist/node_modules/vscode-languageclient/node_modules/brace-expansion/index.js +0 -160
- package/dist/node_modules/vscode-languageclient/node_modules/minimatch/lib/path.js +0 -2
- package/dist/node_modules/vscode-languageclient/node_modules/minimatch/minimatch.js +0 -567
- package/dist/node_modules/vscode-languageserver-protocol/browser.js +0 -4
|
@@ -1,1527 +0,0 @@
|
|
|
1
|
-
import { __exports as client } from '../../../../_virtual/client.js';
|
|
2
|
-
import require$$0 from '../../../../_virtual/_vscode.js';
|
|
3
|
-
import { __exports as main } from '../../../../_virtual/main.js';
|
|
4
|
-
import '../../../vscode-languageserver-protocol/lib/browser/main.js';
|
|
5
|
-
import { __exports as codeConverter } from '../../../../_virtual/codeConverter.js';
|
|
6
|
-
import './codeConverter.js';
|
|
7
|
-
import { __exports as protocolConverter } from '../../../../_virtual/protocolConverter.js';
|
|
8
|
-
import './protocolConverter.js';
|
|
9
|
-
import { __exports as is } from '../../../../_virtual/is.js';
|
|
10
|
-
import './utils/is.js';
|
|
11
|
-
import { __exports as async } from '../../../../_virtual/async.js';
|
|
12
|
-
import './utils/async.js';
|
|
13
|
-
import { __exports as uuid } from '../../../../_virtual/uuid.js';
|
|
14
|
-
import './utils/uuid.js';
|
|
15
|
-
import { __exports as progressPart } from '../../../../_virtual/progressPart.js';
|
|
16
|
-
import './progressPart.js';
|
|
17
|
-
import { __exports as features } from '../../../../_virtual/features.js';
|
|
18
|
-
import './features.js';
|
|
19
|
-
import { __exports as diagnostic } from '../../../../_virtual/diagnostic.js';
|
|
20
|
-
import './diagnostic.js';
|
|
21
|
-
import { __exports as notebook } from '../../../../_virtual/notebook.js';
|
|
22
|
-
import './notebook.js';
|
|
23
|
-
import { __exports as configuration } from '../../../../_virtual/configuration.js';
|
|
24
|
-
import './configuration.js';
|
|
25
|
-
import { __exports as textSynchronization } from '../../../../_virtual/textSynchronization.js';
|
|
26
|
-
import './textSynchronization.js';
|
|
27
|
-
import { __exports as completion } from '../../../../_virtual/completion.js';
|
|
28
|
-
import './completion.js';
|
|
29
|
-
import { __exports as hover } from '../../../../_virtual/hover.js';
|
|
30
|
-
import './hover.js';
|
|
31
|
-
import { __exports as definition } from '../../../../_virtual/definition.js';
|
|
32
|
-
import './definition.js';
|
|
33
|
-
import { __exports as signatureHelp } from '../../../../_virtual/signatureHelp.js';
|
|
34
|
-
import './signatureHelp.js';
|
|
35
|
-
import { __exports as documentHighlight } from '../../../../_virtual/documentHighlight.js';
|
|
36
|
-
import './documentHighlight.js';
|
|
37
|
-
import { __exports as documentSymbol } from '../../../../_virtual/documentSymbol.js';
|
|
38
|
-
import './documentSymbol.js';
|
|
39
|
-
import { __exports as workspaceSymbol } from '../../../../_virtual/workspaceSymbol.js';
|
|
40
|
-
import './workspaceSymbol.js';
|
|
41
|
-
import { __exports as reference } from '../../../../_virtual/reference.js';
|
|
42
|
-
import './reference.js';
|
|
43
|
-
import { __exports as codeAction } from '../../../../_virtual/codeAction.js';
|
|
44
|
-
import './codeAction.js';
|
|
45
|
-
import { __exports as codeLens } from '../../../../_virtual/codeLens.js';
|
|
46
|
-
import './codeLens.js';
|
|
47
|
-
import { __exports as formatting } from '../../../../_virtual/formatting.js';
|
|
48
|
-
import './formatting.js';
|
|
49
|
-
import { __exports as rename } from '../../../../_virtual/rename.js';
|
|
50
|
-
import './rename.js';
|
|
51
|
-
import { __exports as documentLink } from '../../../../_virtual/documentLink.js';
|
|
52
|
-
import './documentLink.js';
|
|
53
|
-
import { __exports as executeCommand } from '../../../../_virtual/executeCommand.js';
|
|
54
|
-
import './executeCommand.js';
|
|
55
|
-
import { __exports as fileSystemWatcher } from '../../../../_virtual/fileSystemWatcher.js';
|
|
56
|
-
import './fileSystemWatcher.js';
|
|
57
|
-
import { __exports as colorProvider } from '../../../../_virtual/colorProvider.js';
|
|
58
|
-
import './colorProvider.js';
|
|
59
|
-
import { __exports as implementation } from '../../../../_virtual/implementation.js';
|
|
60
|
-
import './implementation.js';
|
|
61
|
-
import { __exports as typeDefinition } from '../../../../_virtual/typeDefinition.js';
|
|
62
|
-
import './typeDefinition.js';
|
|
63
|
-
import { __exports as workspaceFolder } from '../../../../_virtual/workspaceFolder.js';
|
|
64
|
-
import './workspaceFolder.js';
|
|
65
|
-
import { __exports as foldingRange } from '../../../../_virtual/foldingRange.js';
|
|
66
|
-
import './foldingRange.js';
|
|
67
|
-
import { __exports as declaration } from '../../../../_virtual/declaration.js';
|
|
68
|
-
import './declaration.js';
|
|
69
|
-
import { __exports as selectionRange } from '../../../../_virtual/selectionRange.js';
|
|
70
|
-
import './selectionRange.js';
|
|
71
|
-
import { __exports as progress } from '../../../../_virtual/progress.js';
|
|
72
|
-
import './progress.js';
|
|
73
|
-
import { __exports as callHierarchy } from '../../../../_virtual/callHierarchy.js';
|
|
74
|
-
import './callHierarchy.js';
|
|
75
|
-
import { __exports as semanticTokens } from '../../../../_virtual/semanticTokens.js';
|
|
76
|
-
import './semanticTokens.js';
|
|
77
|
-
import { __exports as fileOperations } from '../../../../_virtual/fileOperations.js';
|
|
78
|
-
import './fileOperations.js';
|
|
79
|
-
import { __exports as linkedEditingRange } from '../../../../_virtual/linkedEditingRange.js';
|
|
80
|
-
import './linkedEditingRange.js';
|
|
81
|
-
import { __exports as typeHierarchy } from '../../../../_virtual/typeHierarchy.js';
|
|
82
|
-
import './typeHierarchy.js';
|
|
83
|
-
import { __exports as inlineValue } from '../../../../_virtual/inlineValue.js';
|
|
84
|
-
import './inlineValue.js';
|
|
85
|
-
import { __exports as inlayHint } from '../../../../_virtual/inlayHint.js';
|
|
86
|
-
import './inlayHint.js';
|
|
87
|
-
(function (exports) {
|
|
88
|
-
Object.defineProperty(exports, "__esModule", {
|
|
89
|
-
value: true
|
|
90
|
-
});
|
|
91
|
-
exports.ProposedFeatures = exports.BaseLanguageClient = exports.MessageTransports = exports.SuspendMode = exports.State = exports.CloseAction = exports.ErrorAction = exports.RevealOutputChannelOn = void 0;
|
|
92
|
-
const vscode_1 = require$$0;
|
|
93
|
-
const vscode_languageserver_protocol_1 = main;
|
|
94
|
-
const c2p = codeConverter;
|
|
95
|
-
const p2c = protocolConverter;
|
|
96
|
-
const Is = is;
|
|
97
|
-
const async_1 = async;
|
|
98
|
-
const UUID = uuid;
|
|
99
|
-
const progressPart_1 = progressPart;
|
|
100
|
-
const features_1 = features;
|
|
101
|
-
const diagnostic_1 = diagnostic;
|
|
102
|
-
const notebook_1 = notebook;
|
|
103
|
-
const configuration_1 = configuration;
|
|
104
|
-
const textSynchronization_1 = textSynchronization;
|
|
105
|
-
const completion_1 = completion;
|
|
106
|
-
const hover_1 = hover;
|
|
107
|
-
const definition_1 = definition;
|
|
108
|
-
const signatureHelp_1 = signatureHelp;
|
|
109
|
-
const documentHighlight_1 = documentHighlight;
|
|
110
|
-
const documentSymbol_1 = documentSymbol;
|
|
111
|
-
const workspaceSymbol_1 = workspaceSymbol;
|
|
112
|
-
const reference_1 = reference;
|
|
113
|
-
const codeAction_1 = codeAction;
|
|
114
|
-
const codeLens_1 = codeLens;
|
|
115
|
-
const formatting_1 = formatting;
|
|
116
|
-
const rename_1 = rename;
|
|
117
|
-
const documentLink_1 = documentLink;
|
|
118
|
-
const executeCommand_1 = executeCommand;
|
|
119
|
-
const fileSystemWatcher_1 = fileSystemWatcher;
|
|
120
|
-
const colorProvider_1 = colorProvider;
|
|
121
|
-
const implementation_1 = implementation;
|
|
122
|
-
const typeDefinition_1 = typeDefinition;
|
|
123
|
-
const workspaceFolder_1 = workspaceFolder;
|
|
124
|
-
const foldingRange_1 = foldingRange;
|
|
125
|
-
const declaration_1 = declaration;
|
|
126
|
-
const selectionRange_1 = selectionRange;
|
|
127
|
-
const progress_1 = progress;
|
|
128
|
-
const callHierarchy_1 = callHierarchy;
|
|
129
|
-
const semanticTokens_1 = semanticTokens;
|
|
130
|
-
const fileOperations_1 = fileOperations;
|
|
131
|
-
const linkedEditingRange_1 = linkedEditingRange;
|
|
132
|
-
const typeHierarchy_1 = typeHierarchy;
|
|
133
|
-
const inlineValue_1 = inlineValue;
|
|
134
|
-
const inlayHint_1 = inlayHint;
|
|
135
|
-
var RevealOutputChannelOn;
|
|
136
|
-
(function (RevealOutputChannelOn) {
|
|
137
|
-
RevealOutputChannelOn[RevealOutputChannelOn["Info"] = 1] = "Info";
|
|
138
|
-
RevealOutputChannelOn[RevealOutputChannelOn["Warn"] = 2] = "Warn";
|
|
139
|
-
RevealOutputChannelOn[RevealOutputChannelOn["Error"] = 3] = "Error";
|
|
140
|
-
RevealOutputChannelOn[RevealOutputChannelOn["Never"] = 4] = "Never";
|
|
141
|
-
})(RevealOutputChannelOn = exports.RevealOutputChannelOn || (exports.RevealOutputChannelOn = {}));
|
|
142
|
-
var ErrorAction;
|
|
143
|
-
(function (ErrorAction) {
|
|
144
|
-
ErrorAction[ErrorAction["Continue"] = 1] = "Continue";
|
|
145
|
-
ErrorAction[ErrorAction["Shutdown"] = 2] = "Shutdown";
|
|
146
|
-
})(ErrorAction = exports.ErrorAction || (exports.ErrorAction = {}));
|
|
147
|
-
var CloseAction;
|
|
148
|
-
(function (CloseAction) {
|
|
149
|
-
CloseAction[CloseAction["DoNotRestart"] = 1] = "DoNotRestart";
|
|
150
|
-
CloseAction[CloseAction["Restart"] = 2] = "Restart";
|
|
151
|
-
})(CloseAction = exports.CloseAction || (exports.CloseAction = {}));
|
|
152
|
-
var State;
|
|
153
|
-
(function (State) {
|
|
154
|
-
State[State["Stopped"] = 1] = "Stopped";
|
|
155
|
-
State[State["Starting"] = 3] = "Starting";
|
|
156
|
-
State[State["Running"] = 2] = "Running";
|
|
157
|
-
})(State = exports.State || (exports.State = {}));
|
|
158
|
-
(function (SuspendMode) {
|
|
159
|
-
SuspendMode["off"] = "off";
|
|
160
|
-
SuspendMode["on"] = "on";
|
|
161
|
-
})(exports.SuspendMode || (exports.SuspendMode = {}));
|
|
162
|
-
class DefaultErrorHandler {
|
|
163
|
-
constructor(client, maxRestartCount) {
|
|
164
|
-
this.client = client;
|
|
165
|
-
this.maxRestartCount = maxRestartCount;
|
|
166
|
-
this.restarts = [];
|
|
167
|
-
}
|
|
168
|
-
error(_error, _message, count) {
|
|
169
|
-
if (count && count <= 3) {
|
|
170
|
-
return {
|
|
171
|
-
action: ErrorAction.Continue
|
|
172
|
-
};
|
|
173
|
-
}
|
|
174
|
-
return {
|
|
175
|
-
action: ErrorAction.Shutdown
|
|
176
|
-
};
|
|
177
|
-
}
|
|
178
|
-
closed() {
|
|
179
|
-
this.restarts.push(Date.now());
|
|
180
|
-
if (this.restarts.length <= this.maxRestartCount) {
|
|
181
|
-
return {
|
|
182
|
-
action: CloseAction.Restart
|
|
183
|
-
};
|
|
184
|
-
} else {
|
|
185
|
-
let diff = this.restarts[this.restarts.length - 1] - this.restarts[0];
|
|
186
|
-
if (diff <= 3 * 60 * 1000) {
|
|
187
|
-
return {
|
|
188
|
-
action: CloseAction.DoNotRestart,
|
|
189
|
-
message: "The ".concat(this.client.name, " server crashed ").concat(this.maxRestartCount + 1, " times in the last 3 minutes. The server will not be restarted. See the output for more information.")
|
|
190
|
-
};
|
|
191
|
-
} else {
|
|
192
|
-
this.restarts.shift();
|
|
193
|
-
return {
|
|
194
|
-
action: CloseAction.Restart
|
|
195
|
-
};
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
var ClientState;
|
|
201
|
-
(function (ClientState) {
|
|
202
|
-
ClientState["Initial"] = "initial";
|
|
203
|
-
ClientState["Starting"] = "starting";
|
|
204
|
-
ClientState["StartFailed"] = "startFailed";
|
|
205
|
-
ClientState["Running"] = "running";
|
|
206
|
-
ClientState["Stopping"] = "stopping";
|
|
207
|
-
ClientState["Stopped"] = "stopped";
|
|
208
|
-
})(ClientState || (ClientState = {}));
|
|
209
|
-
(function (MessageTransports) {
|
|
210
|
-
function is(value) {
|
|
211
|
-
let candidate = value;
|
|
212
|
-
return candidate && vscode_languageserver_protocol_1.MessageReader.is(value.reader) && vscode_languageserver_protocol_1.MessageWriter.is(value.writer);
|
|
213
|
-
}
|
|
214
|
-
MessageTransports.is = is;
|
|
215
|
-
})(exports.MessageTransports || (exports.MessageTransports = {}));
|
|
216
|
-
class BaseLanguageClient {
|
|
217
|
-
constructor(id, name, clientOptions) {
|
|
218
|
-
var _clientOptions$docume, _clientOptions$synchr, _clientOptions$output, _clientOptions$reveal, _clientOptions$stdioE, _clientOptions$errorH, _clientOptions$connec, _clientOptions$middle, _clientOptions$diagno, _clientOptions$notebo;
|
|
219
|
-
this._traceFormat = vscode_languageserver_protocol_1.TraceFormat.Text;
|
|
220
|
-
this._diagnosticQueue = new Map();
|
|
221
|
-
this._diagnosticQueueState = {
|
|
222
|
-
state: 'idle'
|
|
223
|
-
};
|
|
224
|
-
this._features = [];
|
|
225
|
-
this._dynamicFeatures = new Map();
|
|
226
|
-
this.workspaceEditLock = new async_1.Semaphore(1);
|
|
227
|
-
this._id = id;
|
|
228
|
-
this._name = name;
|
|
229
|
-
clientOptions = clientOptions || {};
|
|
230
|
-
const markdown = {
|
|
231
|
-
isTrusted: false,
|
|
232
|
-
supportHtml: false
|
|
233
|
-
};
|
|
234
|
-
if (clientOptions.markdown !== undefined) {
|
|
235
|
-
markdown.isTrusted = clientOptions.markdown.isTrusted === true;
|
|
236
|
-
markdown.supportHtml = clientOptions.markdown.supportHtml === true;
|
|
237
|
-
}
|
|
238
|
-
this._clientOptions = {
|
|
239
|
-
documentSelector: (_clientOptions$docume = clientOptions.documentSelector) !== null && _clientOptions$docume !== void 0 ? _clientOptions$docume : [],
|
|
240
|
-
synchronize: (_clientOptions$synchr = clientOptions.synchronize) !== null && _clientOptions$synchr !== void 0 ? _clientOptions$synchr : {},
|
|
241
|
-
diagnosticCollectionName: clientOptions.diagnosticCollectionName,
|
|
242
|
-
outputChannelName: (_clientOptions$output = clientOptions.outputChannelName) !== null && _clientOptions$output !== void 0 ? _clientOptions$output : this._name,
|
|
243
|
-
revealOutputChannelOn: (_clientOptions$reveal = clientOptions.revealOutputChannelOn) !== null && _clientOptions$reveal !== void 0 ? _clientOptions$reveal : RevealOutputChannelOn.Error,
|
|
244
|
-
stdioEncoding: (_clientOptions$stdioE = clientOptions.stdioEncoding) !== null && _clientOptions$stdioE !== void 0 ? _clientOptions$stdioE : 'utf8',
|
|
245
|
-
initializationOptions: clientOptions.initializationOptions,
|
|
246
|
-
initializationFailedHandler: clientOptions.initializationFailedHandler,
|
|
247
|
-
progressOnInitialization: !!clientOptions.progressOnInitialization,
|
|
248
|
-
errorHandler: (_clientOptions$errorH = clientOptions.errorHandler) !== null && _clientOptions$errorH !== void 0 ? _clientOptions$errorH : this.createDefaultErrorHandler((_clientOptions$connec = clientOptions.connectionOptions) === null || _clientOptions$connec === void 0 ? void 0 : _clientOptions$connec.maxRestartCount),
|
|
249
|
-
middleware: (_clientOptions$middle = clientOptions.middleware) !== null && _clientOptions$middle !== void 0 ? _clientOptions$middle : {},
|
|
250
|
-
uriConverters: clientOptions.uriConverters,
|
|
251
|
-
workspaceFolder: clientOptions.workspaceFolder,
|
|
252
|
-
connectionOptions: clientOptions.connectionOptions,
|
|
253
|
-
markdown,
|
|
254
|
-
diagnosticPullOptions: (_clientOptions$diagno = clientOptions.diagnosticPullOptions) !== null && _clientOptions$diagno !== void 0 ? _clientOptions$diagno : {
|
|
255
|
-
onChange: true,
|
|
256
|
-
onSave: false
|
|
257
|
-
},
|
|
258
|
-
notebookDocumentOptions: (_clientOptions$notebo = clientOptions.notebookDocumentOptions) !== null && _clientOptions$notebo !== void 0 ? _clientOptions$notebo : {}
|
|
259
|
-
};
|
|
260
|
-
this._clientOptions.synchronize = this._clientOptions.synchronize || {};
|
|
261
|
-
this._state = ClientState.Initial;
|
|
262
|
-
this._ignoredRegistrations = new Set();
|
|
263
|
-
this._listeners = [];
|
|
264
|
-
this._notificationHandlers = new Map();
|
|
265
|
-
this._pendingNotificationHandlers = new Map();
|
|
266
|
-
this._notificationDisposables = new Map();
|
|
267
|
-
this._requestHandlers = new Map();
|
|
268
|
-
this._pendingRequestHandlers = new Map();
|
|
269
|
-
this._requestDisposables = new Map();
|
|
270
|
-
this._progressHandlers = new Map();
|
|
271
|
-
this._pendingProgressHandlers = new Map();
|
|
272
|
-
this._progressDisposables = new Map();
|
|
273
|
-
this._connection = undefined;
|
|
274
|
-
this._initializeResult = undefined;
|
|
275
|
-
if (clientOptions.outputChannel) {
|
|
276
|
-
this._outputChannel = clientOptions.outputChannel;
|
|
277
|
-
this._disposeOutputChannel = false;
|
|
278
|
-
} else {
|
|
279
|
-
this._outputChannel = undefined;
|
|
280
|
-
this._disposeOutputChannel = true;
|
|
281
|
-
}
|
|
282
|
-
this._traceOutputChannel = clientOptions.traceOutputChannel;
|
|
283
|
-
this._diagnostics = undefined;
|
|
284
|
-
this._pendingOpenNotifications = new Set();
|
|
285
|
-
this._pendingChangeSemaphore = new async_1.Semaphore(1);
|
|
286
|
-
this._pendingChangeDelayer = new async_1.Delayer(250);
|
|
287
|
-
this._fileEvents = [];
|
|
288
|
-
this._fileEventDelayer = new async_1.Delayer(250);
|
|
289
|
-
this._onStop = undefined;
|
|
290
|
-
this._telemetryEmitter = new vscode_languageserver_protocol_1.Emitter();
|
|
291
|
-
this._stateChangeEmitter = new vscode_languageserver_protocol_1.Emitter();
|
|
292
|
-
this._trace = vscode_languageserver_protocol_1.Trace.Off;
|
|
293
|
-
this._tracer = {
|
|
294
|
-
log: (messageOrDataObject, data) => {
|
|
295
|
-
if (Is.string(messageOrDataObject)) {
|
|
296
|
-
this.logTrace(messageOrDataObject, data);
|
|
297
|
-
} else {
|
|
298
|
-
this.logObjectTrace(messageOrDataObject);
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
};
|
|
302
|
-
this._c2p = c2p.createConverter(clientOptions.uriConverters ? clientOptions.uriConverters.code2Protocol : undefined);
|
|
303
|
-
this._p2c = p2c.createConverter(clientOptions.uriConverters ? clientOptions.uriConverters.protocol2Code : undefined, this._clientOptions.markdown.isTrusted, this._clientOptions.markdown.supportHtml);
|
|
304
|
-
this._syncedDocuments = new Map();
|
|
305
|
-
this.registerBuiltinFeatures();
|
|
306
|
-
}
|
|
307
|
-
get name() {
|
|
308
|
-
return this._name;
|
|
309
|
-
}
|
|
310
|
-
get middleware() {
|
|
311
|
-
var _this$_clientOptions$;
|
|
312
|
-
return (_this$_clientOptions$ = this._clientOptions.middleware) !== null && _this$_clientOptions$ !== void 0 ? _this$_clientOptions$ : Object.create(null);
|
|
313
|
-
}
|
|
314
|
-
get clientOptions() {
|
|
315
|
-
return this._clientOptions;
|
|
316
|
-
}
|
|
317
|
-
get protocol2CodeConverter() {
|
|
318
|
-
return this._p2c;
|
|
319
|
-
}
|
|
320
|
-
get code2ProtocolConverter() {
|
|
321
|
-
return this._c2p;
|
|
322
|
-
}
|
|
323
|
-
get onTelemetry() {
|
|
324
|
-
return this._telemetryEmitter.event;
|
|
325
|
-
}
|
|
326
|
-
get onDidChangeState() {
|
|
327
|
-
return this._stateChangeEmitter.event;
|
|
328
|
-
}
|
|
329
|
-
get outputChannel() {
|
|
330
|
-
if (!this._outputChannel) {
|
|
331
|
-
this._outputChannel = vscode_1.window.createOutputChannel(this._clientOptions.outputChannelName ? this._clientOptions.outputChannelName : this._name);
|
|
332
|
-
}
|
|
333
|
-
return this._outputChannel;
|
|
334
|
-
}
|
|
335
|
-
get traceOutputChannel() {
|
|
336
|
-
if (this._traceOutputChannel) {
|
|
337
|
-
return this._traceOutputChannel;
|
|
338
|
-
}
|
|
339
|
-
return this.outputChannel;
|
|
340
|
-
}
|
|
341
|
-
get diagnostics() {
|
|
342
|
-
return this._diagnostics;
|
|
343
|
-
}
|
|
344
|
-
get state() {
|
|
345
|
-
return this.getPublicState();
|
|
346
|
-
}
|
|
347
|
-
get $state() {
|
|
348
|
-
return this._state;
|
|
349
|
-
}
|
|
350
|
-
set $state(value) {
|
|
351
|
-
let oldState = this.getPublicState();
|
|
352
|
-
this._state = value;
|
|
353
|
-
let newState = this.getPublicState();
|
|
354
|
-
if (newState !== oldState) {
|
|
355
|
-
this._stateChangeEmitter.fire({
|
|
356
|
-
oldState,
|
|
357
|
-
newState
|
|
358
|
-
});
|
|
359
|
-
}
|
|
360
|
-
}
|
|
361
|
-
getPublicState() {
|
|
362
|
-
switch (this.$state) {
|
|
363
|
-
case ClientState.Starting:
|
|
364
|
-
return State.Starting;
|
|
365
|
-
case ClientState.Running:
|
|
366
|
-
return State.Running;
|
|
367
|
-
default:
|
|
368
|
-
return State.Stopped;
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
get initializeResult() {
|
|
372
|
-
return this._initializeResult;
|
|
373
|
-
}
|
|
374
|
-
async sendRequest(type) {
|
|
375
|
-
if (this.$state === ClientState.StartFailed || this.$state === ClientState.Stopping || this.$state === ClientState.Stopped) {
|
|
376
|
-
return Promise.reject(new vscode_languageserver_protocol_1.ResponseError(vscode_languageserver_protocol_1.ErrorCodes.ConnectionInactive, "Client is not running"));
|
|
377
|
-
}
|
|
378
|
-
const connection = await this.$start();
|
|
379
|
-
if (this._didChangeTextDocumentFeature.syncKind === vscode_languageserver_protocol_1.TextDocumentSyncKind.Full) {
|
|
380
|
-
await this.sendPendingFullTextDocumentChanges(connection);
|
|
381
|
-
}
|
|
382
|
-
for (var _len = arguments.length, params = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
383
|
-
params[_key - 1] = arguments[_key];
|
|
384
|
-
}
|
|
385
|
-
return connection.sendRequest(type, ...params);
|
|
386
|
-
}
|
|
387
|
-
onRequest(type, handler) {
|
|
388
|
-
const method = typeof type === 'string' ? type : type.method;
|
|
389
|
-
this._requestHandlers.set(method, handler);
|
|
390
|
-
const connection = this.activeConnection();
|
|
391
|
-
let disposable;
|
|
392
|
-
if (connection !== undefined) {
|
|
393
|
-
this._requestDisposables.set(method, connection.onRequest(type, handler));
|
|
394
|
-
disposable = {
|
|
395
|
-
dispose: () => {
|
|
396
|
-
const disposable = this._requestDisposables.get(method);
|
|
397
|
-
if (disposable !== undefined) {
|
|
398
|
-
disposable.dispose();
|
|
399
|
-
this._requestDisposables.delete(method);
|
|
400
|
-
}
|
|
401
|
-
}
|
|
402
|
-
};
|
|
403
|
-
} else {
|
|
404
|
-
this._pendingRequestHandlers.set(method, handler);
|
|
405
|
-
disposable = {
|
|
406
|
-
dispose: () => {
|
|
407
|
-
this._pendingRequestHandlers.delete(method);
|
|
408
|
-
const disposable = this._requestDisposables.get(method);
|
|
409
|
-
if (disposable !== undefined) {
|
|
410
|
-
disposable.dispose();
|
|
411
|
-
this._requestDisposables.delete(method);
|
|
412
|
-
}
|
|
413
|
-
}
|
|
414
|
-
};
|
|
415
|
-
}
|
|
416
|
-
return {
|
|
417
|
-
dispose: () => {
|
|
418
|
-
this._requestHandlers.delete(method);
|
|
419
|
-
disposable.dispose();
|
|
420
|
-
}
|
|
421
|
-
};
|
|
422
|
-
}
|
|
423
|
-
async sendNotification(type, params) {
|
|
424
|
-
if (this.$state === ClientState.StartFailed || this.$state === ClientState.Stopping || this.$state === ClientState.Stopped) {
|
|
425
|
-
return Promise.reject(new vscode_languageserver_protocol_1.ResponseError(vscode_languageserver_protocol_1.ErrorCodes.ConnectionInactive, "Client is not running"));
|
|
426
|
-
}
|
|
427
|
-
const needsPendingFullTextDocumentSync = this._didChangeTextDocumentFeature.syncKind === vscode_languageserver_protocol_1.TextDocumentSyncKind.Full;
|
|
428
|
-
let openNotification;
|
|
429
|
-
if (needsPendingFullTextDocumentSync && typeof type !== 'string' && type.method === vscode_languageserver_protocol_1.DidOpenTextDocumentNotification.method) {
|
|
430
|
-
openNotification = params === null || params === void 0 ? void 0 : params.textDocument.uri;
|
|
431
|
-
this._pendingOpenNotifications.add(openNotification);
|
|
432
|
-
}
|
|
433
|
-
const connection = await this.$start();
|
|
434
|
-
if (needsPendingFullTextDocumentSync) {
|
|
435
|
-
await this.sendPendingFullTextDocumentChanges(connection);
|
|
436
|
-
}
|
|
437
|
-
if (openNotification !== undefined) {
|
|
438
|
-
this._pendingOpenNotifications.delete(openNotification);
|
|
439
|
-
}
|
|
440
|
-
return connection.sendNotification(type, params);
|
|
441
|
-
}
|
|
442
|
-
onNotification(type, handler) {
|
|
443
|
-
const method = typeof type === 'string' ? type : type.method;
|
|
444
|
-
this._notificationHandlers.set(method, handler);
|
|
445
|
-
const connection = this.activeConnection();
|
|
446
|
-
let disposable;
|
|
447
|
-
if (connection !== undefined) {
|
|
448
|
-
this._notificationDisposables.set(method, connection.onNotification(type, handler));
|
|
449
|
-
disposable = {
|
|
450
|
-
dispose: () => {
|
|
451
|
-
const disposable = this._notificationDisposables.get(method);
|
|
452
|
-
if (disposable !== undefined) {
|
|
453
|
-
disposable.dispose();
|
|
454
|
-
this._notificationDisposables.delete(method);
|
|
455
|
-
}
|
|
456
|
-
}
|
|
457
|
-
};
|
|
458
|
-
} else {
|
|
459
|
-
this._pendingNotificationHandlers.set(method, handler);
|
|
460
|
-
disposable = {
|
|
461
|
-
dispose: () => {
|
|
462
|
-
this._pendingNotificationHandlers.delete(method);
|
|
463
|
-
const disposable = this._notificationDisposables.get(method);
|
|
464
|
-
if (disposable !== undefined) {
|
|
465
|
-
disposable.dispose();
|
|
466
|
-
this._notificationDisposables.delete(method);
|
|
467
|
-
}
|
|
468
|
-
}
|
|
469
|
-
};
|
|
470
|
-
}
|
|
471
|
-
return {
|
|
472
|
-
dispose: () => {
|
|
473
|
-
this._notificationHandlers.delete(method);
|
|
474
|
-
disposable.dispose();
|
|
475
|
-
}
|
|
476
|
-
};
|
|
477
|
-
}
|
|
478
|
-
async sendProgress(type, token, value) {
|
|
479
|
-
if (this.$state === ClientState.StartFailed || this.$state === ClientState.Stopping || this.$state === ClientState.Stopped) {
|
|
480
|
-
return Promise.reject(new vscode_languageserver_protocol_1.ResponseError(vscode_languageserver_protocol_1.ErrorCodes.ConnectionInactive, "Client is not running"));
|
|
481
|
-
}
|
|
482
|
-
try {
|
|
483
|
-
const connection = await this.$start();
|
|
484
|
-
return connection.sendProgress(type, token, value);
|
|
485
|
-
} catch (error) {
|
|
486
|
-
this.error("Sending progress for token ".concat(token, " failed."), error);
|
|
487
|
-
throw error;
|
|
488
|
-
}
|
|
489
|
-
}
|
|
490
|
-
onProgress(type, token, handler) {
|
|
491
|
-
var _this$_clientOptions$2;
|
|
492
|
-
this._progressHandlers.set(token, {
|
|
493
|
-
type,
|
|
494
|
-
handler
|
|
495
|
-
});
|
|
496
|
-
const connection = this.activeConnection();
|
|
497
|
-
let disposable;
|
|
498
|
-
const handleWorkDoneProgress = (_this$_clientOptions$2 = this._clientOptions.middleware) === null || _this$_clientOptions$2 === void 0 ? void 0 : _this$_clientOptions$2.handleWorkDoneProgress;
|
|
499
|
-
const realHandler = vscode_languageserver_protocol_1.WorkDoneProgress.is(type) && handleWorkDoneProgress !== undefined ? params => {
|
|
500
|
-
handleWorkDoneProgress(token, params, () => handler(params));
|
|
501
|
-
} : handler;
|
|
502
|
-
if (connection !== undefined) {
|
|
503
|
-
this._progressDisposables.set(token, connection.onProgress(type, token, realHandler));
|
|
504
|
-
disposable = {
|
|
505
|
-
dispose: () => {
|
|
506
|
-
const disposable = this._progressDisposables.get(token);
|
|
507
|
-
if (disposable !== undefined) {
|
|
508
|
-
disposable.dispose();
|
|
509
|
-
this._progressDisposables.delete(token);
|
|
510
|
-
}
|
|
511
|
-
}
|
|
512
|
-
};
|
|
513
|
-
} else {
|
|
514
|
-
this._pendingProgressHandlers.set(token, {
|
|
515
|
-
type,
|
|
516
|
-
handler
|
|
517
|
-
});
|
|
518
|
-
disposable = {
|
|
519
|
-
dispose: () => {
|
|
520
|
-
this._pendingProgressHandlers.delete(token);
|
|
521
|
-
const disposable = this._progressDisposables.get(token);
|
|
522
|
-
if (disposable !== undefined) {
|
|
523
|
-
disposable.dispose();
|
|
524
|
-
this._progressDisposables.delete(token);
|
|
525
|
-
}
|
|
526
|
-
}
|
|
527
|
-
};
|
|
528
|
-
}
|
|
529
|
-
return {
|
|
530
|
-
dispose: () => {
|
|
531
|
-
this._progressHandlers.delete(token);
|
|
532
|
-
disposable.dispose();
|
|
533
|
-
}
|
|
534
|
-
};
|
|
535
|
-
}
|
|
536
|
-
createDefaultErrorHandler(maxRestartCount) {
|
|
537
|
-
if (maxRestartCount !== undefined && maxRestartCount < 0) {
|
|
538
|
-
throw new Error("Invalid maxRestartCount: ".concat(maxRestartCount));
|
|
539
|
-
}
|
|
540
|
-
return new DefaultErrorHandler(this, maxRestartCount !== null && maxRestartCount !== void 0 ? maxRestartCount : 4);
|
|
541
|
-
}
|
|
542
|
-
async setTrace(value) {
|
|
543
|
-
this._trace = value;
|
|
544
|
-
const connection = this.activeConnection();
|
|
545
|
-
if (connection !== undefined) {
|
|
546
|
-
await connection.trace(this._trace, this._tracer, {
|
|
547
|
-
sendNotification: false,
|
|
548
|
-
traceFormat: this._traceFormat
|
|
549
|
-
});
|
|
550
|
-
}
|
|
551
|
-
}
|
|
552
|
-
data2String(data) {
|
|
553
|
-
if (data instanceof vscode_languageserver_protocol_1.ResponseError) {
|
|
554
|
-
const responseError = data;
|
|
555
|
-
return " Message: ".concat(responseError.message, "\n Code: ").concat(responseError.code, " ").concat(responseError.data ? '\n' + responseError.data.toString() : '');
|
|
556
|
-
}
|
|
557
|
-
if (data instanceof Error) {
|
|
558
|
-
if (Is.string(data.stack)) {
|
|
559
|
-
return data.stack;
|
|
560
|
-
}
|
|
561
|
-
return data.message;
|
|
562
|
-
}
|
|
563
|
-
if (Is.string(data)) {
|
|
564
|
-
return data;
|
|
565
|
-
}
|
|
566
|
-
return data.toString();
|
|
567
|
-
}
|
|
568
|
-
info(message, data) {
|
|
569
|
-
let showNotification = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
570
|
-
this.outputChannel.appendLine("[Info - ".concat(new Date().toLocaleTimeString(), "] ").concat(message));
|
|
571
|
-
if (data !== null && data !== undefined) {
|
|
572
|
-
this.outputChannel.appendLine(this.data2String(data));
|
|
573
|
-
}
|
|
574
|
-
if (showNotification && this._clientOptions.revealOutputChannelOn <= RevealOutputChannelOn.Info) {
|
|
575
|
-
this.showNotificationMessage(vscode_languageserver_protocol_1.MessageType.Info, message);
|
|
576
|
-
}
|
|
577
|
-
}
|
|
578
|
-
warn(message, data) {
|
|
579
|
-
let showNotification = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
580
|
-
this.outputChannel.appendLine("[Warn - ".concat(new Date().toLocaleTimeString(), "] ").concat(message));
|
|
581
|
-
if (data !== null && data !== undefined) {
|
|
582
|
-
this.outputChannel.appendLine(this.data2String(data));
|
|
583
|
-
}
|
|
584
|
-
if (showNotification && this._clientOptions.revealOutputChannelOn <= RevealOutputChannelOn.Warn) {
|
|
585
|
-
this.showNotificationMessage(vscode_languageserver_protocol_1.MessageType.Warning, message);
|
|
586
|
-
}
|
|
587
|
-
}
|
|
588
|
-
error(message, data) {
|
|
589
|
-
let showNotification = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
590
|
-
this.outputChannel.appendLine("[Error - ".concat(new Date().toLocaleTimeString(), "] ").concat(message));
|
|
591
|
-
if (data !== null && data !== undefined) {
|
|
592
|
-
this.outputChannel.appendLine(this.data2String(data));
|
|
593
|
-
}
|
|
594
|
-
if (showNotification === 'force' || showNotification && this._clientOptions.revealOutputChannelOn <= RevealOutputChannelOn.Error) {
|
|
595
|
-
this.showNotificationMessage(vscode_languageserver_protocol_1.MessageType.Error, message);
|
|
596
|
-
}
|
|
597
|
-
}
|
|
598
|
-
showNotificationMessage(type, message) {
|
|
599
|
-
var _message2;
|
|
600
|
-
message = (_message2 = message) !== null && _message2 !== void 0 ? _message2 : 'A request has failed. See the output for more information.';
|
|
601
|
-
const messageFunc = type === vscode_languageserver_protocol_1.MessageType.Error ? vscode_1.window.showErrorMessage : type === vscode_languageserver_protocol_1.MessageType.Warning ? vscode_1.window.showWarningMessage : vscode_1.window.showInformationMessage;
|
|
602
|
-
void messageFunc(message, 'Go to output').then(selection => {
|
|
603
|
-
if (selection !== undefined) {
|
|
604
|
-
this.outputChannel.show(true);
|
|
605
|
-
}
|
|
606
|
-
});
|
|
607
|
-
}
|
|
608
|
-
logTrace(message, data) {
|
|
609
|
-
this.traceOutputChannel.appendLine("[Trace - ".concat(new Date().toLocaleTimeString(), "] ").concat(message));
|
|
610
|
-
if (data) {
|
|
611
|
-
this.traceOutputChannel.appendLine(this.data2String(data));
|
|
612
|
-
}
|
|
613
|
-
}
|
|
614
|
-
logObjectTrace(data) {
|
|
615
|
-
if (data.isLSPMessage && data.type) {
|
|
616
|
-
this.traceOutputChannel.append("[LSP - ".concat(new Date().toLocaleTimeString(), "] "));
|
|
617
|
-
} else {
|
|
618
|
-
this.traceOutputChannel.append("[Trace - ".concat(new Date().toLocaleTimeString(), "] "));
|
|
619
|
-
}
|
|
620
|
-
if (data) {
|
|
621
|
-
this.traceOutputChannel.appendLine("".concat(JSON.stringify(data)));
|
|
622
|
-
}
|
|
623
|
-
}
|
|
624
|
-
needsStart() {
|
|
625
|
-
return this.$state === ClientState.Initial || this.$state === ClientState.Stopping || this.$state === ClientState.Stopped;
|
|
626
|
-
}
|
|
627
|
-
needsStop() {
|
|
628
|
-
return this.$state === ClientState.Starting || this.$state === ClientState.Running;
|
|
629
|
-
}
|
|
630
|
-
activeConnection() {
|
|
631
|
-
return this.$state === ClientState.Running && this._connection !== undefined ? this._connection : undefined;
|
|
632
|
-
}
|
|
633
|
-
isRunning() {
|
|
634
|
-
return this.$state === ClientState.Running;
|
|
635
|
-
}
|
|
636
|
-
async start() {
|
|
637
|
-
if (this._disposed === 'disposing' || this._disposed === 'disposed') {
|
|
638
|
-
throw new Error("Client got disposed and can't be restarted.");
|
|
639
|
-
}
|
|
640
|
-
if (this.$state === ClientState.Stopping) {
|
|
641
|
-
throw new Error("Client is currently stopping. Can only restart a full stopped client");
|
|
642
|
-
}
|
|
643
|
-
if (this._onStart !== undefined) {
|
|
644
|
-
return this._onStart;
|
|
645
|
-
}
|
|
646
|
-
const [promise, resolve, reject] = this.createOnStartPromise();
|
|
647
|
-
this._onStart = promise;
|
|
648
|
-
if (this._diagnostics === undefined) {
|
|
649
|
-
this._diagnostics = this._clientOptions.diagnosticCollectionName ? vscode_1.languages.createDiagnosticCollection(this._clientOptions.diagnosticCollectionName) : vscode_1.languages.createDiagnosticCollection();
|
|
650
|
-
}
|
|
651
|
-
for (const [method, handler] of this._notificationHandlers) {
|
|
652
|
-
if (!this._pendingNotificationHandlers.has(method)) {
|
|
653
|
-
this._pendingNotificationHandlers.set(method, handler);
|
|
654
|
-
}
|
|
655
|
-
}
|
|
656
|
-
for (const [method, handler] of this._requestHandlers) {
|
|
657
|
-
if (!this._pendingRequestHandlers.has(method)) {
|
|
658
|
-
this._pendingRequestHandlers.set(method, handler);
|
|
659
|
-
}
|
|
660
|
-
}
|
|
661
|
-
for (const [token, data] of this._progressHandlers) {
|
|
662
|
-
if (!this._pendingProgressHandlers.has(token)) {
|
|
663
|
-
this._pendingProgressHandlers.set(token, data);
|
|
664
|
-
}
|
|
665
|
-
}
|
|
666
|
-
this.$state = ClientState.Starting;
|
|
667
|
-
try {
|
|
668
|
-
const connection = await this.createConnection();
|
|
669
|
-
connection.onNotification(vscode_languageserver_protocol_1.LogMessageNotification.type, message => {
|
|
670
|
-
switch (message.type) {
|
|
671
|
-
case vscode_languageserver_protocol_1.MessageType.Error:
|
|
672
|
-
this.error(message.message, undefined, false);
|
|
673
|
-
break;
|
|
674
|
-
case vscode_languageserver_protocol_1.MessageType.Warning:
|
|
675
|
-
this.warn(message.message, undefined, false);
|
|
676
|
-
break;
|
|
677
|
-
case vscode_languageserver_protocol_1.MessageType.Info:
|
|
678
|
-
this.info(message.message, undefined, false);
|
|
679
|
-
break;
|
|
680
|
-
default:
|
|
681
|
-
this.outputChannel.appendLine(message.message);
|
|
682
|
-
}
|
|
683
|
-
});
|
|
684
|
-
connection.onNotification(vscode_languageserver_protocol_1.ShowMessageNotification.type, message => {
|
|
685
|
-
switch (message.type) {
|
|
686
|
-
case vscode_languageserver_protocol_1.MessageType.Error:
|
|
687
|
-
void vscode_1.window.showErrorMessage(message.message);
|
|
688
|
-
break;
|
|
689
|
-
case vscode_languageserver_protocol_1.MessageType.Warning:
|
|
690
|
-
void vscode_1.window.showWarningMessage(message.message);
|
|
691
|
-
break;
|
|
692
|
-
case vscode_languageserver_protocol_1.MessageType.Info:
|
|
693
|
-
void vscode_1.window.showInformationMessage(message.message);
|
|
694
|
-
break;
|
|
695
|
-
default:
|
|
696
|
-
void vscode_1.window.showInformationMessage(message.message);
|
|
697
|
-
}
|
|
698
|
-
});
|
|
699
|
-
connection.onRequest(vscode_languageserver_protocol_1.ShowMessageRequest.type, params => {
|
|
700
|
-
let messageFunc;
|
|
701
|
-
switch (params.type) {
|
|
702
|
-
case vscode_languageserver_protocol_1.MessageType.Error:
|
|
703
|
-
messageFunc = vscode_1.window.showErrorMessage;
|
|
704
|
-
break;
|
|
705
|
-
case vscode_languageserver_protocol_1.MessageType.Warning:
|
|
706
|
-
messageFunc = vscode_1.window.showWarningMessage;
|
|
707
|
-
break;
|
|
708
|
-
case vscode_languageserver_protocol_1.MessageType.Info:
|
|
709
|
-
messageFunc = vscode_1.window.showInformationMessage;
|
|
710
|
-
break;
|
|
711
|
-
default:
|
|
712
|
-
messageFunc = vscode_1.window.showInformationMessage;
|
|
713
|
-
}
|
|
714
|
-
let actions = params.actions || [];
|
|
715
|
-
return messageFunc(params.message, ...actions);
|
|
716
|
-
});
|
|
717
|
-
connection.onNotification(vscode_languageserver_protocol_1.TelemetryEventNotification.type, data => {
|
|
718
|
-
this._telemetryEmitter.fire(data);
|
|
719
|
-
});
|
|
720
|
-
connection.onRequest(vscode_languageserver_protocol_1.ShowDocumentRequest.type, async params => {
|
|
721
|
-
var _this$_clientOptions$3;
|
|
722
|
-
const showDocument = async params => {
|
|
723
|
-
const uri = this.protocol2CodeConverter.asUri(params.uri);
|
|
724
|
-
try {
|
|
725
|
-
if (params.external === true) {
|
|
726
|
-
const success = await vscode_1.env.openExternal(uri);
|
|
727
|
-
return {
|
|
728
|
-
success
|
|
729
|
-
};
|
|
730
|
-
} else {
|
|
731
|
-
const options = {};
|
|
732
|
-
if (params.selection !== undefined) {
|
|
733
|
-
options.selection = this.protocol2CodeConverter.asRange(params.selection);
|
|
734
|
-
}
|
|
735
|
-
if (params.takeFocus === undefined || params.takeFocus === false) {
|
|
736
|
-
options.preserveFocus = true;
|
|
737
|
-
} else if (params.takeFocus === true) {
|
|
738
|
-
options.preserveFocus = false;
|
|
739
|
-
}
|
|
740
|
-
await vscode_1.window.showTextDocument(uri, options);
|
|
741
|
-
return {
|
|
742
|
-
success: true
|
|
743
|
-
};
|
|
744
|
-
}
|
|
745
|
-
} catch (error) {
|
|
746
|
-
return {
|
|
747
|
-
success: false
|
|
748
|
-
};
|
|
749
|
-
}
|
|
750
|
-
};
|
|
751
|
-
const middleware = (_this$_clientOptions$3 = this._clientOptions.middleware.window) === null || _this$_clientOptions$3 === void 0 ? void 0 : _this$_clientOptions$3.showDocument;
|
|
752
|
-
if (middleware !== undefined) {
|
|
753
|
-
return middleware(params, showDocument);
|
|
754
|
-
} else {
|
|
755
|
-
return showDocument(params);
|
|
756
|
-
}
|
|
757
|
-
});
|
|
758
|
-
connection.listen();
|
|
759
|
-
await this.initialize(connection);
|
|
760
|
-
resolve();
|
|
761
|
-
} catch (error) {
|
|
762
|
-
this.$state = ClientState.StartFailed;
|
|
763
|
-
this.error("".concat(this._name, " client: couldn't create connection to server."), error, 'force');
|
|
764
|
-
reject(error);
|
|
765
|
-
}
|
|
766
|
-
return this._onStart;
|
|
767
|
-
}
|
|
768
|
-
createOnStartPromise() {
|
|
769
|
-
let resolve;
|
|
770
|
-
let reject;
|
|
771
|
-
const promise = new Promise((_resolve, _reject) => {
|
|
772
|
-
resolve = _resolve;
|
|
773
|
-
reject = _reject;
|
|
774
|
-
});
|
|
775
|
-
return [promise, resolve, reject];
|
|
776
|
-
}
|
|
777
|
-
async initialize(connection) {
|
|
778
|
-
this.refreshTrace(connection, false);
|
|
779
|
-
const initOption = this._clientOptions.initializationOptions;
|
|
780
|
-
const [rootPath, workspaceFolders] = this._clientOptions.workspaceFolder !== undefined ? [this._clientOptions.workspaceFolder.uri.fsPath, [{
|
|
781
|
-
uri: this._c2p.asUri(this._clientOptions.workspaceFolder.uri),
|
|
782
|
-
name: this._clientOptions.workspaceFolder.name
|
|
783
|
-
}]] : [this._clientGetRootPath(), null];
|
|
784
|
-
const initParams = {
|
|
785
|
-
processId: null,
|
|
786
|
-
clientInfo: {
|
|
787
|
-
name: vscode_1.env.appName,
|
|
788
|
-
version: vscode_1.version
|
|
789
|
-
},
|
|
790
|
-
locale: this.getLocale(),
|
|
791
|
-
rootPath: rootPath ? rootPath : null,
|
|
792
|
-
rootUri: rootPath ? this._c2p.asUri(vscode_1.Uri.file(rootPath)) : null,
|
|
793
|
-
capabilities: this.computeClientCapabilities(),
|
|
794
|
-
initializationOptions: Is.func(initOption) ? initOption() : initOption,
|
|
795
|
-
trace: vscode_languageserver_protocol_1.Trace.toString(this._trace),
|
|
796
|
-
workspaceFolders: workspaceFolders
|
|
797
|
-
};
|
|
798
|
-
this.fillInitializeParams(initParams);
|
|
799
|
-
if (this._clientOptions.progressOnInitialization) {
|
|
800
|
-
const token = UUID.generateUuid();
|
|
801
|
-
const part = new progressPart_1.ProgressPart(connection, token);
|
|
802
|
-
initParams.workDoneToken = token;
|
|
803
|
-
try {
|
|
804
|
-
const result = await this.doInitialize(connection, initParams);
|
|
805
|
-
part.done();
|
|
806
|
-
return result;
|
|
807
|
-
} catch (error) {
|
|
808
|
-
part.cancel();
|
|
809
|
-
throw error;
|
|
810
|
-
}
|
|
811
|
-
} else {
|
|
812
|
-
return this.doInitialize(connection, initParams);
|
|
813
|
-
}
|
|
814
|
-
}
|
|
815
|
-
async doInitialize(connection, initParams) {
|
|
816
|
-
try {
|
|
817
|
-
const result = await connection.initialize(initParams);
|
|
818
|
-
if (result.capabilities.positionEncoding !== undefined && result.capabilities.positionEncoding !== vscode_languageserver_protocol_1.PositionEncodingKind.UTF16) {
|
|
819
|
-
throw new Error("Unsupported position encoding (".concat(result.capabilities.positionEncoding, ") received from server ").concat(this.name));
|
|
820
|
-
}
|
|
821
|
-
this._initializeResult = result;
|
|
822
|
-
this.$state = ClientState.Running;
|
|
823
|
-
let textDocumentSyncOptions = undefined;
|
|
824
|
-
if (Is.number(result.capabilities.textDocumentSync)) {
|
|
825
|
-
if (result.capabilities.textDocumentSync === vscode_languageserver_protocol_1.TextDocumentSyncKind.None) {
|
|
826
|
-
textDocumentSyncOptions = {
|
|
827
|
-
openClose: false,
|
|
828
|
-
change: vscode_languageserver_protocol_1.TextDocumentSyncKind.None,
|
|
829
|
-
save: undefined
|
|
830
|
-
};
|
|
831
|
-
} else {
|
|
832
|
-
textDocumentSyncOptions = {
|
|
833
|
-
openClose: true,
|
|
834
|
-
change: result.capabilities.textDocumentSync,
|
|
835
|
-
save: {
|
|
836
|
-
includeText: false
|
|
837
|
-
}
|
|
838
|
-
};
|
|
839
|
-
}
|
|
840
|
-
} else if (result.capabilities.textDocumentSync !== undefined && result.capabilities.textDocumentSync !== null) {
|
|
841
|
-
textDocumentSyncOptions = result.capabilities.textDocumentSync;
|
|
842
|
-
}
|
|
843
|
-
this._capabilities = Object.assign({}, result.capabilities, {
|
|
844
|
-
resolvedTextDocumentSync: textDocumentSyncOptions
|
|
845
|
-
});
|
|
846
|
-
connection.onNotification(vscode_languageserver_protocol_1.PublishDiagnosticsNotification.type, params => this.handleDiagnostics(params));
|
|
847
|
-
connection.onRequest(vscode_languageserver_protocol_1.RegistrationRequest.type, params => this.handleRegistrationRequest(params));
|
|
848
|
-
connection.onRequest('client/registerFeature', params => this.handleRegistrationRequest(params));
|
|
849
|
-
connection.onRequest(vscode_languageserver_protocol_1.UnregistrationRequest.type, params => this.handleUnregistrationRequest(params));
|
|
850
|
-
connection.onRequest('client/unregisterFeature', params => this.handleUnregistrationRequest(params));
|
|
851
|
-
connection.onRequest(vscode_languageserver_protocol_1.ApplyWorkspaceEditRequest.type, params => this.handleApplyWorkspaceEdit(params));
|
|
852
|
-
for (const [method, handler] of this._pendingNotificationHandlers) {
|
|
853
|
-
this._notificationDisposables.set(method, connection.onNotification(method, handler));
|
|
854
|
-
}
|
|
855
|
-
this._pendingNotificationHandlers.clear();
|
|
856
|
-
for (const [method, handler] of this._pendingRequestHandlers) {
|
|
857
|
-
this._requestDisposables.set(method, connection.onRequest(method, handler));
|
|
858
|
-
}
|
|
859
|
-
this._pendingRequestHandlers.clear();
|
|
860
|
-
for (const [token, data] of this._pendingProgressHandlers) {
|
|
861
|
-
this._progressDisposables.set(token, connection.onProgress(data.type, token, data.handler));
|
|
862
|
-
}
|
|
863
|
-
this._pendingProgressHandlers.clear();
|
|
864
|
-
await connection.sendNotification(vscode_languageserver_protocol_1.InitializedNotification.type, {});
|
|
865
|
-
this.hookFileEvents(connection);
|
|
866
|
-
this.hookConfigurationChanged(connection);
|
|
867
|
-
this.initializeFeatures(connection);
|
|
868
|
-
return result;
|
|
869
|
-
} catch (error) {
|
|
870
|
-
if (this._clientOptions.initializationFailedHandler) {
|
|
871
|
-
if (this._clientOptions.initializationFailedHandler(error)) {
|
|
872
|
-
void this.initialize(connection);
|
|
873
|
-
} else {
|
|
874
|
-
void this.stop();
|
|
875
|
-
}
|
|
876
|
-
} else if (error instanceof vscode_languageserver_protocol_1.ResponseError && error.data && error.data.retry) {
|
|
877
|
-
void vscode_1.window.showErrorMessage(error.message, {
|
|
878
|
-
title: 'Retry',
|
|
879
|
-
id: 'retry'
|
|
880
|
-
}).then(item => {
|
|
881
|
-
if (item && item.id === 'retry') {
|
|
882
|
-
void this.initialize(connection);
|
|
883
|
-
} else {
|
|
884
|
-
void this.stop();
|
|
885
|
-
}
|
|
886
|
-
});
|
|
887
|
-
} else {
|
|
888
|
-
if (error && error.message) {
|
|
889
|
-
void vscode_1.window.showErrorMessage(error.message);
|
|
890
|
-
}
|
|
891
|
-
this.error('Server initialization failed.', error);
|
|
892
|
-
void this.stop();
|
|
893
|
-
}
|
|
894
|
-
throw error;
|
|
895
|
-
}
|
|
896
|
-
}
|
|
897
|
-
_clientGetRootPath() {
|
|
898
|
-
let folders = vscode_1.workspace.workspaceFolders;
|
|
899
|
-
if (!folders || folders.length === 0) {
|
|
900
|
-
return undefined;
|
|
901
|
-
}
|
|
902
|
-
let folder = folders[0];
|
|
903
|
-
if (folder.uri.scheme === 'file') {
|
|
904
|
-
return folder.uri.fsPath;
|
|
905
|
-
}
|
|
906
|
-
return undefined;
|
|
907
|
-
}
|
|
908
|
-
stop() {
|
|
909
|
-
let timeout = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 2000;
|
|
910
|
-
return this.shutdown('stop', timeout);
|
|
911
|
-
}
|
|
912
|
-
dispose() {
|
|
913
|
-
let timeout = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 2000;
|
|
914
|
-
try {
|
|
915
|
-
this._disposed = 'disposing';
|
|
916
|
-
return this.stop(timeout);
|
|
917
|
-
} finally {
|
|
918
|
-
this._disposed = 'disposed';
|
|
919
|
-
}
|
|
920
|
-
}
|
|
921
|
-
async shutdown(mode, timeout) {
|
|
922
|
-
if (this.$state === ClientState.Stopped || this.$state === ClientState.Initial) {
|
|
923
|
-
return;
|
|
924
|
-
}
|
|
925
|
-
if (this.$state === ClientState.Stopping) {
|
|
926
|
-
if (this._onStop !== undefined) {
|
|
927
|
-
return this._onStop;
|
|
928
|
-
} else {
|
|
929
|
-
throw new Error("Client is stopping but no stop promise available.");
|
|
930
|
-
}
|
|
931
|
-
}
|
|
932
|
-
const connection = this.activeConnection();
|
|
933
|
-
if (connection === undefined || this.$state !== ClientState.Running) {
|
|
934
|
-
throw new Error("Client is not running and can't be stopped. It's current state is: ".concat(this.$state));
|
|
935
|
-
}
|
|
936
|
-
this._initializeResult = undefined;
|
|
937
|
-
this.$state = ClientState.Stopping;
|
|
938
|
-
this.cleanUp(mode);
|
|
939
|
-
const tp = new Promise(c => {
|
|
940
|
-
(0, vscode_languageserver_protocol_1.RAL)().timer.setTimeout(c, timeout);
|
|
941
|
-
});
|
|
942
|
-
const shutdown = (async connection => {
|
|
943
|
-
await connection.shutdown();
|
|
944
|
-
await connection.exit();
|
|
945
|
-
return connection;
|
|
946
|
-
})(connection);
|
|
947
|
-
return this._onStop = Promise.race([tp, shutdown]).then(connection => {
|
|
948
|
-
if (connection !== undefined) {
|
|
949
|
-
connection.end();
|
|
950
|
-
connection.dispose();
|
|
951
|
-
} else {
|
|
952
|
-
this.error("Stopping server timed out", undefined, false);
|
|
953
|
-
throw new Error("Stopping the server timed out");
|
|
954
|
-
}
|
|
955
|
-
}, error => {
|
|
956
|
-
this.error("Stopping server failed", error, false);
|
|
957
|
-
throw error;
|
|
958
|
-
}).finally(() => {
|
|
959
|
-
this.$state = ClientState.Stopped;
|
|
960
|
-
mode === 'stop' && this.cleanUpChannel();
|
|
961
|
-
this._onStart = undefined;
|
|
962
|
-
this._onStop = undefined;
|
|
963
|
-
this._connection = undefined;
|
|
964
|
-
this._ignoredRegistrations.clear();
|
|
965
|
-
});
|
|
966
|
-
}
|
|
967
|
-
cleanUp(mode) {
|
|
968
|
-
this._fileEvents = [];
|
|
969
|
-
this._fileEventDelayer.cancel();
|
|
970
|
-
const disposables = this._listeners.splice(0, this._listeners.length);
|
|
971
|
-
for (const disposable of disposables) {
|
|
972
|
-
disposable.dispose();
|
|
973
|
-
}
|
|
974
|
-
if (this._syncedDocuments) {
|
|
975
|
-
this._syncedDocuments.clear();
|
|
976
|
-
}
|
|
977
|
-
for (const feature of Array.from(this._features.entries()).map(entry => entry[1]).reverse()) {
|
|
978
|
-
feature.dispose();
|
|
979
|
-
}
|
|
980
|
-
if (mode === 'stop' && this._diagnostics !== undefined) {
|
|
981
|
-
this._diagnostics.dispose();
|
|
982
|
-
this._diagnostics = undefined;
|
|
983
|
-
}
|
|
984
|
-
if (this._idleInterval !== undefined) {
|
|
985
|
-
this._idleInterval.dispose();
|
|
986
|
-
this._idleInterval = undefined;
|
|
987
|
-
}
|
|
988
|
-
}
|
|
989
|
-
cleanUpChannel() {
|
|
990
|
-
if (this._outputChannel !== undefined && this._disposeOutputChannel) {
|
|
991
|
-
this._outputChannel.dispose();
|
|
992
|
-
this._outputChannel = undefined;
|
|
993
|
-
}
|
|
994
|
-
}
|
|
995
|
-
notifyFileEvent(event) {
|
|
996
|
-
var _this$clientOptions$m;
|
|
997
|
-
const client = this;
|
|
998
|
-
async function didChangeWatchedFile(event) {
|
|
999
|
-
client._fileEvents.push(event);
|
|
1000
|
-
return client._fileEventDelayer.trigger(async () => {
|
|
1001
|
-
await client.sendNotification(vscode_languageserver_protocol_1.DidChangeWatchedFilesNotification.type, {
|
|
1002
|
-
changes: client._fileEvents
|
|
1003
|
-
});
|
|
1004
|
-
client._fileEvents = [];
|
|
1005
|
-
});
|
|
1006
|
-
}
|
|
1007
|
-
const workSpaceMiddleware = (_this$clientOptions$m = this.clientOptions.middleware) === null || _this$clientOptions$m === void 0 ? void 0 : _this$clientOptions$m.workspace;
|
|
1008
|
-
(workSpaceMiddleware !== null && workSpaceMiddleware !== void 0 && workSpaceMiddleware.didChangeWatchedFile ? workSpaceMiddleware.didChangeWatchedFile(event, didChangeWatchedFile) : didChangeWatchedFile(event)).catch(error => {
|
|
1009
|
-
client.error("Notify file events failed.", error);
|
|
1010
|
-
});
|
|
1011
|
-
}
|
|
1012
|
-
async sendPendingFullTextDocumentChanges(connection) {
|
|
1013
|
-
return this._pendingChangeSemaphore.lock(async () => {
|
|
1014
|
-
try {
|
|
1015
|
-
const changes = this._didChangeTextDocumentFeature.getPendingDocumentChanges(this._pendingOpenNotifications);
|
|
1016
|
-
if (changes.length === 0) {
|
|
1017
|
-
return;
|
|
1018
|
-
}
|
|
1019
|
-
for (const document of changes) {
|
|
1020
|
-
const params = this.code2ProtocolConverter.asChangeTextDocumentParams(document);
|
|
1021
|
-
await connection.sendNotification(vscode_languageserver_protocol_1.DidChangeTextDocumentNotification.type, params);
|
|
1022
|
-
this._didChangeTextDocumentFeature.notificationSent(document, vscode_languageserver_protocol_1.DidChangeTextDocumentNotification.type, params);
|
|
1023
|
-
}
|
|
1024
|
-
} catch (error) {
|
|
1025
|
-
this.error("Sending pending changes failed", error, false);
|
|
1026
|
-
throw error;
|
|
1027
|
-
}
|
|
1028
|
-
});
|
|
1029
|
-
}
|
|
1030
|
-
triggerPendingChangeDelivery() {
|
|
1031
|
-
this._pendingChangeDelayer.trigger(async () => {
|
|
1032
|
-
const connection = this.activeConnection();
|
|
1033
|
-
if (connection === undefined) {
|
|
1034
|
-
this.triggerPendingChangeDelivery();
|
|
1035
|
-
return;
|
|
1036
|
-
}
|
|
1037
|
-
await this.sendPendingFullTextDocumentChanges(connection);
|
|
1038
|
-
}).catch(error => this.error("Delivering pending changes failed", error, false));
|
|
1039
|
-
}
|
|
1040
|
-
handleDiagnostics(params) {
|
|
1041
|
-
if (!this._diagnostics) {
|
|
1042
|
-
return;
|
|
1043
|
-
}
|
|
1044
|
-
const key = params.uri;
|
|
1045
|
-
if (this._diagnosticQueueState.state === 'busy' && this._diagnosticQueueState.document === key) {
|
|
1046
|
-
this._diagnosticQueueState.tokenSource.cancel();
|
|
1047
|
-
}
|
|
1048
|
-
this._diagnosticQueue.set(params.uri, params.diagnostics);
|
|
1049
|
-
this.triggerDiagnosticQueue();
|
|
1050
|
-
}
|
|
1051
|
-
triggerDiagnosticQueue() {
|
|
1052
|
-
(0, vscode_languageserver_protocol_1.RAL)().timer.setImmediate(() => {
|
|
1053
|
-
this.workDiagnosticQueue();
|
|
1054
|
-
});
|
|
1055
|
-
}
|
|
1056
|
-
workDiagnosticQueue() {
|
|
1057
|
-
if (this._diagnosticQueueState.state === 'busy') {
|
|
1058
|
-
return;
|
|
1059
|
-
}
|
|
1060
|
-
const next = this._diagnosticQueue.entries().next();
|
|
1061
|
-
if (next.done === true) {
|
|
1062
|
-
return;
|
|
1063
|
-
}
|
|
1064
|
-
const [document, diagnostics] = next.value;
|
|
1065
|
-
this._diagnosticQueue.delete(document);
|
|
1066
|
-
const tokenSource = new vscode_1.CancellationTokenSource();
|
|
1067
|
-
this._diagnosticQueueState = {
|
|
1068
|
-
state: 'busy',
|
|
1069
|
-
document: document,
|
|
1070
|
-
tokenSource
|
|
1071
|
-
};
|
|
1072
|
-
this._p2c.asDiagnostics(diagnostics, tokenSource.token).then(converted => {
|
|
1073
|
-
if (!tokenSource.token.isCancellationRequested) {
|
|
1074
|
-
const uri = this._p2c.asUri(document);
|
|
1075
|
-
const middleware = this.clientOptions.middleware;
|
|
1076
|
-
if (middleware.handleDiagnostics) {
|
|
1077
|
-
middleware.handleDiagnostics(uri, converted, (uri, diagnostics) => this.setDiagnostics(uri, diagnostics));
|
|
1078
|
-
} else {
|
|
1079
|
-
this.setDiagnostics(uri, converted);
|
|
1080
|
-
}
|
|
1081
|
-
}
|
|
1082
|
-
}).finally(() => {
|
|
1083
|
-
this._diagnosticQueueState = {
|
|
1084
|
-
state: 'idle'
|
|
1085
|
-
};
|
|
1086
|
-
this.triggerDiagnosticQueue();
|
|
1087
|
-
});
|
|
1088
|
-
}
|
|
1089
|
-
setDiagnostics(uri, diagnostics) {
|
|
1090
|
-
if (!this._diagnostics) {
|
|
1091
|
-
return;
|
|
1092
|
-
}
|
|
1093
|
-
this._diagnostics.set(uri, diagnostics);
|
|
1094
|
-
}
|
|
1095
|
-
getLocale() {
|
|
1096
|
-
return vscode_1.env.language;
|
|
1097
|
-
}
|
|
1098
|
-
async $start() {
|
|
1099
|
-
if (this.$state === ClientState.StartFailed) {
|
|
1100
|
-
throw new Error("Previous start failed. Can't restart server.");
|
|
1101
|
-
}
|
|
1102
|
-
await this.start();
|
|
1103
|
-
const connection = this.activeConnection();
|
|
1104
|
-
if (connection === undefined) {
|
|
1105
|
-
throw new Error("Starting server failed");
|
|
1106
|
-
}
|
|
1107
|
-
return connection;
|
|
1108
|
-
}
|
|
1109
|
-
async createConnection() {
|
|
1110
|
-
let errorHandler = (error, message, count) => {
|
|
1111
|
-
this.handleConnectionError(error, message, count).catch(error => this.error("Handling connection error failed", error));
|
|
1112
|
-
};
|
|
1113
|
-
let closeHandler = () => {
|
|
1114
|
-
this.handleConnectionClosed().catch(error => this.error("Handling connection close failed", error));
|
|
1115
|
-
};
|
|
1116
|
-
const transports = await this.createMessageTransports(this._clientOptions.stdioEncoding || 'utf8');
|
|
1117
|
-
this._connection = createConnection(transports.reader, transports.writer, errorHandler, closeHandler, this._clientOptions.connectionOptions);
|
|
1118
|
-
return this._connection;
|
|
1119
|
-
}
|
|
1120
|
-
async handleConnectionClosed() {
|
|
1121
|
-
if (this.$state === ClientState.Stopped) {
|
|
1122
|
-
return;
|
|
1123
|
-
}
|
|
1124
|
-
try {
|
|
1125
|
-
if (this._connection !== undefined) {
|
|
1126
|
-
this._connection.dispose();
|
|
1127
|
-
}
|
|
1128
|
-
} catch (error) {
|
|
1129
|
-
}
|
|
1130
|
-
let handlerResult = {
|
|
1131
|
-
action: CloseAction.DoNotRestart
|
|
1132
|
-
};
|
|
1133
|
-
if (this.$state !== ClientState.Stopping) {
|
|
1134
|
-
try {
|
|
1135
|
-
handlerResult = await this._clientOptions.errorHandler.closed();
|
|
1136
|
-
} catch (error) {
|
|
1137
|
-
}
|
|
1138
|
-
}
|
|
1139
|
-
this._connection = undefined;
|
|
1140
|
-
if (handlerResult.action === CloseAction.DoNotRestart) {
|
|
1141
|
-
var _handlerResult$messag;
|
|
1142
|
-
this.error((_handlerResult$messag = handlerResult.message) !== null && _handlerResult$messag !== void 0 ? _handlerResult$messag : 'Connection to server got closed. Server will not be restarted.', undefined, handlerResult.handled === true ? false : 'force');
|
|
1143
|
-
this.cleanUp('stop');
|
|
1144
|
-
if (this.$state === ClientState.Starting) {
|
|
1145
|
-
this.$state = ClientState.StartFailed;
|
|
1146
|
-
} else {
|
|
1147
|
-
this.$state = ClientState.Stopped;
|
|
1148
|
-
}
|
|
1149
|
-
this._onStop = Promise.resolve();
|
|
1150
|
-
this._onStart = undefined;
|
|
1151
|
-
} else if (handlerResult.action === CloseAction.Restart) {
|
|
1152
|
-
var _handlerResult$messag2;
|
|
1153
|
-
this.info((_handlerResult$messag2 = handlerResult.message) !== null && _handlerResult$messag2 !== void 0 ? _handlerResult$messag2 : 'Connection to server got closed. Server will restart.', !handlerResult.handled);
|
|
1154
|
-
this.cleanUp('restart');
|
|
1155
|
-
this.$state = ClientState.Initial;
|
|
1156
|
-
this._onStop = Promise.resolve();
|
|
1157
|
-
this._onStart = undefined;
|
|
1158
|
-
this.start().catch(error => this.error("Restarting server failed", error, 'force'));
|
|
1159
|
-
}
|
|
1160
|
-
}
|
|
1161
|
-
async handleConnectionError(error, message, count) {
|
|
1162
|
-
const handlerResult = await this._clientOptions.errorHandler.error(error, message, count);
|
|
1163
|
-
if (handlerResult.action === ErrorAction.Shutdown) {
|
|
1164
|
-
var _handlerResult$messag3;
|
|
1165
|
-
this.error((_handlerResult$messag3 = handlerResult.message) !== null && _handlerResult$messag3 !== void 0 ? _handlerResult$messag3 : "Client ".concat(this._name, ": connection to server is erroring. Shutting down server."), undefined, handlerResult.handled === true ? false : 'force');
|
|
1166
|
-
this.stop().catch(error => {
|
|
1167
|
-
this.error("Stopping server failed", error, false);
|
|
1168
|
-
});
|
|
1169
|
-
}
|
|
1170
|
-
}
|
|
1171
|
-
hookConfigurationChanged(connection) {
|
|
1172
|
-
this._listeners.push(vscode_1.workspace.onDidChangeConfiguration(() => {
|
|
1173
|
-
this.refreshTrace(connection, true);
|
|
1174
|
-
}));
|
|
1175
|
-
}
|
|
1176
|
-
refreshTrace(connection) {
|
|
1177
|
-
let sendNotification = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
1178
|
-
const config = vscode_1.workspace.getConfiguration(this._id);
|
|
1179
|
-
let trace = vscode_languageserver_protocol_1.Trace.Off;
|
|
1180
|
-
let traceFormat = vscode_languageserver_protocol_1.TraceFormat.Text;
|
|
1181
|
-
if (config) {
|
|
1182
|
-
const traceConfig = config.get('trace.server', 'off');
|
|
1183
|
-
if (typeof traceConfig === 'string') {
|
|
1184
|
-
trace = vscode_languageserver_protocol_1.Trace.fromString(traceConfig);
|
|
1185
|
-
} else {
|
|
1186
|
-
trace = vscode_languageserver_protocol_1.Trace.fromString(config.get('trace.server.verbosity', 'off'));
|
|
1187
|
-
traceFormat = vscode_languageserver_protocol_1.TraceFormat.fromString(config.get('trace.server.format', 'text'));
|
|
1188
|
-
}
|
|
1189
|
-
}
|
|
1190
|
-
this._trace = trace;
|
|
1191
|
-
this._traceFormat = traceFormat;
|
|
1192
|
-
connection.trace(this._trace, this._tracer, {
|
|
1193
|
-
sendNotification,
|
|
1194
|
-
traceFormat: this._traceFormat
|
|
1195
|
-
}).catch(error => {
|
|
1196
|
-
this.error("Updating trace failed with error", error, false);
|
|
1197
|
-
});
|
|
1198
|
-
}
|
|
1199
|
-
hookFileEvents(_connection) {
|
|
1200
|
-
let fileEvents = this._clientOptions.synchronize.fileEvents;
|
|
1201
|
-
if (!fileEvents) {
|
|
1202
|
-
return;
|
|
1203
|
-
}
|
|
1204
|
-
let watchers;
|
|
1205
|
-
if (Is.array(fileEvents)) {
|
|
1206
|
-
watchers = fileEvents;
|
|
1207
|
-
} else {
|
|
1208
|
-
watchers = [fileEvents];
|
|
1209
|
-
}
|
|
1210
|
-
if (!watchers) {
|
|
1211
|
-
return;
|
|
1212
|
-
}
|
|
1213
|
-
this._dynamicFeatures.get(vscode_languageserver_protocol_1.DidChangeWatchedFilesNotification.type.method).registerRaw(UUID.generateUuid(), watchers);
|
|
1214
|
-
}
|
|
1215
|
-
registerFeatures(features) {
|
|
1216
|
-
for (let feature of features) {
|
|
1217
|
-
this.registerFeature(feature);
|
|
1218
|
-
}
|
|
1219
|
-
}
|
|
1220
|
-
registerFeature(feature) {
|
|
1221
|
-
this._features.push(feature);
|
|
1222
|
-
if (features_1.DynamicFeature.is(feature)) {
|
|
1223
|
-
const registrationType = feature.registrationType;
|
|
1224
|
-
this._dynamicFeatures.set(registrationType.method, feature);
|
|
1225
|
-
}
|
|
1226
|
-
}
|
|
1227
|
-
getFeature(request) {
|
|
1228
|
-
return this._dynamicFeatures.get(request);
|
|
1229
|
-
}
|
|
1230
|
-
hasDedicatedTextSynchronizationFeature(textDocument) {
|
|
1231
|
-
const feature = this.getFeature(vscode_languageserver_protocol_1.NotebookDocumentSyncRegistrationType.method);
|
|
1232
|
-
if (feature === undefined || !(feature instanceof notebook_1.NotebookDocumentSyncFeature)) {
|
|
1233
|
-
return false;
|
|
1234
|
-
}
|
|
1235
|
-
return feature.handles(textDocument);
|
|
1236
|
-
}
|
|
1237
|
-
registerBuiltinFeatures() {
|
|
1238
|
-
const pendingFullTextDocumentChanges = new Map();
|
|
1239
|
-
this.registerFeature(new configuration_1.ConfigurationFeature(this));
|
|
1240
|
-
this.registerFeature(new textSynchronization_1.DidOpenTextDocumentFeature(this, this._syncedDocuments));
|
|
1241
|
-
this._didChangeTextDocumentFeature = new textSynchronization_1.DidChangeTextDocumentFeature(this, pendingFullTextDocumentChanges);
|
|
1242
|
-
this._didChangeTextDocumentFeature.onPendingChangeAdded(() => {
|
|
1243
|
-
this.triggerPendingChangeDelivery();
|
|
1244
|
-
});
|
|
1245
|
-
this.registerFeature(this._didChangeTextDocumentFeature);
|
|
1246
|
-
this.registerFeature(new textSynchronization_1.WillSaveFeature(this));
|
|
1247
|
-
this.registerFeature(new textSynchronization_1.WillSaveWaitUntilFeature(this));
|
|
1248
|
-
this.registerFeature(new textSynchronization_1.DidSaveTextDocumentFeature(this));
|
|
1249
|
-
this.registerFeature(new textSynchronization_1.DidCloseTextDocumentFeature(this, this._syncedDocuments, pendingFullTextDocumentChanges));
|
|
1250
|
-
this.registerFeature(new fileSystemWatcher_1.FileSystemWatcherFeature(this, event => this.notifyFileEvent(event)));
|
|
1251
|
-
this.registerFeature(new completion_1.CompletionItemFeature(this));
|
|
1252
|
-
this.registerFeature(new hover_1.HoverFeature(this));
|
|
1253
|
-
this.registerFeature(new signatureHelp_1.SignatureHelpFeature(this));
|
|
1254
|
-
this.registerFeature(new definition_1.DefinitionFeature(this));
|
|
1255
|
-
this.registerFeature(new reference_1.ReferencesFeature(this));
|
|
1256
|
-
this.registerFeature(new documentHighlight_1.DocumentHighlightFeature(this));
|
|
1257
|
-
this.registerFeature(new documentSymbol_1.DocumentSymbolFeature(this));
|
|
1258
|
-
this.registerFeature(new workspaceSymbol_1.WorkspaceSymbolFeature(this));
|
|
1259
|
-
this.registerFeature(new codeAction_1.CodeActionFeature(this));
|
|
1260
|
-
this.registerFeature(new codeLens_1.CodeLensFeature(this));
|
|
1261
|
-
this.registerFeature(new formatting_1.DocumentFormattingFeature(this));
|
|
1262
|
-
this.registerFeature(new formatting_1.DocumentRangeFormattingFeature(this));
|
|
1263
|
-
this.registerFeature(new formatting_1.DocumentOnTypeFormattingFeature(this));
|
|
1264
|
-
this.registerFeature(new rename_1.RenameFeature(this));
|
|
1265
|
-
this.registerFeature(new documentLink_1.DocumentLinkFeature(this));
|
|
1266
|
-
this.registerFeature(new executeCommand_1.ExecuteCommandFeature(this));
|
|
1267
|
-
this.registerFeature(new configuration_1.SyncConfigurationFeature(this));
|
|
1268
|
-
this.registerFeature(new typeDefinition_1.TypeDefinitionFeature(this));
|
|
1269
|
-
this.registerFeature(new implementation_1.ImplementationFeature(this));
|
|
1270
|
-
this.registerFeature(new colorProvider_1.ColorProviderFeature(this));
|
|
1271
|
-
if (this.clientOptions.workspaceFolder === undefined) {
|
|
1272
|
-
this.registerFeature(new workspaceFolder_1.WorkspaceFoldersFeature(this));
|
|
1273
|
-
}
|
|
1274
|
-
this.registerFeature(new foldingRange_1.FoldingRangeFeature(this));
|
|
1275
|
-
this.registerFeature(new declaration_1.DeclarationFeature(this));
|
|
1276
|
-
this.registerFeature(new selectionRange_1.SelectionRangeFeature(this));
|
|
1277
|
-
this.registerFeature(new progress_1.ProgressFeature(this));
|
|
1278
|
-
this.registerFeature(new callHierarchy_1.CallHierarchyFeature(this));
|
|
1279
|
-
this.registerFeature(new semanticTokens_1.SemanticTokensFeature(this));
|
|
1280
|
-
this.registerFeature(new linkedEditingRange_1.LinkedEditingFeature(this));
|
|
1281
|
-
this.registerFeature(new fileOperations_1.DidCreateFilesFeature(this));
|
|
1282
|
-
this.registerFeature(new fileOperations_1.DidRenameFilesFeature(this));
|
|
1283
|
-
this.registerFeature(new fileOperations_1.DidDeleteFilesFeature(this));
|
|
1284
|
-
this.registerFeature(new fileOperations_1.WillCreateFilesFeature(this));
|
|
1285
|
-
this.registerFeature(new fileOperations_1.WillRenameFilesFeature(this));
|
|
1286
|
-
this.registerFeature(new fileOperations_1.WillDeleteFilesFeature(this));
|
|
1287
|
-
this.registerFeature(new typeHierarchy_1.TypeHierarchyFeature(this));
|
|
1288
|
-
this.registerFeature(new inlineValue_1.InlineValueFeature(this));
|
|
1289
|
-
this.registerFeature(new inlayHint_1.InlayHintsFeature(this));
|
|
1290
|
-
this.registerFeature(new diagnostic_1.DiagnosticFeature(this));
|
|
1291
|
-
this.registerFeature(new notebook_1.NotebookDocumentSyncFeature(this));
|
|
1292
|
-
}
|
|
1293
|
-
registerProposedFeatures() {
|
|
1294
|
-
this.registerFeatures(ProposedFeatures.createAll(this));
|
|
1295
|
-
}
|
|
1296
|
-
fillInitializeParams(params) {
|
|
1297
|
-
for (let feature of this._features) {
|
|
1298
|
-
if (Is.func(feature.fillInitializeParams)) {
|
|
1299
|
-
feature.fillInitializeParams(params);
|
|
1300
|
-
}
|
|
1301
|
-
}
|
|
1302
|
-
}
|
|
1303
|
-
computeClientCapabilities() {
|
|
1304
|
-
const result = {};
|
|
1305
|
-
(0, features_1.ensure)(result, 'workspace').applyEdit = true;
|
|
1306
|
-
const workspaceEdit = (0, features_1.ensure)((0, features_1.ensure)(result, 'workspace'), 'workspaceEdit');
|
|
1307
|
-
workspaceEdit.documentChanges = true;
|
|
1308
|
-
workspaceEdit.resourceOperations = [vscode_languageserver_protocol_1.ResourceOperationKind.Create, vscode_languageserver_protocol_1.ResourceOperationKind.Rename, vscode_languageserver_protocol_1.ResourceOperationKind.Delete];
|
|
1309
|
-
workspaceEdit.failureHandling = vscode_languageserver_protocol_1.FailureHandlingKind.TextOnlyTransactional;
|
|
1310
|
-
workspaceEdit.normalizesLineEndings = true;
|
|
1311
|
-
workspaceEdit.changeAnnotationSupport = {
|
|
1312
|
-
groupsOnLabel: true
|
|
1313
|
-
};
|
|
1314
|
-
const diagnostics = (0, features_1.ensure)((0, features_1.ensure)(result, 'textDocument'), 'publishDiagnostics');
|
|
1315
|
-
diagnostics.relatedInformation = true;
|
|
1316
|
-
diagnostics.versionSupport = false;
|
|
1317
|
-
diagnostics.tagSupport = {
|
|
1318
|
-
valueSet: [vscode_languageserver_protocol_1.DiagnosticTag.Unnecessary, vscode_languageserver_protocol_1.DiagnosticTag.Deprecated]
|
|
1319
|
-
};
|
|
1320
|
-
diagnostics.codeDescriptionSupport = true;
|
|
1321
|
-
diagnostics.dataSupport = true;
|
|
1322
|
-
const windowCapabilities = (0, features_1.ensure)(result, 'window');
|
|
1323
|
-
const showMessage = (0, features_1.ensure)(windowCapabilities, 'showMessage');
|
|
1324
|
-
showMessage.messageActionItem = {
|
|
1325
|
-
additionalPropertiesSupport: true
|
|
1326
|
-
};
|
|
1327
|
-
const showDocument = (0, features_1.ensure)(windowCapabilities, 'showDocument');
|
|
1328
|
-
showDocument.support = true;
|
|
1329
|
-
const generalCapabilities = (0, features_1.ensure)(result, 'general');
|
|
1330
|
-
generalCapabilities.staleRequestSupport = {
|
|
1331
|
-
cancel: true,
|
|
1332
|
-
retryOnContentModified: Array.from(BaseLanguageClient.RequestsToCancelOnContentModified)
|
|
1333
|
-
};
|
|
1334
|
-
generalCapabilities.regularExpressions = {
|
|
1335
|
-
engine: 'ECMAScript',
|
|
1336
|
-
version: 'ES2020'
|
|
1337
|
-
};
|
|
1338
|
-
generalCapabilities.markdown = {
|
|
1339
|
-
parser: 'marked',
|
|
1340
|
-
version: '1.1.0'
|
|
1341
|
-
};
|
|
1342
|
-
generalCapabilities.positionEncodings = ['utf-16'];
|
|
1343
|
-
if (this._clientOptions.markdown.supportHtml) {
|
|
1344
|
-
generalCapabilities.markdown.allowedTags = ['ul', 'li', 'p', 'code', 'blockquote', 'ol', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'hr', 'em', 'pre', 'table', 'thead', 'tbody', 'tr', 'th', 'td', 'div', 'del', 'a', 'strong', 'br', 'img', 'span'];
|
|
1345
|
-
}
|
|
1346
|
-
for (let feature of this._features) {
|
|
1347
|
-
feature.fillClientCapabilities(result);
|
|
1348
|
-
}
|
|
1349
|
-
return result;
|
|
1350
|
-
}
|
|
1351
|
-
initializeFeatures(_connection) {
|
|
1352
|
-
const documentSelector = this._clientOptions.documentSelector;
|
|
1353
|
-
for (const feature of this._features) {
|
|
1354
|
-
if (Is.func(feature.preInitialize)) {
|
|
1355
|
-
feature.preInitialize(this._capabilities, documentSelector);
|
|
1356
|
-
}
|
|
1357
|
-
}
|
|
1358
|
-
for (const feature of this._features) {
|
|
1359
|
-
feature.initialize(this._capabilities, documentSelector);
|
|
1360
|
-
}
|
|
1361
|
-
}
|
|
1362
|
-
async handleRegistrationRequest(params) {
|
|
1363
|
-
if (!this.isRunning()) {
|
|
1364
|
-
for (const registration of params.registrations) {
|
|
1365
|
-
this._ignoredRegistrations.add(registration.id);
|
|
1366
|
-
}
|
|
1367
|
-
return;
|
|
1368
|
-
}
|
|
1369
|
-
for (const registration of params.registrations) {
|
|
1370
|
-
var _registration$registe, _options$documentSele;
|
|
1371
|
-
const feature = this._dynamicFeatures.get(registration.method);
|
|
1372
|
-
if (feature === undefined) {
|
|
1373
|
-
return Promise.reject(new Error("No feature implementation for ".concat(registration.method, " found. Registration failed.")));
|
|
1374
|
-
}
|
|
1375
|
-
const options = (_registration$registe = registration.registerOptions) !== null && _registration$registe !== void 0 ? _registration$registe : {};
|
|
1376
|
-
options.documentSelector = (_options$documentSele = options.documentSelector) !== null && _options$documentSele !== void 0 ? _options$documentSele : this._clientOptions.documentSelector;
|
|
1377
|
-
const data = {
|
|
1378
|
-
id: registration.id,
|
|
1379
|
-
registerOptions: options
|
|
1380
|
-
};
|
|
1381
|
-
try {
|
|
1382
|
-
feature.register(data);
|
|
1383
|
-
} catch (err) {
|
|
1384
|
-
return Promise.reject(err);
|
|
1385
|
-
}
|
|
1386
|
-
}
|
|
1387
|
-
}
|
|
1388
|
-
async handleUnregistrationRequest(params) {
|
|
1389
|
-
for (let unregistration of params.unregisterations) {
|
|
1390
|
-
if (this._ignoredRegistrations.has(unregistration.id)) {
|
|
1391
|
-
continue;
|
|
1392
|
-
}
|
|
1393
|
-
const feature = this._dynamicFeatures.get(unregistration.method);
|
|
1394
|
-
if (!feature) {
|
|
1395
|
-
return Promise.reject(new Error("No feature implementation for ".concat(unregistration.method, " found. Unregistration failed.")));
|
|
1396
|
-
}
|
|
1397
|
-
feature.unregister(unregistration.id);
|
|
1398
|
-
}
|
|
1399
|
-
}
|
|
1400
|
-
async handleApplyWorkspaceEdit(params) {
|
|
1401
|
-
const workspaceEdit = params.edit;
|
|
1402
|
-
const converted = await this.workspaceEditLock.lock(() => {
|
|
1403
|
-
return this._p2c.asWorkspaceEdit(workspaceEdit);
|
|
1404
|
-
});
|
|
1405
|
-
const openTextDocuments = new Map();
|
|
1406
|
-
vscode_1.workspace.textDocuments.forEach(document => openTextDocuments.set(document.uri.toString(), document));
|
|
1407
|
-
let versionMismatch = false;
|
|
1408
|
-
if (workspaceEdit.documentChanges) {
|
|
1409
|
-
for (const change of workspaceEdit.documentChanges) {
|
|
1410
|
-
if (vscode_languageserver_protocol_1.TextDocumentEdit.is(change) && change.textDocument.version && change.textDocument.version >= 0) {
|
|
1411
|
-
const changeUri = this._p2c.asUri(change.textDocument.uri).toString();
|
|
1412
|
-
const textDocument = openTextDocuments.get(changeUri);
|
|
1413
|
-
if (textDocument && textDocument.version !== change.textDocument.version) {
|
|
1414
|
-
versionMismatch = true;
|
|
1415
|
-
break;
|
|
1416
|
-
}
|
|
1417
|
-
}
|
|
1418
|
-
}
|
|
1419
|
-
}
|
|
1420
|
-
if (versionMismatch) {
|
|
1421
|
-
return Promise.resolve({
|
|
1422
|
-
applied: false
|
|
1423
|
-
});
|
|
1424
|
-
}
|
|
1425
|
-
return Is.asPromise(vscode_1.workspace.applyEdit(converted).then(value => {
|
|
1426
|
-
return {
|
|
1427
|
-
applied: value
|
|
1428
|
-
};
|
|
1429
|
-
}));
|
|
1430
|
-
}
|
|
1431
|
-
handleFailedRequest(type, token, error, defaultValue) {
|
|
1432
|
-
let showNotification = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
|
|
1433
|
-
if (error instanceof vscode_languageserver_protocol_1.ResponseError) {
|
|
1434
|
-
if (error.code === vscode_languageserver_protocol_1.ErrorCodes.PendingResponseRejected || error.code === vscode_languageserver_protocol_1.ErrorCodes.ConnectionInactive) {
|
|
1435
|
-
return defaultValue;
|
|
1436
|
-
}
|
|
1437
|
-
if (error.code === vscode_languageserver_protocol_1.LSPErrorCodes.RequestCancelled || error.code === vscode_languageserver_protocol_1.LSPErrorCodes.ServerCancelled) {
|
|
1438
|
-
if (token !== undefined && token.isCancellationRequested) {
|
|
1439
|
-
return defaultValue;
|
|
1440
|
-
} else {
|
|
1441
|
-
if (error.data !== undefined) {
|
|
1442
|
-
throw new features_1.LSPCancellationError(error.data);
|
|
1443
|
-
} else {
|
|
1444
|
-
throw new vscode_1.CancellationError();
|
|
1445
|
-
}
|
|
1446
|
-
}
|
|
1447
|
-
} else if (error.code === vscode_languageserver_protocol_1.LSPErrorCodes.ContentModified) {
|
|
1448
|
-
if (BaseLanguageClient.RequestsToCancelOnContentModified.has(type.method) || BaseLanguageClient.CancellableResolveCalls.has(type.method)) {
|
|
1449
|
-
throw new vscode_1.CancellationError();
|
|
1450
|
-
} else {
|
|
1451
|
-
return defaultValue;
|
|
1452
|
-
}
|
|
1453
|
-
}
|
|
1454
|
-
}
|
|
1455
|
-
this.error("Request ".concat(type.method, " failed."), error, showNotification);
|
|
1456
|
-
throw error;
|
|
1457
|
-
}
|
|
1458
|
-
}
|
|
1459
|
-
exports.BaseLanguageClient = BaseLanguageClient;
|
|
1460
|
-
BaseLanguageClient.RequestsToCancelOnContentModified = new Set([vscode_languageserver_protocol_1.SemanticTokensRequest.method, vscode_languageserver_protocol_1.SemanticTokensRangeRequest.method, vscode_languageserver_protocol_1.SemanticTokensDeltaRequest.method]);
|
|
1461
|
-
BaseLanguageClient.CancellableResolveCalls = new Set([vscode_languageserver_protocol_1.CompletionResolveRequest.method, vscode_languageserver_protocol_1.CodeLensResolveRequest.method, vscode_languageserver_protocol_1.CodeActionResolveRequest.method, vscode_languageserver_protocol_1.InlayHintResolveRequest.method, vscode_languageserver_protocol_1.DocumentLinkResolveRequest.method, vscode_languageserver_protocol_1.WorkspaceSymbolResolveRequest.method]);
|
|
1462
|
-
class ConsoleLogger {
|
|
1463
|
-
error(message) {
|
|
1464
|
-
(0, vscode_languageserver_protocol_1.RAL)().console.error(message);
|
|
1465
|
-
}
|
|
1466
|
-
warn(message) {
|
|
1467
|
-
(0, vscode_languageserver_protocol_1.RAL)().console.warn(message);
|
|
1468
|
-
}
|
|
1469
|
-
info(message) {
|
|
1470
|
-
(0, vscode_languageserver_protocol_1.RAL)().console.info(message);
|
|
1471
|
-
}
|
|
1472
|
-
log(message) {
|
|
1473
|
-
(0, vscode_languageserver_protocol_1.RAL)().console.log(message);
|
|
1474
|
-
}
|
|
1475
|
-
}
|
|
1476
|
-
function createConnection(input, output, errorHandler, closeHandler, options) {
|
|
1477
|
-
const logger = new ConsoleLogger();
|
|
1478
|
-
const connection = (0, vscode_languageserver_protocol_1.createProtocolConnection)(input, output, logger, options);
|
|
1479
|
-
connection.onError(data => {
|
|
1480
|
-
errorHandler(data[0], data[1], data[2]);
|
|
1481
|
-
});
|
|
1482
|
-
connection.onClose(closeHandler);
|
|
1483
|
-
const result = {
|
|
1484
|
-
listen: () => connection.listen(),
|
|
1485
|
-
sendRequest: connection.sendRequest,
|
|
1486
|
-
onRequest: connection.onRequest,
|
|
1487
|
-
hasPendingResponse: connection.hasPendingResponse,
|
|
1488
|
-
sendNotification: connection.sendNotification,
|
|
1489
|
-
onNotification: connection.onNotification,
|
|
1490
|
-
onProgress: connection.onProgress,
|
|
1491
|
-
sendProgress: connection.sendProgress,
|
|
1492
|
-
trace: (value, tracer, sendNotificationOrTraceOptions) => {
|
|
1493
|
-
const defaultTraceOptions = {
|
|
1494
|
-
sendNotification: false,
|
|
1495
|
-
traceFormat: vscode_languageserver_protocol_1.TraceFormat.Text
|
|
1496
|
-
};
|
|
1497
|
-
if (sendNotificationOrTraceOptions === undefined) {
|
|
1498
|
-
return connection.trace(value, tracer, defaultTraceOptions);
|
|
1499
|
-
} else if (Is.boolean(sendNotificationOrTraceOptions)) {
|
|
1500
|
-
return connection.trace(value, tracer, sendNotificationOrTraceOptions);
|
|
1501
|
-
} else {
|
|
1502
|
-
return connection.trace(value, tracer, sendNotificationOrTraceOptions);
|
|
1503
|
-
}
|
|
1504
|
-
},
|
|
1505
|
-
initialize: params => {
|
|
1506
|
-
return connection.sendRequest(vscode_languageserver_protocol_1.InitializeRequest.type, params);
|
|
1507
|
-
},
|
|
1508
|
-
shutdown: () => {
|
|
1509
|
-
return connection.sendRequest(vscode_languageserver_protocol_1.ShutdownRequest.type, undefined);
|
|
1510
|
-
},
|
|
1511
|
-
exit: () => {
|
|
1512
|
-
return connection.sendNotification(vscode_languageserver_protocol_1.ExitNotification.type);
|
|
1513
|
-
},
|
|
1514
|
-
end: () => connection.end(),
|
|
1515
|
-
dispose: () => connection.dispose()
|
|
1516
|
-
};
|
|
1517
|
-
return result;
|
|
1518
|
-
}
|
|
1519
|
-
var ProposedFeatures;
|
|
1520
|
-
(function (ProposedFeatures) {
|
|
1521
|
-
function createAll(_client) {
|
|
1522
|
-
let result = [];
|
|
1523
|
-
return result;
|
|
1524
|
-
}
|
|
1525
|
-
ProposedFeatures.createAll = createAll;
|
|
1526
|
-
})(ProposedFeatures = exports.ProposedFeatures || (exports.ProposedFeatures = {}));
|
|
1527
|
-
})(client);
|