@codingame/monaco-languageclient-wrapper 4.4.1 → 5.0.0-next.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 +32 -0
- package/dist/_virtual/_rollupPluginBabelHelpers.js +50 -0
- package/dist/_virtual/_vscode.js +4 -0
- package/dist/_virtual/api.js +2 -0
- package/dist/_virtual/api2.js +2 -0
- package/dist/_virtual/api3.js +2 -0
- package/dist/_virtual/async.js +2 -0
- package/dist/_virtual/callHierarchy.js +2 -0
- package/dist/_virtual/cancellation.js +2 -0
- package/dist/_virtual/client.js +2 -0
- package/dist/_virtual/codeAction.js +2 -0
- package/dist/_virtual/codeConverter.js +2 -0
- package/dist/_virtual/codeLens.js +2 -0
- package/dist/_virtual/colorProvider.js +2 -0
- package/dist/_virtual/completion.js +2 -0
- package/dist/_virtual/configuration.js +2 -0
- package/dist/_virtual/connection.js +2 -0
- package/dist/_virtual/connection2.js +2 -0
- package/dist/_virtual/declaration.js +2 -0
- package/dist/_virtual/definition.js +2 -0
- package/dist/_virtual/diagnostic.js +2 -0
- package/dist/_virtual/disposable.js +2 -0
- package/dist/_virtual/documentHighlight.js +2 -0
- package/dist/_virtual/documentLink.js +2 -0
- package/dist/_virtual/documentSymbol.js +2 -0
- package/dist/_virtual/events.js +2 -0
- package/dist/_virtual/executeCommand.js +2 -0
- package/dist/_virtual/features.js +2 -0
- package/dist/_virtual/fileOperations.js +2 -0
- package/dist/_virtual/fileSystemWatcher.js +2 -0
- package/dist/_virtual/foldingRange.js +2 -0
- package/dist/_virtual/formatting.js +2 -0
- package/dist/_virtual/hover.js +2 -0
- package/dist/_virtual/implementation.js +2 -0
- package/dist/_virtual/inlayHint.js +2 -0
- package/dist/_virtual/inlineValue.js +2 -0
- package/dist/_virtual/is.js +2 -0
- package/dist/_virtual/is2.js +2 -0
- package/dist/_virtual/is3.js +2 -0
- package/dist/_virtual/linkedEditingRange.js +2 -0
- package/dist/_virtual/linkedMap.js +2 -0
- package/dist/_virtual/main.js +2 -0
- package/dist/_virtual/main2.js +2 -0
- package/dist/_virtual/main3.js +2 -0
- package/dist/_virtual/main4.js +4 -0
- package/dist/_virtual/messageBuffer.js +2 -0
- package/dist/_virtual/messageReader.js +2 -0
- package/dist/_virtual/messageWriter.js +2 -0
- package/dist/_virtual/messages.js +2 -0
- package/dist/_virtual/messages2.js +2 -0
- package/dist/_virtual/notebook.js +2 -0
- package/dist/_virtual/once.js +2 -0
- package/dist/_virtual/path.js +4 -0
- package/dist/_virtual/progress.js +2 -0
- package/dist/_virtual/progressPart.js +2 -0
- package/dist/_virtual/protocol.callHierarchy.js +2 -0
- package/dist/_virtual/protocol.colorProvider.js +2 -0
- package/dist/_virtual/protocol.configuration.js +2 -0
- package/dist/_virtual/protocol.declaration.js +2 -0
- package/dist/_virtual/protocol.diagnostic.js +2 -0
- package/dist/_virtual/protocol.fileOperations.js +2 -0
- package/dist/_virtual/protocol.foldingRange.js +2 -0
- package/dist/_virtual/protocol.implementation.js +2 -0
- package/dist/_virtual/protocol.inlayHint.js +2 -0
- package/dist/_virtual/protocol.inlineValue.js +2 -0
- package/dist/_virtual/protocol.js +2 -0
- package/dist/_virtual/protocol.linkedEditingRange.js +2 -0
- package/dist/_virtual/protocol.moniker.js +2 -0
- package/dist/_virtual/protocol.notebook.js +2 -0
- package/dist/_virtual/protocol.progress.js +2 -0
- package/dist/_virtual/protocol.selectionRange.js +2 -0
- package/dist/_virtual/protocol.semanticTokens.js +2 -0
- package/dist/_virtual/protocol.showDocument.js +2 -0
- package/dist/_virtual/protocol.typeDefinition.js +2 -0
- package/dist/_virtual/protocol.typeHierarchy.js +2 -0
- package/dist/_virtual/protocol.workspaceFolder.js +2 -0
- package/dist/_virtual/protocolCallHierarchyItem.js +2 -0
- package/dist/_virtual/protocolCodeAction.js +2 -0
- package/dist/_virtual/protocolCodeLens.js +2 -0
- package/dist/_virtual/protocolCompletionItem.js +2 -0
- package/dist/_virtual/protocolConverter.js +2 -0
- package/dist/_virtual/protocolDiagnostic.js +2 -0
- package/dist/_virtual/protocolDocumentLink.js +2 -0
- package/dist/_virtual/protocolInlayHint.js +2 -0
- package/dist/_virtual/protocolTypeHierarchyItem.js +2 -0
- package/dist/_virtual/protocolWorkspaceSymbol.js +2 -0
- package/dist/_virtual/ral.js +2 -0
- package/dist/_virtual/reference.js +2 -0
- package/dist/_virtual/rename.js +2 -0
- package/dist/_virtual/ril.js +2 -0
- package/dist/_virtual/selectionRange.js +2 -0
- package/dist/_virtual/semanticTokens.js +2 -0
- package/dist/_virtual/semaphore.js +2 -0
- package/dist/_virtual/sharedArrayCancellation.js +2 -0
- package/dist/_virtual/signatureHelp.js +2 -0
- package/dist/_virtual/textSynchronization.js +2 -0
- package/dist/_virtual/typeDefinition.js +2 -0
- package/dist/_virtual/typeHierarchy.js +2 -0
- package/dist/_virtual/uuid.js +2 -0
- package/dist/_virtual/workspaceFolder.js +2 -0
- package/dist/_virtual/workspaceSymbol.js +2 -0
- package/dist/extensions/java/commands.js +74 -0
- package/dist/extensions/java/extension.js +13 -0
- package/dist/extensions/java/inlayHintsProvider.js +59 -0
- package/dist/extensions/java/protocol.js +69 -0
- package/dist/{java.js → extensions/java/sourceAction.js} +6 -246
- package/dist/index.d.ts +2908 -2814
- package/dist/index.js +5 -1
- package/dist/node_modules/balanced-match/index.js +52 -0
- package/dist/node_modules/delay/index.js +46 -0
- package/dist/node_modules/monaco-languageclient/lib/monaco-language-client.js +127 -0
- package/dist/node_modules/once/once.js +44 -0
- package/dist/node_modules/tslib/tslib.es6.js +14 -0
- package/dist/node_modules/vscode-jsonrpc/browser.js +4 -0
- package/dist/node_modules/vscode-jsonrpc/lib/browser/main.js +77 -0
- package/dist/node_modules/vscode-jsonrpc/lib/browser/ril.js +153 -0
- package/dist/node_modules/vscode-jsonrpc/lib/common/api.js +96 -0
- package/dist/node_modules/vscode-jsonrpc/lib/common/cancellation.js +97 -0
- package/dist/node_modules/vscode-jsonrpc/lib/common/connection.js +1180 -0
- package/dist/node_modules/vscode-jsonrpc/lib/common/disposable.js +20 -0
- package/dist/node_modules/vscode-jsonrpc/lib/common/events.js +122 -0
- package/dist/node_modules/vscode-jsonrpc/lib/common/is.js +38 -0
- package/dist/node_modules/vscode-jsonrpc/lib/common/linkedMap.js +388 -0
- package/dist/node_modules/vscode-jsonrpc/lib/common/messageBuffer.js +149 -0
- package/dist/node_modules/vscode-jsonrpc/lib/common/messageReader.js +194 -0
- package/dist/node_modules/vscode-jsonrpc/lib/common/messageWriter.js +123 -0
- package/dist/node_modules/vscode-jsonrpc/lib/common/messages.js +241 -0
- package/dist/node_modules/vscode-jsonrpc/lib/common/ral.js +26 -0
- package/dist/node_modules/vscode-jsonrpc/lib/common/semaphore.js +72 -0
- package/dist/node_modules/vscode-jsonrpc/lib/common/sharedArrayCancellation.js +80 -0
- package/dist/node_modules/vscode-languageclient/lib/browser/main.js +49 -0
- package/dist/node_modules/vscode-languageclient/lib/common/api.js +51 -0
- package/dist/node_modules/vscode-languageclient/lib/common/callHierarchy.js +98 -0
- package/dist/node_modules/vscode-languageclient/lib/common/client.js +1527 -0
- package/dist/node_modules/vscode-languageclient/lib/common/codeAction.js +92 -0
- package/dist/node_modules/vscode-languageclient/lib/common/codeConverter.js +881 -0
- package/dist/node_modules/vscode-languageclient/lib/common/codeLens.js +84 -0
- package/dist/node_modules/vscode-languageclient/lib/common/colorProvider.js +77 -0
- package/dist/node_modules/vscode-languageclient/lib/common/completion.js +105 -0
- package/dist/node_modules/vscode-languageclient/lib/common/configuration.js +214 -0
- package/dist/node_modules/vscode-languageclient/lib/common/declaration.js +59 -0
- package/dist/node_modules/vscode-languageclient/lib/common/definition.js +62 -0
- package/dist/node_modules/vscode-languageclient/lib/common/diagnostic.js +839 -0
- package/dist/node_modules/vscode-languageclient/lib/common/documentHighlight.js +57 -0
- package/dist/node_modules/vscode-languageclient/lib/common/documentLink.js +74 -0
- package/dist/node_modules/vscode-languageclient/lib/common/documentSymbol.js +82 -0
- package/dist/node_modules/vscode-languageclient/lib/common/executeCommand.js +83 -0
- package/dist/node_modules/vscode-languageclient/lib/common/features.js +310 -0
- package/dist/node_modules/vscode-languageclient/lib/common/fileOperations.js +319 -0
- package/dist/node_modules/vscode-languageclient/lib/common/fileSystemWatcher.js +104 -0
- package/dist/node_modules/vscode-languageclient/lib/common/foldingRange.js +66 -0
- package/dist/node_modules/vscode-languageclient/lib/common/formatting.js +165 -0
- package/dist/node_modules/vscode-languageclient/lib/common/hover.js +62 -0
- package/dist/node_modules/vscode-languageclient/lib/common/implementation.js +59 -0
- package/dist/node_modules/vscode-languageclient/lib/common/inlayHint.js +94 -0
- package/dist/node_modules/vscode-languageclient/lib/common/inlineValue.js +73 -0
- package/dist/node_modules/vscode-languageclient/lib/common/linkedEditingRange.js +58 -0
- package/dist/node_modules/vscode-languageclient/lib/common/notebook.js +858 -0
- package/dist/node_modules/vscode-languageclient/lib/common/progress.js +51 -0
- package/dist/node_modules/vscode-languageclient/lib/common/progressPart.js +107 -0
- package/dist/node_modules/vscode-languageclient/lib/common/protocolCallHierarchyItem.js +15 -0
- package/dist/node_modules/vscode-languageclient/lib/common/protocolCodeAction.js +13 -0
- package/dist/node_modules/vscode-languageclient/lib/common/protocolCodeLens.js +12 -0
- package/dist/node_modules/vscode-languageclient/lib/common/protocolCompletionItem.js +12 -0
- package/dist/node_modules/vscode-languageclient/lib/common/protocolConverter.js +1129 -0
- package/dist/node_modules/vscode-languageclient/lib/common/protocolDiagnostic.js +27 -0
- package/dist/node_modules/vscode-languageclient/lib/common/protocolDocumentLink.js +12 -0
- package/dist/node_modules/vscode-languageclient/lib/common/protocolInlayHint.js +12 -0
- package/dist/node_modules/vscode-languageclient/lib/common/protocolTypeHierarchyItem.js +15 -0
- package/dist/node_modules/vscode-languageclient/lib/common/protocolWorkspaceSymbol.js +17 -0
- package/dist/node_modules/vscode-languageclient/lib/common/reference.js +60 -0
- package/dist/node_modules/vscode-languageclient/lib/common/rename.js +112 -0
- package/dist/node_modules/vscode-languageclient/lib/common/selectionRange.js +62 -0
- package/dist/node_modules/vscode-languageclient/lib/common/semanticTokens.js +144 -0
- package/dist/node_modules/vscode-languageclient/lib/common/signatureHelp.js +78 -0
- package/dist/node_modules/vscode-languageclient/lib/common/textSynchronization.js +422 -0
- package/dist/node_modules/vscode-languageclient/lib/common/typeDefinition.js +60 -0
- package/dist/node_modules/vscode-languageclient/lib/common/typeHierarchy.js +97 -0
- package/dist/node_modules/vscode-languageclient/lib/common/utils/async.js +269 -0
- package/dist/node_modules/vscode-languageclient/lib/common/utils/is.js +54 -0
- package/dist/node_modules/vscode-languageclient/lib/common/utils/uuid.js +51 -0
- package/dist/node_modules/vscode-languageclient/lib/common/workspaceFolder.js +154 -0
- package/dist/node_modules/vscode-languageclient/lib/common/workspaceSymbol.js +87 -0
- package/dist/node_modules/vscode-languageclient/node_modules/brace-expansion/index.js +160 -0
- package/dist/node_modules/vscode-languageclient/node_modules/minimatch/lib/path.js +2 -0
- package/dist/node_modules/vscode-languageclient/node_modules/minimatch/minimatch.js +567 -0
- package/dist/node_modules/vscode-languageserver-protocol/browser.js +4 -0
- package/dist/node_modules/vscode-languageserver-protocol/lib/browser/main.js +30 -0
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/api.js +43 -0
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/connection.js +14 -0
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/messages.js +43 -0
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.callHierarchy.js +23 -0
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.colorProvider.js +18 -0
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.configuration.js +13 -0
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.declaration.js +13 -0
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.diagnostic.js +42 -0
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.fileOperations.js +42 -0
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.foldingRange.js +13 -0
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.implementation.js +13 -0
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.inlayHint.js +23 -0
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.inlineValue.js +18 -0
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.js +494 -0
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.linkedEditingRange.js +13 -0
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.moniker.js +25 -0
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.notebook.js +185 -0
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.progress.js +28 -0
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.selectionRange.js +13 -0
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.semanticTokens.js +39 -0
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.showDocument.js +13 -0
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.typeDefinition.js +13 -0
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.typeHierarchy.js +23 -0
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.workspaceFolder.js +18 -0
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/utils/is.js +40 -0
- package/dist/node_modules/vscode-languageserver-types/lib/esm/main.js +1583 -0
- package/dist/node_modules/wrappy/wrappy.js +25 -0
- package/dist/src/createLanguageClient.js +107 -0
- package/dist/src/customRequests.js +21 -0
- package/dist/src/extensionConfiguration.js +5 -0
- package/dist/{cobol.js → src/extensions/cobol.js} +3 -2
- package/dist/{csharp.js → src/extensions/csharp.js} +3 -2
- package/dist/src/extensions/java.js +36 -0
- package/dist/{tools.js → src/extensions/tools.js} +2 -2
- package/dist/src/extensions.js +170 -0
- package/dist/src/infrastructure.js +68 -0
- package/dist/src/languageClient.js +308 -0
- package/dist/src/languageClientOptions.js +17 -0
- package/dist/src/services.js +8 -0
- package/dist/src/staticOptions.js +441 -0
- package/package.json +50 -50
- package/stats.html +90 -1429
- package/dist/index2.js +0 -17349
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { __exports as documentHighlight } from '../../../../_virtual/documentHighlight.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 features } from '../../../../_virtual/features.js';
|
|
6
|
+
import './features.js';
|
|
7
|
+
import { __exports as uuid } from '../../../../_virtual/uuid.js';
|
|
8
|
+
import './utils/uuid.js';
|
|
9
|
+
Object.defineProperty(documentHighlight, "__esModule", {
|
|
10
|
+
value: true
|
|
11
|
+
});
|
|
12
|
+
var DocumentHighlightFeature_1 = documentHighlight.DocumentHighlightFeature = void 0;
|
|
13
|
+
const vscode_1 = require$$0;
|
|
14
|
+
const vscode_languageserver_protocol_1 = main;
|
|
15
|
+
const features_1 = features;
|
|
16
|
+
const UUID = uuid;
|
|
17
|
+
class DocumentHighlightFeature extends features_1.TextDocumentLanguageFeature {
|
|
18
|
+
constructor(client) {
|
|
19
|
+
super(client, vscode_languageserver_protocol_1.DocumentHighlightRequest.type);
|
|
20
|
+
}
|
|
21
|
+
fillClientCapabilities(capabilities) {
|
|
22
|
+
(0, features_1.ensure)((0, features_1.ensure)(capabilities, 'textDocument'), 'documentHighlight').dynamicRegistration = true;
|
|
23
|
+
}
|
|
24
|
+
initialize(capabilities, documentSelector) {
|
|
25
|
+
const options = this.getRegistrationOptions(documentSelector, capabilities.documentHighlightProvider);
|
|
26
|
+
if (!options) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
this.register({
|
|
30
|
+
id: UUID.generateUuid(),
|
|
31
|
+
registerOptions: options
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
registerLanguageProvider(options) {
|
|
35
|
+
const selector = options.documentSelector;
|
|
36
|
+
const provider = {
|
|
37
|
+
provideDocumentHighlights: (document, position, token) => {
|
|
38
|
+
const client = this._client;
|
|
39
|
+
const _provideDocumentHighlights = (document, position, token) => {
|
|
40
|
+
return client.sendRequest(vscode_languageserver_protocol_1.DocumentHighlightRequest.type, client.code2ProtocolConverter.asTextDocumentPositionParams(document, position), token).then(result => {
|
|
41
|
+
if (token.isCancellationRequested) {
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
return client.protocol2CodeConverter.asDocumentHighlights(result, token);
|
|
45
|
+
}, error => {
|
|
46
|
+
return client.handleFailedRequest(vscode_languageserver_protocol_1.DocumentHighlightRequest.type, token, error, null);
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
const middleware = client.middleware;
|
|
50
|
+
return middleware.provideDocumentHighlights ? middleware.provideDocumentHighlights(document, position, token, _provideDocumentHighlights) : _provideDocumentHighlights(document, position, token);
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
return [vscode_1.languages.registerDocumentHighlightProvider(this._client.protocol2CodeConverter.asDocumentSelector(selector), provider), provider];
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
DocumentHighlightFeature_1 = documentHighlight.DocumentHighlightFeature = DocumentHighlightFeature;
|
|
57
|
+
export { DocumentHighlightFeature_1 as DocumentHighlightFeature, documentHighlight as default };
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { __exports as documentLink } from '../../../../_virtual/documentLink.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 features } from '../../../../_virtual/features.js';
|
|
6
|
+
import './features.js';
|
|
7
|
+
import { __exports as uuid } from '../../../../_virtual/uuid.js';
|
|
8
|
+
import './utils/uuid.js';
|
|
9
|
+
Object.defineProperty(documentLink, "__esModule", {
|
|
10
|
+
value: true
|
|
11
|
+
});
|
|
12
|
+
var DocumentLinkFeature_1 = documentLink.DocumentLinkFeature = void 0;
|
|
13
|
+
const vscode_1 = require$$0;
|
|
14
|
+
const vscode_languageserver_protocol_1 = main;
|
|
15
|
+
const features_1 = features;
|
|
16
|
+
const UUID = uuid;
|
|
17
|
+
class DocumentLinkFeature extends features_1.TextDocumentLanguageFeature {
|
|
18
|
+
constructor(client) {
|
|
19
|
+
super(client, vscode_languageserver_protocol_1.DocumentLinkRequest.type);
|
|
20
|
+
}
|
|
21
|
+
fillClientCapabilities(capabilities) {
|
|
22
|
+
const documentLinkCapabilities = (0, features_1.ensure)((0, features_1.ensure)(capabilities, 'textDocument'), 'documentLink');
|
|
23
|
+
documentLinkCapabilities.dynamicRegistration = true;
|
|
24
|
+
documentLinkCapabilities.tooltipSupport = true;
|
|
25
|
+
}
|
|
26
|
+
initialize(capabilities, documentSelector) {
|
|
27
|
+
const options = this.getRegistrationOptions(documentSelector, capabilities.documentLinkProvider);
|
|
28
|
+
if (!options) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
this.register({
|
|
32
|
+
id: UUID.generateUuid(),
|
|
33
|
+
registerOptions: options
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
registerLanguageProvider(options) {
|
|
37
|
+
const selector = options.documentSelector;
|
|
38
|
+
const provider = {
|
|
39
|
+
provideDocumentLinks: (document, token) => {
|
|
40
|
+
const client = this._client;
|
|
41
|
+
const provideDocumentLinks = (document, token) => {
|
|
42
|
+
return client.sendRequest(vscode_languageserver_protocol_1.DocumentLinkRequest.type, client.code2ProtocolConverter.asDocumentLinkParams(document), token).then(result => {
|
|
43
|
+
if (token.isCancellationRequested) {
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
return client.protocol2CodeConverter.asDocumentLinks(result, token);
|
|
47
|
+
}, error => {
|
|
48
|
+
return client.handleFailedRequest(vscode_languageserver_protocol_1.DocumentLinkRequest.type, token, error, null);
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
const middleware = client.middleware;
|
|
52
|
+
return middleware.provideDocumentLinks ? middleware.provideDocumentLinks(document, token, provideDocumentLinks) : provideDocumentLinks(document, token);
|
|
53
|
+
},
|
|
54
|
+
resolveDocumentLink: options.resolveProvider ? (link, token) => {
|
|
55
|
+
const client = this._client;
|
|
56
|
+
let resolveDocumentLink = (link, token) => {
|
|
57
|
+
return client.sendRequest(vscode_languageserver_protocol_1.DocumentLinkResolveRequest.type, client.code2ProtocolConverter.asDocumentLink(link), token).then(result => {
|
|
58
|
+
if (token.isCancellationRequested) {
|
|
59
|
+
return link;
|
|
60
|
+
}
|
|
61
|
+
return client.protocol2CodeConverter.asDocumentLink(result);
|
|
62
|
+
}, error => {
|
|
63
|
+
return client.handleFailedRequest(vscode_languageserver_protocol_1.DocumentLinkResolveRequest.type, token, error, link);
|
|
64
|
+
});
|
|
65
|
+
};
|
|
66
|
+
const middleware = client.middleware;
|
|
67
|
+
return middleware.resolveDocumentLink ? middleware.resolveDocumentLink(link, token, resolveDocumentLink) : resolveDocumentLink(link, token);
|
|
68
|
+
} : undefined
|
|
69
|
+
};
|
|
70
|
+
return [vscode_1.languages.registerDocumentLinkProvider(this._client.protocol2CodeConverter.asDocumentSelector(selector), provider), provider];
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
DocumentLinkFeature_1 = documentLink.DocumentLinkFeature = DocumentLinkFeature;
|
|
74
|
+
export { DocumentLinkFeature_1 as DocumentLinkFeature, documentLink as default };
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { __exports as documentSymbol } from '../../../../_virtual/documentSymbol.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 features } from '../../../../_virtual/features.js';
|
|
6
|
+
import './features.js';
|
|
7
|
+
import { __exports as uuid } from '../../../../_virtual/uuid.js';
|
|
8
|
+
import './utils/uuid.js';
|
|
9
|
+
(function (exports) {
|
|
10
|
+
Object.defineProperty(exports, "__esModule", {
|
|
11
|
+
value: true
|
|
12
|
+
});
|
|
13
|
+
exports.DocumentSymbolFeature = exports.SupportedSymbolTags = exports.SupportedSymbolKinds = void 0;
|
|
14
|
+
const vscode_1 = require$$0;
|
|
15
|
+
const vscode_languageserver_protocol_1 = main;
|
|
16
|
+
const features_1 = features;
|
|
17
|
+
const UUID = uuid;
|
|
18
|
+
exports.SupportedSymbolKinds = [vscode_languageserver_protocol_1.SymbolKind.File, vscode_languageserver_protocol_1.SymbolKind.Module, vscode_languageserver_protocol_1.SymbolKind.Namespace, vscode_languageserver_protocol_1.SymbolKind.Package, vscode_languageserver_protocol_1.SymbolKind.Class, vscode_languageserver_protocol_1.SymbolKind.Method, vscode_languageserver_protocol_1.SymbolKind.Property, vscode_languageserver_protocol_1.SymbolKind.Field, vscode_languageserver_protocol_1.SymbolKind.Constructor, vscode_languageserver_protocol_1.SymbolKind.Enum, vscode_languageserver_protocol_1.SymbolKind.Interface, vscode_languageserver_protocol_1.SymbolKind.Function, vscode_languageserver_protocol_1.SymbolKind.Variable, vscode_languageserver_protocol_1.SymbolKind.Constant, vscode_languageserver_protocol_1.SymbolKind.String, vscode_languageserver_protocol_1.SymbolKind.Number, vscode_languageserver_protocol_1.SymbolKind.Boolean, vscode_languageserver_protocol_1.SymbolKind.Array, vscode_languageserver_protocol_1.SymbolKind.Object, vscode_languageserver_protocol_1.SymbolKind.Key, vscode_languageserver_protocol_1.SymbolKind.Null, vscode_languageserver_protocol_1.SymbolKind.EnumMember, vscode_languageserver_protocol_1.SymbolKind.Struct, vscode_languageserver_protocol_1.SymbolKind.Event, vscode_languageserver_protocol_1.SymbolKind.Operator, vscode_languageserver_protocol_1.SymbolKind.TypeParameter];
|
|
19
|
+
exports.SupportedSymbolTags = [vscode_languageserver_protocol_1.SymbolTag.Deprecated];
|
|
20
|
+
class DocumentSymbolFeature extends features_1.TextDocumentLanguageFeature {
|
|
21
|
+
constructor(client) {
|
|
22
|
+
super(client, vscode_languageserver_protocol_1.DocumentSymbolRequest.type);
|
|
23
|
+
}
|
|
24
|
+
fillClientCapabilities(capabilities) {
|
|
25
|
+
let symbolCapabilities = (0, features_1.ensure)((0, features_1.ensure)(capabilities, 'textDocument'), 'documentSymbol');
|
|
26
|
+
symbolCapabilities.dynamicRegistration = true;
|
|
27
|
+
symbolCapabilities.symbolKind = {
|
|
28
|
+
valueSet: exports.SupportedSymbolKinds
|
|
29
|
+
};
|
|
30
|
+
symbolCapabilities.hierarchicalDocumentSymbolSupport = true;
|
|
31
|
+
symbolCapabilities.tagSupport = {
|
|
32
|
+
valueSet: exports.SupportedSymbolTags
|
|
33
|
+
};
|
|
34
|
+
symbolCapabilities.labelSupport = true;
|
|
35
|
+
}
|
|
36
|
+
initialize(capabilities, documentSelector) {
|
|
37
|
+
const options = this.getRegistrationOptions(documentSelector, capabilities.documentSymbolProvider);
|
|
38
|
+
if (!options) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
this.register({
|
|
42
|
+
id: UUID.generateUuid(),
|
|
43
|
+
registerOptions: options
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
registerLanguageProvider(options) {
|
|
47
|
+
const selector = options.documentSelector;
|
|
48
|
+
const provider = {
|
|
49
|
+
provideDocumentSymbols: (document, token) => {
|
|
50
|
+
const client = this._client;
|
|
51
|
+
const _provideDocumentSymbols = async (document, token) => {
|
|
52
|
+
try {
|
|
53
|
+
const data = await client.sendRequest(vscode_languageserver_protocol_1.DocumentSymbolRequest.type, client.code2ProtocolConverter.asDocumentSymbolParams(document), token);
|
|
54
|
+
if (token.isCancellationRequested || data === undefined || data === null) {
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
if (data.length === 0) {
|
|
58
|
+
return [];
|
|
59
|
+
} else {
|
|
60
|
+
const first = data[0];
|
|
61
|
+
if (vscode_languageserver_protocol_1.DocumentSymbol.is(first)) {
|
|
62
|
+
return await client.protocol2CodeConverter.asDocumentSymbols(data, token);
|
|
63
|
+
} else {
|
|
64
|
+
return await client.protocol2CodeConverter.asSymbolInformations(data, token);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
} catch (error) {
|
|
68
|
+
return client.handleFailedRequest(vscode_languageserver_protocol_1.DocumentSymbolRequest.type, token, error, null);
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
const middleware = client.middleware;
|
|
72
|
+
return middleware.provideDocumentSymbols ? middleware.provideDocumentSymbols(document, token, _provideDocumentSymbols) : _provideDocumentSymbols(document, token);
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
const metaData = options.label !== undefined ? {
|
|
76
|
+
label: options.label
|
|
77
|
+
} : undefined;
|
|
78
|
+
return [vscode_1.languages.registerDocumentSymbolProvider(this._client.protocol2CodeConverter.asDocumentSelector(selector), provider, metaData), provider];
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
exports.DocumentSymbolFeature = DocumentSymbolFeature;
|
|
82
|
+
})(documentSymbol);
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { __exports as executeCommand } from '../../../../_virtual/executeCommand.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 uuid } from '../../../../_virtual/uuid.js';
|
|
6
|
+
import './utils/uuid.js';
|
|
7
|
+
import { __exports as features } from '../../../../_virtual/features.js';
|
|
8
|
+
import './features.js';
|
|
9
|
+
Object.defineProperty(executeCommand, "__esModule", {
|
|
10
|
+
value: true
|
|
11
|
+
});
|
|
12
|
+
var ExecuteCommandFeature_1 = executeCommand.ExecuteCommandFeature = void 0;
|
|
13
|
+
const vscode_1 = require$$0;
|
|
14
|
+
const vscode_languageserver_protocol_1 = main;
|
|
15
|
+
const UUID = uuid;
|
|
16
|
+
const features_1 = features;
|
|
17
|
+
class ExecuteCommandFeature {
|
|
18
|
+
constructor(client) {
|
|
19
|
+
this._client = client;
|
|
20
|
+
this._commands = new Map();
|
|
21
|
+
}
|
|
22
|
+
getState() {
|
|
23
|
+
return {
|
|
24
|
+
kind: 'workspace',
|
|
25
|
+
id: this.registrationType.method,
|
|
26
|
+
registrations: this._commands.size > 0
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
get registrationType() {
|
|
30
|
+
return vscode_languageserver_protocol_1.ExecuteCommandRequest.type;
|
|
31
|
+
}
|
|
32
|
+
fillClientCapabilities(capabilities) {
|
|
33
|
+
(0, features_1.ensure)((0, features_1.ensure)(capabilities, 'workspace'), 'executeCommand').dynamicRegistration = true;
|
|
34
|
+
}
|
|
35
|
+
initialize(capabilities) {
|
|
36
|
+
if (!capabilities.executeCommandProvider) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
this.register({
|
|
40
|
+
id: UUID.generateUuid(),
|
|
41
|
+
registerOptions: Object.assign({}, capabilities.executeCommandProvider)
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
register(data) {
|
|
45
|
+
const client = this._client;
|
|
46
|
+
const middleware = client.middleware;
|
|
47
|
+
const executeCommand = (command, args) => {
|
|
48
|
+
let params = {
|
|
49
|
+
command,
|
|
50
|
+
arguments: args
|
|
51
|
+
};
|
|
52
|
+
return client.sendRequest(vscode_languageserver_protocol_1.ExecuteCommandRequest.type, params).then(undefined, error => {
|
|
53
|
+
return client.handleFailedRequest(vscode_languageserver_protocol_1.ExecuteCommandRequest.type, undefined, error, undefined);
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
if (data.registerOptions.commands) {
|
|
57
|
+
const disposables = [];
|
|
58
|
+
for (const command of data.registerOptions.commands) {
|
|
59
|
+
disposables.push(vscode_1.commands.registerCommand(command, function () {
|
|
60
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
61
|
+
args[_key] = arguments[_key];
|
|
62
|
+
}
|
|
63
|
+
return middleware.executeCommand ? middleware.executeCommand(command, args, executeCommand) : executeCommand(command, args);
|
|
64
|
+
}));
|
|
65
|
+
}
|
|
66
|
+
this._commands.set(data.id, disposables);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
unregister(id) {
|
|
70
|
+
let disposables = this._commands.get(id);
|
|
71
|
+
if (disposables) {
|
|
72
|
+
disposables.forEach(disposable => disposable.dispose());
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
dispose() {
|
|
76
|
+
this._commands.forEach(value => {
|
|
77
|
+
value.forEach(disposable => disposable.dispose());
|
|
78
|
+
});
|
|
79
|
+
this._commands.clear();
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
ExecuteCommandFeature_1 = executeCommand.ExecuteCommandFeature = ExecuteCommandFeature;
|
|
83
|
+
export { ExecuteCommandFeature_1 as ExecuteCommandFeature, executeCommand as default };
|
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
import { __exports as features } from '../../../../_virtual/features.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 is } from '../../../../_virtual/is.js';
|
|
6
|
+
import './utils/is.js';
|
|
7
|
+
import { __exports as uuid } from '../../../../_virtual/uuid.js';
|
|
8
|
+
import './utils/uuid.js';
|
|
9
|
+
(function (exports) {
|
|
10
|
+
Object.defineProperty(exports, "__esModule", {
|
|
11
|
+
value: true
|
|
12
|
+
});
|
|
13
|
+
exports.WorkspaceFeature = exports.TextDocumentLanguageFeature = exports.TextDocumentEventFeature = exports.DynamicDocumentFeature = exports.DynamicFeature = exports.StaticFeature = exports.ensure = exports.LSPCancellationError = void 0;
|
|
14
|
+
const vscode_1 = require$$0;
|
|
15
|
+
const vscode_languageserver_protocol_1 = main;
|
|
16
|
+
const Is = is;
|
|
17
|
+
const UUID = uuid;
|
|
18
|
+
class LSPCancellationError extends vscode_1.CancellationError {
|
|
19
|
+
constructor(data) {
|
|
20
|
+
super();
|
|
21
|
+
this.data = data;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.LSPCancellationError = LSPCancellationError;
|
|
25
|
+
function ensure(target, key) {
|
|
26
|
+
if (target[key] === undefined) {
|
|
27
|
+
target[key] = {};
|
|
28
|
+
}
|
|
29
|
+
return target[key];
|
|
30
|
+
}
|
|
31
|
+
exports.ensure = ensure;
|
|
32
|
+
(function (StaticFeature) {
|
|
33
|
+
function is(value) {
|
|
34
|
+
const candidate = value;
|
|
35
|
+
return candidate !== undefined && candidate !== null && Is.func(candidate.fillClientCapabilities) && Is.func(candidate.initialize) && Is.func(candidate.getState) && Is.func(candidate.dispose) && (candidate.fillInitializeParams === undefined || Is.func(candidate.fillInitializeParams));
|
|
36
|
+
}
|
|
37
|
+
StaticFeature.is = is;
|
|
38
|
+
})(exports.StaticFeature || (exports.StaticFeature = {}));
|
|
39
|
+
(function (DynamicFeature) {
|
|
40
|
+
function is(value) {
|
|
41
|
+
const candidate = value;
|
|
42
|
+
return candidate !== undefined && candidate !== null && Is.func(candidate.fillClientCapabilities) && Is.func(candidate.initialize) && Is.func(candidate.getState) && Is.func(candidate.dispose) && (candidate.fillInitializeParams === undefined || Is.func(candidate.fillInitializeParams)) && Is.func(candidate.register) && Is.func(candidate.unregister) && candidate.registrationType !== undefined;
|
|
43
|
+
}
|
|
44
|
+
DynamicFeature.is = is;
|
|
45
|
+
})(exports.DynamicFeature || (exports.DynamicFeature = {}));
|
|
46
|
+
class DynamicDocumentFeature {
|
|
47
|
+
constructor(client) {
|
|
48
|
+
this._client = client;
|
|
49
|
+
}
|
|
50
|
+
getState() {
|
|
51
|
+
const selectors = this.getDocumentSelectors();
|
|
52
|
+
let count = 0;
|
|
53
|
+
for (const selector of selectors) {
|
|
54
|
+
count++;
|
|
55
|
+
for (const document of vscode_1.workspace.textDocuments) {
|
|
56
|
+
if (vscode_1.languages.match(selector, document) > 0) {
|
|
57
|
+
return {
|
|
58
|
+
kind: 'document',
|
|
59
|
+
id: this.registrationType.method,
|
|
60
|
+
registrations: true,
|
|
61
|
+
matches: true
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
const registrations = count > 0;
|
|
67
|
+
return {
|
|
68
|
+
kind: 'document',
|
|
69
|
+
id: this.registrationType.method,
|
|
70
|
+
registrations,
|
|
71
|
+
matches: false
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
exports.DynamicDocumentFeature = DynamicDocumentFeature;
|
|
76
|
+
class TextDocumentEventFeature extends DynamicDocumentFeature {
|
|
77
|
+
constructor(client, event, type, middleware, createParams, textDocument, selectorFilter) {
|
|
78
|
+
super(client);
|
|
79
|
+
this._event = event;
|
|
80
|
+
this._type = type;
|
|
81
|
+
this._middleware = middleware;
|
|
82
|
+
this._createParams = createParams;
|
|
83
|
+
this._textDocument = textDocument;
|
|
84
|
+
this._selectorFilter = selectorFilter;
|
|
85
|
+
this._selectors = new Map();
|
|
86
|
+
this._onNotificationSent = new vscode_1.EventEmitter();
|
|
87
|
+
}
|
|
88
|
+
static textDocumentFilter(selectors, textDocument) {
|
|
89
|
+
for (const selector of selectors) {
|
|
90
|
+
if (vscode_1.languages.match(selector, textDocument) > 0) {
|
|
91
|
+
return true;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return false;
|
|
95
|
+
}
|
|
96
|
+
getStateInfo() {
|
|
97
|
+
return [this._selectors.values(), false];
|
|
98
|
+
}
|
|
99
|
+
getDocumentSelectors() {
|
|
100
|
+
return this._selectors.values();
|
|
101
|
+
}
|
|
102
|
+
register(data) {
|
|
103
|
+
if (!data.registerOptions.documentSelector) {
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
if (!this._listener) {
|
|
107
|
+
this._listener = this._event(data => {
|
|
108
|
+
this.callback(data).catch(error => {
|
|
109
|
+
this._client.error("Sending document notification ".concat(this._type.method, " failed."), error);
|
|
110
|
+
});
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
this._selectors.set(data.id, this._client.protocol2CodeConverter.asDocumentSelector(data.registerOptions.documentSelector));
|
|
114
|
+
}
|
|
115
|
+
async callback(data) {
|
|
116
|
+
const doSend = async data => {
|
|
117
|
+
const params = this._createParams(data);
|
|
118
|
+
await this._client.sendNotification(this._type, params);
|
|
119
|
+
this.notificationSent(this.getTextDocument(data), this._type, params);
|
|
120
|
+
};
|
|
121
|
+
if (this.matches(data)) {
|
|
122
|
+
const middleware = this._middleware();
|
|
123
|
+
return middleware ? middleware(data, data => doSend(data)) : doSend(data);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
matches(data) {
|
|
127
|
+
if (this._client.hasDedicatedTextSynchronizationFeature(this._textDocument(data))) {
|
|
128
|
+
return false;
|
|
129
|
+
}
|
|
130
|
+
return !this._selectorFilter || this._selectorFilter(this._selectors.values(), data);
|
|
131
|
+
}
|
|
132
|
+
get onNotificationSent() {
|
|
133
|
+
return this._onNotificationSent.event;
|
|
134
|
+
}
|
|
135
|
+
notificationSent(textDocument, type, params) {
|
|
136
|
+
this._onNotificationSent.fire({
|
|
137
|
+
textDocument,
|
|
138
|
+
type,
|
|
139
|
+
params
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
unregister(id) {
|
|
143
|
+
this._selectors.delete(id);
|
|
144
|
+
if (this._selectors.size === 0 && this._listener) {
|
|
145
|
+
this._listener.dispose();
|
|
146
|
+
this._listener = undefined;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
dispose() {
|
|
150
|
+
this._selectors.clear();
|
|
151
|
+
this._onNotificationSent.dispose();
|
|
152
|
+
if (this._listener) {
|
|
153
|
+
this._listener.dispose();
|
|
154
|
+
this._listener = undefined;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
getProvider(document) {
|
|
158
|
+
for (const selector of this._selectors.values()) {
|
|
159
|
+
if (vscode_1.languages.match(selector, document) > 0) {
|
|
160
|
+
return {
|
|
161
|
+
send: data => {
|
|
162
|
+
return this.callback(data);
|
|
163
|
+
}
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
return undefined;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
exports.TextDocumentEventFeature = TextDocumentEventFeature;
|
|
171
|
+
class TextDocumentLanguageFeature extends DynamicDocumentFeature {
|
|
172
|
+
constructor(client, registrationType) {
|
|
173
|
+
super(client);
|
|
174
|
+
this._registrationType = registrationType;
|
|
175
|
+
this._registrations = new Map();
|
|
176
|
+
}
|
|
177
|
+
*getDocumentSelectors() {
|
|
178
|
+
for (const registration of this._registrations.values()) {
|
|
179
|
+
const selector = registration.data.registerOptions.documentSelector;
|
|
180
|
+
if (selector === null) {
|
|
181
|
+
continue;
|
|
182
|
+
}
|
|
183
|
+
yield this._client.protocol2CodeConverter.asDocumentSelector(selector);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
get registrationType() {
|
|
187
|
+
return this._registrationType;
|
|
188
|
+
}
|
|
189
|
+
register(data) {
|
|
190
|
+
if (!data.registerOptions.documentSelector) {
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
let registration = this.registerLanguageProvider(data.registerOptions, data.id);
|
|
194
|
+
this._registrations.set(data.id, {
|
|
195
|
+
disposable: registration[0],
|
|
196
|
+
data,
|
|
197
|
+
provider: registration[1]
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
unregister(id) {
|
|
201
|
+
let registration = this._registrations.get(id);
|
|
202
|
+
if (registration !== undefined) {
|
|
203
|
+
registration.disposable.dispose();
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
dispose() {
|
|
207
|
+
this._registrations.forEach(value => {
|
|
208
|
+
value.disposable.dispose();
|
|
209
|
+
});
|
|
210
|
+
this._registrations.clear();
|
|
211
|
+
}
|
|
212
|
+
getRegistration(documentSelector, capability) {
|
|
213
|
+
if (!capability) {
|
|
214
|
+
return [undefined, undefined];
|
|
215
|
+
} else if (vscode_languageserver_protocol_1.TextDocumentRegistrationOptions.is(capability)) {
|
|
216
|
+
var _capability$documentS;
|
|
217
|
+
const id = vscode_languageserver_protocol_1.StaticRegistrationOptions.hasId(capability) ? capability.id : UUID.generateUuid();
|
|
218
|
+
const selector = (_capability$documentS = capability.documentSelector) !== null && _capability$documentS !== void 0 ? _capability$documentS : documentSelector;
|
|
219
|
+
if (selector) {
|
|
220
|
+
return [id, Object.assign({}, capability, {
|
|
221
|
+
documentSelector: selector
|
|
222
|
+
})];
|
|
223
|
+
}
|
|
224
|
+
} else if (Is.boolean(capability) && capability === true || vscode_languageserver_protocol_1.WorkDoneProgressOptions.is(capability)) {
|
|
225
|
+
if (!documentSelector) {
|
|
226
|
+
return [undefined, undefined];
|
|
227
|
+
}
|
|
228
|
+
const options = Is.boolean(capability) && capability === true ? {
|
|
229
|
+
documentSelector
|
|
230
|
+
} : Object.assign({}, capability, {
|
|
231
|
+
documentSelector
|
|
232
|
+
});
|
|
233
|
+
return [UUID.generateUuid(), options];
|
|
234
|
+
}
|
|
235
|
+
return [undefined, undefined];
|
|
236
|
+
}
|
|
237
|
+
getRegistrationOptions(documentSelector, capability) {
|
|
238
|
+
if (!documentSelector || !capability) {
|
|
239
|
+
return undefined;
|
|
240
|
+
}
|
|
241
|
+
return Is.boolean(capability) && capability === true ? {
|
|
242
|
+
documentSelector
|
|
243
|
+
} : Object.assign({}, capability, {
|
|
244
|
+
documentSelector
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
getProvider(textDocument) {
|
|
248
|
+
for (const registration of this._registrations.values()) {
|
|
249
|
+
let selector = registration.data.registerOptions.documentSelector;
|
|
250
|
+
if (selector !== null && vscode_1.languages.match(this._client.protocol2CodeConverter.asDocumentSelector(selector), textDocument) > 0) {
|
|
251
|
+
return registration.provider;
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
return undefined;
|
|
255
|
+
}
|
|
256
|
+
getAllProviders() {
|
|
257
|
+
const result = [];
|
|
258
|
+
for (const item of this._registrations.values()) {
|
|
259
|
+
result.push(item.provider);
|
|
260
|
+
}
|
|
261
|
+
return result;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
exports.TextDocumentLanguageFeature = TextDocumentLanguageFeature;
|
|
265
|
+
class WorkspaceFeature {
|
|
266
|
+
constructor(client, registrationType) {
|
|
267
|
+
this._client = client;
|
|
268
|
+
this._registrationType = registrationType;
|
|
269
|
+
this._registrations = new Map();
|
|
270
|
+
}
|
|
271
|
+
getState() {
|
|
272
|
+
const registrations = this._registrations.size > 0;
|
|
273
|
+
return {
|
|
274
|
+
kind: 'workspace',
|
|
275
|
+
id: this._registrationType.method,
|
|
276
|
+
registrations
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
get registrationType() {
|
|
280
|
+
return this._registrationType;
|
|
281
|
+
}
|
|
282
|
+
register(data) {
|
|
283
|
+
const registration = this.registerLanguageProvider(data.registerOptions);
|
|
284
|
+
this._registrations.set(data.id, {
|
|
285
|
+
disposable: registration[0],
|
|
286
|
+
provider: registration[1]
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
unregister(id) {
|
|
290
|
+
let registration = this._registrations.get(id);
|
|
291
|
+
if (registration !== undefined) {
|
|
292
|
+
registration.disposable.dispose();
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
dispose() {
|
|
296
|
+
this._registrations.forEach(registration => {
|
|
297
|
+
registration.disposable.dispose();
|
|
298
|
+
});
|
|
299
|
+
this._registrations.clear();
|
|
300
|
+
}
|
|
301
|
+
getProviders() {
|
|
302
|
+
const result = [];
|
|
303
|
+
for (const registration of this._registrations.values()) {
|
|
304
|
+
result.push(registration.provider);
|
|
305
|
+
}
|
|
306
|
+
return result;
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
exports.WorkspaceFeature = WorkspaceFeature;
|
|
310
|
+
})(features);
|