@difizen/libro-language-client 0.1.18
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/LICENSE +21 -0
- package/README.md +0 -0
- package/es/common/api.d.ts +38 -0
- package/es/common/api.d.ts.map +1 -0
- package/es/common/api.js +9 -0
- package/es/common/callHierarchy.d.ts +39 -0
- package/es/common/callHierarchy.d.ts.map +1 -0
- package/es/common/callHierarchy.js +139 -0
- package/es/common/client.d.ts +482 -0
- package/es/common/client.d.ts.map +1 -0
- package/es/common/client.js +2731 -0
- package/es/common/codeAction.d.ts +22 -0
- package/es/common/codeAction.d.ts.map +1 -0
- package/es/common/codeAction.js +149 -0
- package/es/common/codeConverter.d.ts +81 -0
- package/es/common/codeConverter.d.ts.map +1 -0
- package/es/common/codeConverter.js +1040 -0
- package/es/common/codeLens.d.ts +26 -0
- package/es/common/codeLens.d.ts.map +1 -0
- package/es/common/codeLens.js +125 -0
- package/es/common/colorProvider.d.ts +27 -0
- package/es/common/colorProvider.d.ts.map +1 -0
- package/es/common/colorProvider.js +104 -0
- package/es/common/completion.d.ts +22 -0
- package/es/common/completion.d.ts.map +1 -0
- package/es/common/completion.js +130 -0
- package/es/common/configuration.d.ts +71 -0
- package/es/common/configuration.d.ts.map +1 -0
- package/es/common/configuration.js +292 -0
- package/es/common/declaration.d.ts +18 -0
- package/es/common/declaration.d.ts.map +1 -0
- package/es/common/declaration.js +88 -0
- package/es/common/definition.d.ts +18 -0
- package/es/common/definition.d.ts.map +1 -0
- package/es/common/definition.js +80 -0
- package/es/common/diagnostic.d.ts +125 -0
- package/es/common/diagnostic.d.ts.map +1 -0
- package/es/common/diagnostic.js +1442 -0
- package/es/common/documentHighlight.d.ts +17 -0
- package/es/common/documentHighlight.d.ts.map +1 -0
- package/es/common/documentHighlight.js +73 -0
- package/es/common/documentLink.d.ts +21 -0
- package/es/common/documentLink.d.ts.map +1 -0
- package/es/common/documentLink.js +90 -0
- package/es/common/documentSymbol.d.ts +20 -0
- package/es/common/documentSymbol.d.ts.map +1 -0
- package/es/common/documentSymbol.js +134 -0
- package/es/common/executeCommand.d.ts +22 -0
- package/es/common/executeCommand.d.ts.map +1 -0
- package/es/common/executeCommand.js +117 -0
- package/es/common/features.d.ts +421 -0
- package/es/common/features.d.ts.map +1 -0
- package/es/common/features.js +576 -0
- package/es/common/fileOperations.d.ts +118 -0
- package/es/common/fileOperations.d.ts.map +1 -0
- package/es/common/fileOperations.js +705 -0
- package/es/common/fileSystemWatcher.d.ts +19 -0
- package/es/common/fileSystemWatcher.d.ts.map +1 -0
- package/es/common/fileSystemWatcher.js +173 -0
- package/es/common/foldingRange.d.ts +22 -0
- package/es/common/foldingRange.d.ts.map +1 -0
- package/es/common/foldingRange.js +127 -0
- package/es/common/formatting.d.ts +41 -0
- package/es/common/formatting.d.ts.map +1 -0
- package/es/common/formatting.js +233 -0
- package/es/common/hover.d.ts +18 -0
- package/es/common/hover.d.ts.map +1 -0
- package/es/common/hover.js +80 -0
- package/es/common/implementation.d.ts +18 -0
- package/es/common/implementation.d.ts.map +1 -0
- package/es/common/implementation.js +88 -0
- package/es/common/inlayHint.d.ts +23 -0
- package/es/common/inlayHint.d.ts.map +1 -0
- package/es/common/inlayHint.js +187 -0
- package/es/common/inlineCompletion.d.ts +20 -0
- package/es/common/inlineCompletion.d.ts.map +1 -0
- package/es/common/inlineCompletion.js +74 -0
- package/es/common/inlineValue.d.ts +21 -0
- package/es/common/inlineValue.d.ts.map +1 -0
- package/es/common/inlineValue.js +124 -0
- package/es/common/linkedEditingRange.d.ts +23 -0
- package/es/common/linkedEditingRange.d.ts.map +1 -0
- package/es/common/linkedEditingRange.js +94 -0
- package/es/common/notebook.d.ts +97 -0
- package/es/common/notebook.d.ts.map +1 -0
- package/es/common/notebook.js +1444 -0
- package/es/common/progress.d.ts +12 -0
- package/es/common/progress.d.ts.map +1 -0
- package/es/common/progress.js +75 -0
- package/es/common/progressPart.d.ts +25 -0
- package/es/common/progressPart.d.ts.map +1 -0
- package/es/common/progressPart.js +147 -0
- package/es/common/protocolCallHierarchyItem.d.ts +9 -0
- package/es/common/protocolCallHierarchyItem.d.ts.map +1 -0
- package/es/common/protocolCallHierarchyItem.js +34 -0
- package/es/common/protocolCodeAction.d.ts +7 -0
- package/es/common/protocolCodeAction.d.ts.map +1 -0
- package/es/common/protocolCodeAction.js +32 -0
- package/es/common/protocolCodeLens.d.ts +7 -0
- package/es/common/protocolCodeLens.d.ts.map +1 -0
- package/es/common/protocolCodeLens.js +29 -0
- package/es/common/protocolCompletionItem.d.ts +13 -0
- package/es/common/protocolCompletionItem.d.ts.map +1 -0
- package/es/common/protocolCompletionItem.js +29 -0
- package/es/common/protocolConverter.d.ts +174 -0
- package/es/common/protocolConverter.d.ts.map +1 -0
- package/es/common/protocolConverter.js +1982 -0
- package/es/common/protocolDiagnostic.d.ts +20 -0
- package/es/common/protocolDiagnostic.d.ts.map +1 -0
- package/es/common/protocolDiagnostic.js +46 -0
- package/es/common/protocolDocumentLink.d.ts +8 -0
- package/es/common/protocolDocumentLink.d.ts.map +1 -0
- package/es/common/protocolDocumentLink.js +29 -0
- package/es/common/protocolInlayHint.d.ts +8 -0
- package/es/common/protocolInlayHint.d.ts.map +1 -0
- package/es/common/protocolInlayHint.js +29 -0
- package/es/common/protocolTypeHierarchyItem.d.ts +9 -0
- package/es/common/protocolTypeHierarchyItem.d.ts.map +1 -0
- package/es/common/protocolTypeHierarchyItem.js +34 -0
- package/es/common/protocolWorkspaceSymbol.d.ts +9 -0
- package/es/common/protocolWorkspaceSymbol.d.ts.map +1 -0
- package/es/common/protocolWorkspaceSymbol.js +36 -0
- package/es/common/reference.d.ts +22 -0
- package/es/common/reference.d.ts.map +1 -0
- package/es/common/reference.js +78 -0
- package/es/common/rename.d.ts +29 -0
- package/es/common/rename.d.ts.map +1 -0
- package/es/common/rename.js +132 -0
- package/es/common/selectionRange.d.ts +18 -0
- package/es/common/selectionRange.d.ts.map +1 -0
- package/es/common/selectionRange.js +108 -0
- package/es/common/semanticTokens.d.ts +36 -0
- package/es/common/semanticTokens.d.ts.map +1 -0
- package/es/common/semanticTokens.js +226 -0
- package/es/common/signatureHelp.d.ts +18 -0
- package/es/common/signatureHelp.d.ts.map +1 -0
- package/es/common/signatureHelp.js +103 -0
- package/es/common/textSynchronization.d.ts +104 -0
- package/es/common/textSynchronization.d.ts.map +1 -0
- package/es/common/textSynchronization.js +771 -0
- package/es/common/typeDefinition.d.ts +18 -0
- package/es/common/typeDefinition.d.ts.map +1 -0
- package/es/common/typeDefinition.js +89 -0
- package/es/common/typeHierarchy.d.ts +33 -0
- package/es/common/typeHierarchy.d.ts.map +1 -0
- package/es/common/typeHierarchy.js +138 -0
- package/es/common/utils/async.d.ts +42 -0
- package/es/common/utils/async.d.ts.map +1 -0
- package/es/common/utils/async.js +441 -0
- package/es/common/utils/is.d.ts +13 -0
- package/es/common/utils/is.d.ts.map +1 -0
- package/es/common/utils/is.js +52 -0
- package/es/common/utils/uuid.d.ts +23 -0
- package/es/common/utils/uuid.d.ts.map +1 -0
- package/es/common/utils/uuid.js +85 -0
- package/es/common/vscodeAdaptor/convertor.d.ts +7 -0
- package/es/common/vscodeAdaptor/convertor.d.ts.map +1 -0
- package/es/common/vscodeAdaptor/convertor.js +66 -0
- package/es/common/vscodeAdaptor/diagnosticCollection.d.ts +33 -0
- package/es/common/vscodeAdaptor/diagnosticCollection.d.ts.map +1 -0
- package/es/common/vscodeAdaptor/diagnosticCollection.js +310 -0
- package/es/common/vscodeAdaptor/extHostTypes.d.ts +1496 -0
- package/es/common/vscodeAdaptor/extHostTypes.d.ts.map +1 -0
- package/es/common/vscodeAdaptor/extHostTypes.js +3825 -0
- package/es/common/vscodeAdaptor/fileWatcher.d.ts +19 -0
- package/es/common/vscodeAdaptor/fileWatcher.d.ts.map +1 -0
- package/es/common/vscodeAdaptor/fileWatcher.js +45 -0
- package/es/common/vscodeAdaptor/hostTypeUtil.d.ts +192 -0
- package/es/common/vscodeAdaptor/hostTypeUtil.d.ts.map +1 -0
- package/es/common/vscodeAdaptor/hostTypeUtil.js +566 -0
- package/es/common/vscodeAdaptor/libro-fs.d.ts +21 -0
- package/es/common/vscodeAdaptor/libro-fs.d.ts.map +1 -0
- package/es/common/vscodeAdaptor/libro-fs.js +64 -0
- package/es/common/vscodeAdaptor/libroWindow.d.ts +21 -0
- package/es/common/vscodeAdaptor/libroWindow.d.ts.map +1 -0
- package/es/common/vscodeAdaptor/libroWindow.js +75 -0
- package/es/common/vscodeAdaptor/libroWorkspace.d.ts +33 -0
- package/es/common/vscodeAdaptor/libroWorkspace.d.ts.map +1 -0
- package/es/common/vscodeAdaptor/libroWorkspace.js +250 -0
- package/es/common/vscodeAdaptor/lspEnv.d.ts +8 -0
- package/es/common/vscodeAdaptor/lspEnv.d.ts.map +1 -0
- package/es/common/vscodeAdaptor/lspEnv.js +31 -0
- package/es/common/vscodeAdaptor/monaco-converter.d.ts +229 -0
- package/es/common/vscodeAdaptor/monaco-converter.d.ts.map +1 -0
- package/es/common/vscodeAdaptor/monaco-converter.js +1613 -0
- package/es/common/vscodeAdaptor/monacoLanguages.d.ts +48 -0
- package/es/common/vscodeAdaptor/monacoLanguages.d.ts.map +1 -0
- package/es/common/vscodeAdaptor/monacoLanguages.js +484 -0
- package/es/common/vscodeAdaptor/services.d.ts +85 -0
- package/es/common/vscodeAdaptor/services.d.ts.map +1 -0
- package/es/common/vscodeAdaptor/services.js +3 -0
- package/es/common/vscodeAdaptor/typings.d.ts +10 -0
- package/es/common/vscodeAdaptor/util.d.ts +3 -0
- package/es/common/vscodeAdaptor/util.d.ts.map +1 -0
- package/es/common/vscodeAdaptor/util.js +6 -0
- package/es/common/vscodeAdaptor/vscodeAdaptor.d.ts +77 -0
- package/es/common/vscodeAdaptor/vscodeAdaptor.d.ts.map +1 -0
- package/es/common/vscodeAdaptor/vscodeAdaptor.js +124 -0
- package/es/common/workspaceFolder.d.ts +32 -0
- package/es/common/workspaceFolder.d.ts.map +1 -0
- package/es/common/workspaceFolder.js +204 -0
- package/es/common/workspaceSymbol.d.ts +21 -0
- package/es/common/workspaceSymbol.d.ts.map +1 -0
- package/es/common/workspaceSymbol.js +101 -0
- package/es/constants.d.ts +2 -0
- package/es/constants.d.ts.map +1 -0
- package/es/constants.js +1 -0
- package/es/index.d.ts +6 -0
- package/es/index.d.ts.map +1 -0
- package/es/index.js +5 -0
- package/es/libro-language-client-contribution.d.ts +10 -0
- package/es/libro-language-client-contribution.d.ts.map +1 -0
- package/es/libro-language-client-contribution.js +143 -0
- package/es/libro-language-client-manager.d.ts +34 -0
- package/es/libro-language-client-manager.d.ts.map +1 -0
- package/es/libro-language-client-manager.js +277 -0
- package/es/libro-language-client.d.ts +27 -0
- package/es/libro-language-client.d.ts.map +1 -0
- package/es/libro-language-client.js +141 -0
- package/es/module.d.ts +3 -0
- package/es/module.d.ts.map +1 -0
- package/es/module.js +13 -0
- package/package.json +69 -0
- package/src/common/api.ts +155 -0
- package/src/common/callHierarchy.ts +269 -0
- package/src/common/client.ts +3192 -0
- package/src/common/codeAction.ts +237 -0
- package/src/common/codeConverter.ts +1409 -0
- package/src/common/codeLens.ts +188 -0
- package/src/common/colorProvider.ts +192 -0
- package/src/common/completion.ts +281 -0
- package/src/common/configuration.ts +338 -0
- package/src/common/declaration.ts +140 -0
- package/src/common/definition.ts +138 -0
- package/src/common/diagnostic.ts +1408 -0
- package/src/common/documentHighlight.ts +140 -0
- package/src/common/documentLink.ts +180 -0
- package/src/common/documentSymbol.ts +186 -0
- package/src/common/executeCommand.ts +129 -0
- package/src/common/features.ts +1157 -0
- package/src/common/fileOperations.ts +635 -0
- package/src/common/fileSystemWatcher.ts +184 -0
- package/src/common/foldingRange.ts +160 -0
- package/src/common/formatting.ts +465 -0
- package/src/common/hover.ts +133 -0
- package/src/common/implementation.ts +142 -0
- package/src/common/inlayHint.ts +201 -0
- package/src/common/inlineCompletion.ts +160 -0
- package/src/common/inlineValue.ts +158 -0
- package/src/common/linkedEditingRange.ts +141 -0
- package/src/common/notebook.ts +1443 -0
- package/src/common/progress.ts +61 -0
- package/src/common/progressPart.ts +151 -0
- package/src/common/protocolCallHierarchyItem.ts +29 -0
- package/src/common/protocolCodeAction.ts +17 -0
- package/src/common/protocolCodeLens.ts +15 -0
- package/src/common/protocolCompletionItem.ts +22 -0
- package/src/common/protocolConverter.ts +2627 -0
- package/src/common/protocolDiagnostic.ts +47 -0
- package/src/common/protocolDocumentLink.ts +17 -0
- package/src/common/protocolInlayHint.ts +21 -0
- package/src/common/protocolTypeHierarchyItem.ts +29 -0
- package/src/common/protocolWorkspaceSymbol.ts +39 -0
- package/src/common/reference.ts +144 -0
- package/src/common/rename.ts +230 -0
- package/src/common/selectionRange.ts +136 -0
- package/src/common/semanticTokens.ts +383 -0
- package/src/common/signatureHelp.ts +170 -0
- package/src/common/textSynchronization.ts +819 -0
- package/src/common/typeDefinition.ts +146 -0
- package/src/common/typeHierarchy.ts +248 -0
- package/src/common/utils/async.ts +354 -0
- package/src/common/utils/is.ts +63 -0
- package/src/common/utils/uuid.ts +136 -0
- package/src/common/vscodeAdaptor/convertor.ts +73 -0
- package/src/common/vscodeAdaptor/diagnosticCollection.ts +238 -0
- package/src/common/vscodeAdaptor/extHostTypes.ts +4498 -0
- package/src/common/vscodeAdaptor/fileWatcher.ts +36 -0
- package/src/common/vscodeAdaptor/hostTypeUtil.ts +539 -0
- package/src/common/vscodeAdaptor/libro-fs.ts +51 -0
- package/src/common/vscodeAdaptor/libroWindow.ts +85 -0
- package/src/common/vscodeAdaptor/libroWorkspace.ts +261 -0
- package/src/common/vscodeAdaptor/lspEnv.ts +16 -0
- package/src/common/vscodeAdaptor/monaco-converter.ts +1800 -0
- package/src/common/vscodeAdaptor/monacoLanguages.ts +511 -0
- package/src/common/vscodeAdaptor/services.ts +278 -0
- package/src/common/vscodeAdaptor/typings.d.ts +10 -0
- package/src/common/vscodeAdaptor/util.ts +7 -0
- package/src/common/vscodeAdaptor/vscodeAdaptor.ts +122 -0
- package/src/common/workspaceFolder.ts +236 -0
- package/src/common/workspaceSymbol.ts +166 -0
- package/src/constants.ts +1 -0
- package/src/index.spec.ts +7 -0
- package/src/index.ts +5 -0
- package/src/libro-language-client-contribution.ts +49 -0
- package/src/libro-language-client-manager.ts +131 -0
- package/src/libro-language-client.ts +100 -0
- package/src/module.ts +19 -0
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
/* --------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
4
|
+
* ------------------------------------------------------------------------------------------ */
|
|
5
|
+
|
|
6
|
+
import { Emitter as EventEmitter } from '@difizen/mana-common';
|
|
7
|
+
import type {
|
|
8
|
+
ClientCapabilities,
|
|
9
|
+
CancellationToken,
|
|
10
|
+
ServerCapabilities,
|
|
11
|
+
DocumentSelector,
|
|
12
|
+
CodeLensOptions,
|
|
13
|
+
CodeLensRegistrationOptions,
|
|
14
|
+
} from '@difizen/vscode-languageserver-protocol';
|
|
15
|
+
import {
|
|
16
|
+
CodeLensRequest,
|
|
17
|
+
CodeLensRefreshRequest,
|
|
18
|
+
CodeLensResolveRequest,
|
|
19
|
+
} from '@difizen/vscode-languageserver-protocol';
|
|
20
|
+
import type {
|
|
21
|
+
Disposable,
|
|
22
|
+
TextDocument,
|
|
23
|
+
ProviderResult,
|
|
24
|
+
CodeLensProvider,
|
|
25
|
+
CodeLens as VCodeLens,
|
|
26
|
+
} from 'vscode';
|
|
27
|
+
|
|
28
|
+
import type { FeatureClient } from './features.js';
|
|
29
|
+
import { TextDocumentLanguageFeature, ensure } from './features.js';
|
|
30
|
+
import * as UUID from './utils/uuid.js';
|
|
31
|
+
import { languages as Languages } from './vscodeAdaptor/vscodeAdaptor.js';
|
|
32
|
+
|
|
33
|
+
export interface ProvideCodeLensesSignature {
|
|
34
|
+
(
|
|
35
|
+
this: void,
|
|
36
|
+
document: TextDocument,
|
|
37
|
+
token: CancellationToken,
|
|
38
|
+
): ProviderResult<VCodeLens[]>;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export interface ResolveCodeLensSignature {
|
|
42
|
+
(
|
|
43
|
+
this: void,
|
|
44
|
+
codeLens: VCodeLens,
|
|
45
|
+
token: CancellationToken,
|
|
46
|
+
): ProviderResult<VCodeLens>;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export interface CodeLensMiddleware {
|
|
50
|
+
provideCodeLenses?: (
|
|
51
|
+
this: void,
|
|
52
|
+
document: TextDocument,
|
|
53
|
+
token: CancellationToken,
|
|
54
|
+
next: ProvideCodeLensesSignature,
|
|
55
|
+
) => ProviderResult<VCodeLens[]>;
|
|
56
|
+
resolveCodeLens?: (
|
|
57
|
+
this: void,
|
|
58
|
+
codeLens: VCodeLens,
|
|
59
|
+
token: CancellationToken,
|
|
60
|
+
next: ResolveCodeLensSignature,
|
|
61
|
+
) => ProviderResult<VCodeLens>;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export type CodeLensProviderShape = {
|
|
65
|
+
provider?: CodeLensProvider;
|
|
66
|
+
onDidChangeCodeLensEmitter: EventEmitter<void>;
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
export class CodeLensFeature extends TextDocumentLanguageFeature<
|
|
70
|
+
CodeLensOptions,
|
|
71
|
+
CodeLensRegistrationOptions,
|
|
72
|
+
CodeLensProviderShape,
|
|
73
|
+
CodeLensMiddleware
|
|
74
|
+
> {
|
|
75
|
+
constructor(client: FeatureClient<CodeLensMiddleware>) {
|
|
76
|
+
super(client, CodeLensRequest.type);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
public fillClientCapabilities(capabilities: ClientCapabilities): void {
|
|
80
|
+
ensure(ensure(capabilities, 'textDocument')!, 'codeLens')!.dynamicRegistration =
|
|
81
|
+
true;
|
|
82
|
+
ensure(ensure(capabilities, 'workspace')!, 'codeLens')!.refreshSupport = true;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
public initialize(
|
|
86
|
+
capabilities: ServerCapabilities,
|
|
87
|
+
documentSelector: DocumentSelector,
|
|
88
|
+
): void {
|
|
89
|
+
const client = this._client;
|
|
90
|
+
client.onRequest(CodeLensRefreshRequest.type, async () => {
|
|
91
|
+
for (const provider of this.getAllProviders()) {
|
|
92
|
+
provider.onDidChangeCodeLensEmitter.fire();
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
const options = this.getRegistrationOptions(
|
|
96
|
+
documentSelector,
|
|
97
|
+
capabilities.codeLensProvider,
|
|
98
|
+
);
|
|
99
|
+
if (!options) {
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
this.register({ id: UUID.generateUuid(), registerOptions: options });
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
protected registerLanguageProvider(
|
|
106
|
+
options: CodeLensRegistrationOptions,
|
|
107
|
+
): [Disposable, CodeLensProviderShape] {
|
|
108
|
+
const selector = options.documentSelector!;
|
|
109
|
+
const eventEmitter: EventEmitter<void> = new EventEmitter<void>();
|
|
110
|
+
const provider: CodeLensProvider = {
|
|
111
|
+
onDidChangeCodeLenses: eventEmitter.event,
|
|
112
|
+
provideCodeLenses: (document, token) => {
|
|
113
|
+
const client = this._client;
|
|
114
|
+
const provideCodeLenses: ProvideCodeLensesSignature = (document, token) => {
|
|
115
|
+
return client
|
|
116
|
+
.sendRequest(
|
|
117
|
+
CodeLensRequest.type,
|
|
118
|
+
client.code2ProtocolConverter.asCodeLensParams(document),
|
|
119
|
+
token,
|
|
120
|
+
)
|
|
121
|
+
.then(
|
|
122
|
+
(result) => {
|
|
123
|
+
if (token.isCancellationRequested) {
|
|
124
|
+
return null;
|
|
125
|
+
}
|
|
126
|
+
return client.protocol2CodeConverter.asCodeLenses(result, token);
|
|
127
|
+
},
|
|
128
|
+
(error) => {
|
|
129
|
+
return client.handleFailedRequest(
|
|
130
|
+
CodeLensRequest.type,
|
|
131
|
+
token,
|
|
132
|
+
error,
|
|
133
|
+
null,
|
|
134
|
+
);
|
|
135
|
+
},
|
|
136
|
+
);
|
|
137
|
+
};
|
|
138
|
+
const middleware = client.middleware;
|
|
139
|
+
return middleware.provideCodeLenses
|
|
140
|
+
? middleware.provideCodeLenses(document, token, provideCodeLenses)
|
|
141
|
+
: provideCodeLenses(document, token);
|
|
142
|
+
},
|
|
143
|
+
resolveCodeLens: options.resolveProvider
|
|
144
|
+
? (
|
|
145
|
+
codeLens: VCodeLens,
|
|
146
|
+
token: CancellationToken,
|
|
147
|
+
): ProviderResult<VCodeLens> => {
|
|
148
|
+
const client = this._client;
|
|
149
|
+
const resolveCodeLens: ResolveCodeLensSignature = (codeLens, token) => {
|
|
150
|
+
return client
|
|
151
|
+
.sendRequest(
|
|
152
|
+
CodeLensResolveRequest.type,
|
|
153
|
+
client.code2ProtocolConverter.asCodeLens(codeLens),
|
|
154
|
+
token,
|
|
155
|
+
)
|
|
156
|
+
.then(
|
|
157
|
+
(result) => {
|
|
158
|
+
if (token.isCancellationRequested) {
|
|
159
|
+
return codeLens;
|
|
160
|
+
}
|
|
161
|
+
return client.protocol2CodeConverter.asCodeLens(result);
|
|
162
|
+
},
|
|
163
|
+
(error) => {
|
|
164
|
+
return client.handleFailedRequest(
|
|
165
|
+
CodeLensResolveRequest.type,
|
|
166
|
+
token,
|
|
167
|
+
error,
|
|
168
|
+
codeLens,
|
|
169
|
+
);
|
|
170
|
+
},
|
|
171
|
+
);
|
|
172
|
+
};
|
|
173
|
+
const middleware = client.middleware;
|
|
174
|
+
return middleware.resolveCodeLens
|
|
175
|
+
? middleware.resolveCodeLens(codeLens, token, resolveCodeLens)
|
|
176
|
+
: resolveCodeLens(codeLens, token);
|
|
177
|
+
}
|
|
178
|
+
: undefined,
|
|
179
|
+
};
|
|
180
|
+
return [
|
|
181
|
+
Languages.registerCodeLensProvider(
|
|
182
|
+
this._client.protocol2CodeConverter.asDocumentSelector(selector),
|
|
183
|
+
provider,
|
|
184
|
+
),
|
|
185
|
+
{ provider, onDidChangeCodeLensEmitter: eventEmitter },
|
|
186
|
+
];
|
|
187
|
+
}
|
|
188
|
+
}
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
/* --------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
4
|
+
* ------------------------------------------------------------------------------------------ */
|
|
5
|
+
|
|
6
|
+
import type {
|
|
7
|
+
ClientCapabilities,
|
|
8
|
+
CancellationToken,
|
|
9
|
+
ServerCapabilities,
|
|
10
|
+
DocumentSelector,
|
|
11
|
+
DocumentColorRegistrationOptions,
|
|
12
|
+
DocumentColorOptions,
|
|
13
|
+
} from '@difizen/vscode-languageserver-protocol';
|
|
14
|
+
import {
|
|
15
|
+
DocumentColorRequest,
|
|
16
|
+
ColorPresentationRequest,
|
|
17
|
+
} from '@difizen/vscode-languageserver-protocol';
|
|
18
|
+
import type {
|
|
19
|
+
Disposable,
|
|
20
|
+
TextDocument,
|
|
21
|
+
ProviderResult,
|
|
22
|
+
Range as VRange,
|
|
23
|
+
Color as VColor,
|
|
24
|
+
ColorPresentation as VColorPresentation,
|
|
25
|
+
ColorInformation as VColorInformation,
|
|
26
|
+
DocumentColorProvider,
|
|
27
|
+
} from 'vscode';
|
|
28
|
+
|
|
29
|
+
import type { FeatureClient } from './features.js';
|
|
30
|
+
import { TextDocumentLanguageFeature, ensure } from './features.js';
|
|
31
|
+
import { languages as Languages } from './vscodeAdaptor/vscodeAdaptor.js';
|
|
32
|
+
|
|
33
|
+
export interface ProvideDocumentColorsSignature {
|
|
34
|
+
(
|
|
35
|
+
document: TextDocument,
|
|
36
|
+
token: CancellationToken,
|
|
37
|
+
): ProviderResult<VColorInformation[]>;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface ProvideColorPresentationSignature {
|
|
41
|
+
(
|
|
42
|
+
color: VColor,
|
|
43
|
+
context: { document: TextDocument; range: VRange },
|
|
44
|
+
token: CancellationToken,
|
|
45
|
+
): ProviderResult<VColorPresentation[]>;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export interface ColorProviderMiddleware {
|
|
49
|
+
provideDocumentColors?: (
|
|
50
|
+
this: void,
|
|
51
|
+
document: TextDocument,
|
|
52
|
+
token: CancellationToken,
|
|
53
|
+
next: ProvideDocumentColorsSignature,
|
|
54
|
+
) => ProviderResult<VColorInformation[]>;
|
|
55
|
+
provideColorPresentations?: (
|
|
56
|
+
this: void,
|
|
57
|
+
color: VColor,
|
|
58
|
+
context: { document: TextDocument; range: VRange },
|
|
59
|
+
token: CancellationToken,
|
|
60
|
+
next: ProvideColorPresentationSignature,
|
|
61
|
+
) => ProviderResult<VColorPresentation[]>;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export class ColorProviderFeature extends TextDocumentLanguageFeature<
|
|
65
|
+
boolean | DocumentColorOptions,
|
|
66
|
+
DocumentColorRegistrationOptions,
|
|
67
|
+
DocumentColorProvider,
|
|
68
|
+
ColorProviderMiddleware
|
|
69
|
+
> {
|
|
70
|
+
constructor(client: FeatureClient<ColorProviderMiddleware>) {
|
|
71
|
+
super(client, DocumentColorRequest.type);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
public fillClientCapabilities(capabilities: ClientCapabilities): void {
|
|
75
|
+
ensure(
|
|
76
|
+
ensure(capabilities, 'textDocument')!,
|
|
77
|
+
'colorProvider',
|
|
78
|
+
)!.dynamicRegistration = true;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
public initialize(
|
|
82
|
+
capabilities: ServerCapabilities,
|
|
83
|
+
documentSelector: DocumentSelector,
|
|
84
|
+
): void {
|
|
85
|
+
const [id, options] = this.getRegistration(
|
|
86
|
+
documentSelector,
|
|
87
|
+
capabilities.colorProvider,
|
|
88
|
+
);
|
|
89
|
+
if (!id || !options) {
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
this.register({ id: id, registerOptions: options });
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
protected registerLanguageProvider(
|
|
96
|
+
options: DocumentColorRegistrationOptions,
|
|
97
|
+
): [Disposable, DocumentColorProvider] {
|
|
98
|
+
const selector = options.documentSelector!;
|
|
99
|
+
const provider: DocumentColorProvider = {
|
|
100
|
+
provideColorPresentations: (color, context, token) => {
|
|
101
|
+
const client = this._client;
|
|
102
|
+
const provideColorPresentations: ProvideColorPresentationSignature = (
|
|
103
|
+
color,
|
|
104
|
+
context,
|
|
105
|
+
token,
|
|
106
|
+
) => {
|
|
107
|
+
const requestParams = {
|
|
108
|
+
color,
|
|
109
|
+
textDocument: client.code2ProtocolConverter.asTextDocumentIdentifier(
|
|
110
|
+
context.document,
|
|
111
|
+
),
|
|
112
|
+
range: client.code2ProtocolConverter.asRange(context.range),
|
|
113
|
+
};
|
|
114
|
+
return client
|
|
115
|
+
.sendRequest(ColorPresentationRequest.type, requestParams, token)
|
|
116
|
+
.then(
|
|
117
|
+
(result) => {
|
|
118
|
+
if (token.isCancellationRequested) {
|
|
119
|
+
return null;
|
|
120
|
+
}
|
|
121
|
+
return this._client.protocol2CodeConverter.asColorPresentations(
|
|
122
|
+
result,
|
|
123
|
+
token,
|
|
124
|
+
);
|
|
125
|
+
},
|
|
126
|
+
(error: any) => {
|
|
127
|
+
return client.handleFailedRequest(
|
|
128
|
+
ColorPresentationRequest.type,
|
|
129
|
+
token,
|
|
130
|
+
error,
|
|
131
|
+
null,
|
|
132
|
+
);
|
|
133
|
+
},
|
|
134
|
+
);
|
|
135
|
+
};
|
|
136
|
+
const middleware = client.middleware;
|
|
137
|
+
return middleware.provideColorPresentations
|
|
138
|
+
? middleware.provideColorPresentations(
|
|
139
|
+
color,
|
|
140
|
+
context,
|
|
141
|
+
token,
|
|
142
|
+
provideColorPresentations,
|
|
143
|
+
)
|
|
144
|
+
: provideColorPresentations(color, context, token);
|
|
145
|
+
},
|
|
146
|
+
provideDocumentColors: (document, token) => {
|
|
147
|
+
const client = this._client;
|
|
148
|
+
const provideDocumentColors: ProvideDocumentColorsSignature = (
|
|
149
|
+
document,
|
|
150
|
+
token,
|
|
151
|
+
) => {
|
|
152
|
+
const requestParams = {
|
|
153
|
+
textDocument:
|
|
154
|
+
client.code2ProtocolConverter.asTextDocumentIdentifier(document),
|
|
155
|
+
};
|
|
156
|
+
return client
|
|
157
|
+
.sendRequest(DocumentColorRequest.type, requestParams, token)
|
|
158
|
+
.then(
|
|
159
|
+
(result) => {
|
|
160
|
+
if (token.isCancellationRequested) {
|
|
161
|
+
return null;
|
|
162
|
+
}
|
|
163
|
+
return this._client.protocol2CodeConverter.asColorInformations(
|
|
164
|
+
result,
|
|
165
|
+
token,
|
|
166
|
+
);
|
|
167
|
+
},
|
|
168
|
+
(error: any) => {
|
|
169
|
+
return client.handleFailedRequest(
|
|
170
|
+
DocumentColorRequest.type,
|
|
171
|
+
token,
|
|
172
|
+
error,
|
|
173
|
+
null,
|
|
174
|
+
);
|
|
175
|
+
},
|
|
176
|
+
);
|
|
177
|
+
};
|
|
178
|
+
const middleware = client.middleware;
|
|
179
|
+
return middleware.provideDocumentColors
|
|
180
|
+
? middleware.provideDocumentColors(document, token, provideDocumentColors)
|
|
181
|
+
: provideDocumentColors(document, token);
|
|
182
|
+
},
|
|
183
|
+
};
|
|
184
|
+
return [
|
|
185
|
+
Languages.registerColorProvider(
|
|
186
|
+
this._client.protocol2CodeConverter.asDocumentSelector(selector),
|
|
187
|
+
provider,
|
|
188
|
+
),
|
|
189
|
+
provider,
|
|
190
|
+
];
|
|
191
|
+
}
|
|
192
|
+
}
|
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
/* --------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
4
|
+
* ------------------------------------------------------------------------------------------ */
|
|
5
|
+
|
|
6
|
+
import type {
|
|
7
|
+
ClientCapabilities,
|
|
8
|
+
CompletionOptions,
|
|
9
|
+
CompletionRegistrationOptions,
|
|
10
|
+
DocumentSelector,
|
|
11
|
+
ServerCapabilities,
|
|
12
|
+
} from '@difizen/vscode-languageserver-protocol';
|
|
13
|
+
import {
|
|
14
|
+
CompletionItemKind,
|
|
15
|
+
CompletionItemTag,
|
|
16
|
+
CompletionRequest,
|
|
17
|
+
CompletionResolveRequest,
|
|
18
|
+
InsertTextMode,
|
|
19
|
+
MarkupKind,
|
|
20
|
+
} from '@difizen/vscode-languageserver-protocol';
|
|
21
|
+
import type {
|
|
22
|
+
TextDocument,
|
|
23
|
+
Disposable,
|
|
24
|
+
Position as VPosition,
|
|
25
|
+
CompletionContext as VCompletionContext,
|
|
26
|
+
CancellationToken,
|
|
27
|
+
ProviderResult,
|
|
28
|
+
CompletionItem as VCompletionItem,
|
|
29
|
+
CompletionList as VCompletionList,
|
|
30
|
+
CompletionItemProvider,
|
|
31
|
+
} from 'vscode';
|
|
32
|
+
|
|
33
|
+
import type { FeatureClient } from './features.js';
|
|
34
|
+
import { ensure, TextDocumentLanguageFeature } from './features.js';
|
|
35
|
+
import * as UUID from './utils/uuid.js';
|
|
36
|
+
import { languages as Languages } from './vscodeAdaptor/vscodeAdaptor.js';
|
|
37
|
+
|
|
38
|
+
const SupportedCompletionItemKinds: CompletionItemKind[] = [
|
|
39
|
+
CompletionItemKind.Text,
|
|
40
|
+
CompletionItemKind.Method,
|
|
41
|
+
CompletionItemKind.Function,
|
|
42
|
+
CompletionItemKind.Constructor,
|
|
43
|
+
CompletionItemKind.Field,
|
|
44
|
+
CompletionItemKind.Variable,
|
|
45
|
+
CompletionItemKind.Class,
|
|
46
|
+
CompletionItemKind.Interface,
|
|
47
|
+
CompletionItemKind.Module,
|
|
48
|
+
CompletionItemKind.Property,
|
|
49
|
+
CompletionItemKind.Unit,
|
|
50
|
+
CompletionItemKind.Value,
|
|
51
|
+
CompletionItemKind.Enum,
|
|
52
|
+
CompletionItemKind.Keyword,
|
|
53
|
+
CompletionItemKind.Snippet,
|
|
54
|
+
CompletionItemKind.Color,
|
|
55
|
+
CompletionItemKind.File,
|
|
56
|
+
CompletionItemKind.Reference,
|
|
57
|
+
CompletionItemKind.Folder,
|
|
58
|
+
CompletionItemKind.EnumMember,
|
|
59
|
+
CompletionItemKind.Constant,
|
|
60
|
+
CompletionItemKind.Struct,
|
|
61
|
+
CompletionItemKind.Event,
|
|
62
|
+
CompletionItemKind.Operator,
|
|
63
|
+
CompletionItemKind.TypeParameter,
|
|
64
|
+
];
|
|
65
|
+
|
|
66
|
+
export interface ProvideCompletionItemsSignature {
|
|
67
|
+
(
|
|
68
|
+
this: void,
|
|
69
|
+
document: TextDocument,
|
|
70
|
+
position: VPosition,
|
|
71
|
+
context: VCompletionContext,
|
|
72
|
+
token: CancellationToken,
|
|
73
|
+
): ProviderResult<VCompletionItem[] | VCompletionList>;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export interface ResolveCompletionItemSignature {
|
|
77
|
+
(
|
|
78
|
+
this: void,
|
|
79
|
+
item: VCompletionItem,
|
|
80
|
+
token: CancellationToken,
|
|
81
|
+
): ProviderResult<VCompletionItem>;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export interface CompletionMiddleware {
|
|
85
|
+
provideCompletionItem?: (
|
|
86
|
+
this: void,
|
|
87
|
+
document: TextDocument,
|
|
88
|
+
position: VPosition,
|
|
89
|
+
context: VCompletionContext,
|
|
90
|
+
token: CancellationToken,
|
|
91
|
+
next: ProvideCompletionItemsSignature,
|
|
92
|
+
) => ProviderResult<VCompletionItem[] | VCompletionList>;
|
|
93
|
+
resolveCompletionItem?: (
|
|
94
|
+
this: void,
|
|
95
|
+
item: VCompletionItem,
|
|
96
|
+
token: CancellationToken,
|
|
97
|
+
next: ResolveCompletionItemSignature,
|
|
98
|
+
) => ProviderResult<VCompletionItem>;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export class CompletionItemFeature extends TextDocumentLanguageFeature<
|
|
102
|
+
CompletionOptions,
|
|
103
|
+
CompletionRegistrationOptions,
|
|
104
|
+
CompletionItemProvider,
|
|
105
|
+
CompletionMiddleware
|
|
106
|
+
> {
|
|
107
|
+
private labelDetailsSupport: Map<string, boolean>;
|
|
108
|
+
|
|
109
|
+
constructor(client: FeatureClient<CompletionMiddleware>) {
|
|
110
|
+
super(client, CompletionRequest.type);
|
|
111
|
+
this.labelDetailsSupport = new Map();
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
public fillClientCapabilities(capabilities: ClientCapabilities): void {
|
|
115
|
+
const completion = ensure(ensure(capabilities, 'textDocument')!, 'completion')!;
|
|
116
|
+
completion.dynamicRegistration = true;
|
|
117
|
+
completion.contextSupport = true;
|
|
118
|
+
completion.completionItem = {
|
|
119
|
+
snippetSupport: true,
|
|
120
|
+
commitCharactersSupport: true,
|
|
121
|
+
documentationFormat: [MarkupKind.Markdown, MarkupKind.PlainText],
|
|
122
|
+
deprecatedSupport: true,
|
|
123
|
+
preselectSupport: true,
|
|
124
|
+
tagSupport: { valueSet: [CompletionItemTag.Deprecated] },
|
|
125
|
+
insertReplaceSupport: true,
|
|
126
|
+
resolveSupport: {
|
|
127
|
+
properties: ['documentation', 'detail', 'additionalTextEdits'],
|
|
128
|
+
},
|
|
129
|
+
insertTextModeSupport: {
|
|
130
|
+
valueSet: [InsertTextMode.asIs, InsertTextMode.adjustIndentation],
|
|
131
|
+
},
|
|
132
|
+
labelDetailsSupport: true,
|
|
133
|
+
};
|
|
134
|
+
completion.insertTextMode = InsertTextMode.adjustIndentation;
|
|
135
|
+
completion.completionItemKind = { valueSet: SupportedCompletionItemKinds };
|
|
136
|
+
completion.completionList = {
|
|
137
|
+
itemDefaults: [
|
|
138
|
+
'commitCharacters',
|
|
139
|
+
'editRange',
|
|
140
|
+
'insertTextFormat',
|
|
141
|
+
'insertTextMode',
|
|
142
|
+
'data',
|
|
143
|
+
],
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
public initialize(
|
|
148
|
+
capabilities: ServerCapabilities,
|
|
149
|
+
documentSelector: DocumentSelector,
|
|
150
|
+
): void {
|
|
151
|
+
const options = this.getRegistrationOptions(
|
|
152
|
+
documentSelector,
|
|
153
|
+
capabilities.completionProvider,
|
|
154
|
+
);
|
|
155
|
+
if (!options) {
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
this.register({
|
|
160
|
+
id: UUID.generateUuid(),
|
|
161
|
+
registerOptions: options,
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
protected registerLanguageProvider(
|
|
166
|
+
options: CompletionRegistrationOptions,
|
|
167
|
+
id: string,
|
|
168
|
+
): [Disposable, CompletionItemProvider] {
|
|
169
|
+
this.labelDetailsSupport.set(id, !!options.completionItem?.labelDetailsSupport);
|
|
170
|
+
const triggerCharacters = options.triggerCharacters ?? [];
|
|
171
|
+
const defaultCommitCharacters = options.allCommitCharacters;
|
|
172
|
+
const selector = options.documentSelector!;
|
|
173
|
+
const provider: CompletionItemProvider = {
|
|
174
|
+
provideCompletionItems: (
|
|
175
|
+
document: TextDocument,
|
|
176
|
+
position: VPosition,
|
|
177
|
+
token: CancellationToken,
|
|
178
|
+
context: VCompletionContext,
|
|
179
|
+
): ProviderResult<VCompletionList | VCompletionItem[]> => {
|
|
180
|
+
const client = this._client;
|
|
181
|
+
const middleware = this._client.middleware;
|
|
182
|
+
const provideCompletionItems: ProvideCompletionItemsSignature = (
|
|
183
|
+
document,
|
|
184
|
+
position,
|
|
185
|
+
context,
|
|
186
|
+
token,
|
|
187
|
+
) => {
|
|
188
|
+
return client
|
|
189
|
+
.sendRequest(
|
|
190
|
+
CompletionRequest.type,
|
|
191
|
+
client.code2ProtocolConverter.asCompletionParams(
|
|
192
|
+
document,
|
|
193
|
+
position,
|
|
194
|
+
context,
|
|
195
|
+
),
|
|
196
|
+
token,
|
|
197
|
+
)
|
|
198
|
+
.then(
|
|
199
|
+
(result) => {
|
|
200
|
+
if (token.isCancellationRequested) {
|
|
201
|
+
return null;
|
|
202
|
+
}
|
|
203
|
+
return client.protocol2CodeConverter.asCompletionResult(
|
|
204
|
+
result,
|
|
205
|
+
defaultCommitCharacters,
|
|
206
|
+
token,
|
|
207
|
+
);
|
|
208
|
+
},
|
|
209
|
+
(error) => {
|
|
210
|
+
return client.handleFailedRequest(
|
|
211
|
+
CompletionRequest.type,
|
|
212
|
+
token,
|
|
213
|
+
error,
|
|
214
|
+
null,
|
|
215
|
+
);
|
|
216
|
+
},
|
|
217
|
+
);
|
|
218
|
+
};
|
|
219
|
+
return middleware.provideCompletionItem
|
|
220
|
+
? middleware.provideCompletionItem(
|
|
221
|
+
document,
|
|
222
|
+
position,
|
|
223
|
+
context,
|
|
224
|
+
token,
|
|
225
|
+
provideCompletionItems,
|
|
226
|
+
)
|
|
227
|
+
: provideCompletionItems(document, position, context, token);
|
|
228
|
+
},
|
|
229
|
+
resolveCompletionItem: options.resolveProvider
|
|
230
|
+
? (
|
|
231
|
+
item: VCompletionItem,
|
|
232
|
+
token: CancellationToken,
|
|
233
|
+
): ProviderResult<VCompletionItem> => {
|
|
234
|
+
const client = this._client;
|
|
235
|
+
const middleware = this._client.middleware;
|
|
236
|
+
const resolveCompletionItem: ResolveCompletionItemSignature = (
|
|
237
|
+
item,
|
|
238
|
+
token,
|
|
239
|
+
) => {
|
|
240
|
+
return client
|
|
241
|
+
.sendRequest(
|
|
242
|
+
CompletionResolveRequest.type,
|
|
243
|
+
client.code2ProtocolConverter.asCompletionItem(
|
|
244
|
+
item,
|
|
245
|
+
!!this.labelDetailsSupport.get(id),
|
|
246
|
+
),
|
|
247
|
+
token,
|
|
248
|
+
)
|
|
249
|
+
.then(
|
|
250
|
+
(result) => {
|
|
251
|
+
if (token.isCancellationRequested) {
|
|
252
|
+
return null;
|
|
253
|
+
}
|
|
254
|
+
return client.protocol2CodeConverter.asCompletionItem(result);
|
|
255
|
+
},
|
|
256
|
+
(error) => {
|
|
257
|
+
return client.handleFailedRequest(
|
|
258
|
+
CompletionResolveRequest.type,
|
|
259
|
+
token,
|
|
260
|
+
error,
|
|
261
|
+
item,
|
|
262
|
+
);
|
|
263
|
+
},
|
|
264
|
+
);
|
|
265
|
+
};
|
|
266
|
+
return middleware.resolveCompletionItem
|
|
267
|
+
? middleware.resolveCompletionItem(item, token, resolveCompletionItem)
|
|
268
|
+
: resolveCompletionItem(item, token);
|
|
269
|
+
}
|
|
270
|
+
: undefined,
|
|
271
|
+
};
|
|
272
|
+
return [
|
|
273
|
+
Languages.registerCompletionItemProvider(
|
|
274
|
+
this._client.protocol2CodeConverter.asDocumentSelector(selector),
|
|
275
|
+
provider,
|
|
276
|
+
...triggerCharacters,
|
|
277
|
+
),
|
|
278
|
+
provider,
|
|
279
|
+
];
|
|
280
|
+
}
|
|
281
|
+
}
|