@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,511 @@
|
|
|
1
|
+
import { singleton } from '@difizen/mana-app';
|
|
2
|
+
import * as monaco from '@difizen/monaco-editor-core';
|
|
3
|
+
// import { score } from '@difizen/monaco-editor-core/esm/vs/editor/common/languageSelector.js';
|
|
4
|
+
import type {
|
|
5
|
+
DiagnosticCollection,
|
|
6
|
+
TextDocument,
|
|
7
|
+
DocumentSelector,
|
|
8
|
+
Disposable,
|
|
9
|
+
CallHierarchyProvider,
|
|
10
|
+
CodeActionProviderMetadata,
|
|
11
|
+
CodeActionProvider,
|
|
12
|
+
CompletionItemProvider,
|
|
13
|
+
DocumentSemanticTokensProvider,
|
|
14
|
+
CodeLensProvider,
|
|
15
|
+
DeclarationProvider,
|
|
16
|
+
DefinitionProvider,
|
|
17
|
+
DocumentColorProvider,
|
|
18
|
+
DocumentFormattingEditProvider,
|
|
19
|
+
DocumentHighlightProvider,
|
|
20
|
+
DocumentLinkProvider,
|
|
21
|
+
DocumentRangeFormattingEditProvider,
|
|
22
|
+
DocumentRangeSemanticTokensProvider,
|
|
23
|
+
DocumentSymbolProvider,
|
|
24
|
+
DocumentSymbolProviderMetadata,
|
|
25
|
+
FoldingRangeProvider,
|
|
26
|
+
HoverProvider,
|
|
27
|
+
ImplementationProvider,
|
|
28
|
+
InlineCompletionItemProvider,
|
|
29
|
+
InlineValuesProvider,
|
|
30
|
+
LanguageConfiguration,
|
|
31
|
+
LinkedEditingRangeProvider,
|
|
32
|
+
OnTypeFormattingEditProvider,
|
|
33
|
+
ReferenceProvider,
|
|
34
|
+
RenameProvider,
|
|
35
|
+
SelectionRangeProvider,
|
|
36
|
+
SemanticTokensLegend,
|
|
37
|
+
SignatureHelpProvider,
|
|
38
|
+
SignatureHelpProviderMetadata,
|
|
39
|
+
TypeDefinitionProvider,
|
|
40
|
+
TypeHierarchyProvider,
|
|
41
|
+
WorkspaceSymbolProvider,
|
|
42
|
+
InlayHintsProvider,
|
|
43
|
+
CompletionItem,
|
|
44
|
+
} from 'vscode';
|
|
45
|
+
|
|
46
|
+
import * as c2p from '../codeConverter.js';
|
|
47
|
+
import * as p2c from '../protocolConverter.js';
|
|
48
|
+
|
|
49
|
+
import { LibroDiagnosticCollection } from './diagnosticCollection.js';
|
|
50
|
+
import {
|
|
51
|
+
MonacoToProtocolConverter,
|
|
52
|
+
ProtocolToMonacoConverter,
|
|
53
|
+
} from './monaco-converter.js';
|
|
54
|
+
import { IMonacoLanguages } from './services.js';
|
|
55
|
+
import { CompletionTriggerKind } from './vscodeAdaptor.js';
|
|
56
|
+
|
|
57
|
+
function overrideWithResolvedValue<T>(item: T, resolvedItem: T): void {
|
|
58
|
+
for (const key in resolvedItem) {
|
|
59
|
+
const value = resolvedItem[key];
|
|
60
|
+
// eslint-disable-next-line eqeqeq
|
|
61
|
+
if (value != null) {
|
|
62
|
+
item[key] = value;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
@singleton({ token: IMonacoLanguages })
|
|
68
|
+
export class MonacoLanguages implements IMonacoLanguages {
|
|
69
|
+
protected readonly c2p: c2p.Converter = c2p.createConverter();
|
|
70
|
+
protected readonly p2c: p2c.Converter = p2c.createConverter(undefined, true, true);
|
|
71
|
+
protected readonly p2m: ProtocolToMonacoConverter = new ProtocolToMonacoConverter(
|
|
72
|
+
monaco,
|
|
73
|
+
);
|
|
74
|
+
protected readonly m2p: MonacoToProtocolConverter = new MonacoToProtocolConverter(
|
|
75
|
+
monaco,
|
|
76
|
+
);
|
|
77
|
+
createDiagnosticCollection(name?: string): DiagnosticCollection {
|
|
78
|
+
return new LibroDiagnosticCollection();
|
|
79
|
+
}
|
|
80
|
+
match(selector: DocumentSelector, document: TextDocument): number {
|
|
81
|
+
// const notebook = extHostDocuments.getDocumentData(document.uri)?.notebook;
|
|
82
|
+
// return score(
|
|
83
|
+
// typeConverters.LanguageSelector.from(selector),
|
|
84
|
+
// document.uri,
|
|
85
|
+
// document.languageId,
|
|
86
|
+
// true,
|
|
87
|
+
// notebook?.uri,
|
|
88
|
+
// notebook?.notebookType,
|
|
89
|
+
// );
|
|
90
|
+
return 1;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
registerCodeActionsProvider(
|
|
94
|
+
selector: DocumentSelector,
|
|
95
|
+
provider: CodeActionProvider,
|
|
96
|
+
metadata?: CodeActionProviderMetadata,
|
|
97
|
+
): Disposable {
|
|
98
|
+
return {
|
|
99
|
+
dispose: () => {
|
|
100
|
+
return;
|
|
101
|
+
},
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
registerCodeLensProvider(
|
|
105
|
+
selector: DocumentSelector,
|
|
106
|
+
provider: CodeLensProvider,
|
|
107
|
+
): Disposable {
|
|
108
|
+
return {
|
|
109
|
+
dispose: () => {
|
|
110
|
+
return;
|
|
111
|
+
},
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
registerDefinitionProvider(
|
|
115
|
+
selector: DocumentSelector,
|
|
116
|
+
provider: DefinitionProvider,
|
|
117
|
+
): Disposable {
|
|
118
|
+
return {
|
|
119
|
+
dispose: () => {
|
|
120
|
+
return;
|
|
121
|
+
},
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
registerDeclarationProvider(
|
|
125
|
+
selector: DocumentSelector,
|
|
126
|
+
provider: DeclarationProvider,
|
|
127
|
+
): Disposable {
|
|
128
|
+
return {
|
|
129
|
+
dispose: () => {
|
|
130
|
+
return;
|
|
131
|
+
},
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
registerImplementationProvider(
|
|
135
|
+
selector: DocumentSelector,
|
|
136
|
+
provider: ImplementationProvider,
|
|
137
|
+
): Disposable {
|
|
138
|
+
return {
|
|
139
|
+
dispose: () => {
|
|
140
|
+
return;
|
|
141
|
+
},
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
registerTypeDefinitionProvider(
|
|
145
|
+
selector: DocumentSelector,
|
|
146
|
+
provider: TypeDefinitionProvider,
|
|
147
|
+
): Disposable {
|
|
148
|
+
return {
|
|
149
|
+
dispose: () => {
|
|
150
|
+
return;
|
|
151
|
+
},
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
registerHoverProvider(
|
|
155
|
+
selector: DocumentSelector,
|
|
156
|
+
provider: HoverProvider,
|
|
157
|
+
): Disposable {
|
|
158
|
+
return monaco.languages.registerHoverProvider(
|
|
159
|
+
selector,
|
|
160
|
+
this.createHoverProvider(provider),
|
|
161
|
+
);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
protected createHoverProvider(
|
|
165
|
+
provider: HoverProvider,
|
|
166
|
+
): monaco.languages.HoverProvider {
|
|
167
|
+
return {
|
|
168
|
+
provideHover: async (model, position, token) => {
|
|
169
|
+
const params = this.m2p.asTextDocumentPositionParams(model, position);
|
|
170
|
+
|
|
171
|
+
const hover = await provider.provideHover(
|
|
172
|
+
{ uri: model.uri } as any,
|
|
173
|
+
this.p2c.asPosition(params.position),
|
|
174
|
+
token,
|
|
175
|
+
);
|
|
176
|
+
|
|
177
|
+
if (!hover || !hover.range) {
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
return {
|
|
181
|
+
contents: hover?.contents,
|
|
182
|
+
range: this.p2m.asRange(this.c2p.asRange(hover.range)),
|
|
183
|
+
} as monaco.languages.Hover;
|
|
184
|
+
},
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
registerInlineValuesProvider(
|
|
189
|
+
selector: DocumentSelector,
|
|
190
|
+
provider: InlineValuesProvider,
|
|
191
|
+
): Disposable {
|
|
192
|
+
return {
|
|
193
|
+
dispose: () => {
|
|
194
|
+
return;
|
|
195
|
+
},
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
registerDocumentHighlightProvider(
|
|
199
|
+
selector: DocumentSelector,
|
|
200
|
+
provider: DocumentHighlightProvider,
|
|
201
|
+
): Disposable {
|
|
202
|
+
return {
|
|
203
|
+
dispose: () => {
|
|
204
|
+
return;
|
|
205
|
+
},
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
registerLinkedEditingRangeProvider(
|
|
209
|
+
selector: DocumentSelector,
|
|
210
|
+
provider: LinkedEditingRangeProvider,
|
|
211
|
+
): Disposable {
|
|
212
|
+
return {
|
|
213
|
+
dispose: () => {
|
|
214
|
+
return;
|
|
215
|
+
},
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
registerReferenceProvider(
|
|
219
|
+
selector: DocumentSelector,
|
|
220
|
+
provider: ReferenceProvider,
|
|
221
|
+
): Disposable {
|
|
222
|
+
return {
|
|
223
|
+
dispose: () => {
|
|
224
|
+
return;
|
|
225
|
+
},
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
registerRenameProvider(
|
|
229
|
+
selector: DocumentSelector,
|
|
230
|
+
provider: RenameProvider,
|
|
231
|
+
): Disposable {
|
|
232
|
+
return {
|
|
233
|
+
dispose: () => {
|
|
234
|
+
return;
|
|
235
|
+
},
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
registerDocumentSymbolProvider(
|
|
239
|
+
selector: DocumentSelector,
|
|
240
|
+
provider: DocumentSymbolProvider,
|
|
241
|
+
metadata?: DocumentSymbolProviderMetadata,
|
|
242
|
+
): Disposable {
|
|
243
|
+
return {
|
|
244
|
+
dispose: () => {
|
|
245
|
+
return;
|
|
246
|
+
},
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
registerWorkspaceSymbolProvider(provider: WorkspaceSymbolProvider): Disposable {
|
|
250
|
+
return {
|
|
251
|
+
dispose: () => {
|
|
252
|
+
return;
|
|
253
|
+
},
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
registerDocumentFormattingEditProvider(
|
|
257
|
+
selector: DocumentSelector,
|
|
258
|
+
provider: DocumentFormattingEditProvider,
|
|
259
|
+
): Disposable {
|
|
260
|
+
const documentFormattingEditProvider =
|
|
261
|
+
this.createDocumentFormattingEditProvider(provider);
|
|
262
|
+
return monaco.languages.registerDocumentFormattingEditProvider(
|
|
263
|
+
selector,
|
|
264
|
+
documentFormattingEditProvider,
|
|
265
|
+
);
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
protected createDocumentFormattingEditProvider(
|
|
269
|
+
provider: DocumentFormattingEditProvider,
|
|
270
|
+
): monaco.languages.DocumentFormattingEditProvider {
|
|
271
|
+
return {
|
|
272
|
+
provideDocumentFormattingEdits: async (model, options, token) => {
|
|
273
|
+
const params = this.m2p.asDocumentFormattingParams(model, options);
|
|
274
|
+
const result = await provider.provideDocumentFormattingEdits(
|
|
275
|
+
{ uri: model.uri } as any,
|
|
276
|
+
params.options as any,
|
|
277
|
+
token,
|
|
278
|
+
);
|
|
279
|
+
|
|
280
|
+
return result && this.p2m.asTextEdits(result);
|
|
281
|
+
},
|
|
282
|
+
};
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
registerDocumentRangeFormattingEditProvider(
|
|
286
|
+
selector: DocumentSelector,
|
|
287
|
+
provider: DocumentRangeFormattingEditProvider,
|
|
288
|
+
): Disposable {
|
|
289
|
+
return {
|
|
290
|
+
dispose: () => {
|
|
291
|
+
return;
|
|
292
|
+
},
|
|
293
|
+
};
|
|
294
|
+
}
|
|
295
|
+
registerOnTypeFormattingEditProvider(
|
|
296
|
+
selector: DocumentSelector,
|
|
297
|
+
provider: OnTypeFormattingEditProvider,
|
|
298
|
+
firstTriggerCharacter: string,
|
|
299
|
+
...moreTriggerCharacters: string[]
|
|
300
|
+
): Disposable {
|
|
301
|
+
return {
|
|
302
|
+
dispose: () => {
|
|
303
|
+
return;
|
|
304
|
+
},
|
|
305
|
+
};
|
|
306
|
+
}
|
|
307
|
+
registerDocumentSemanticTokensProvider(
|
|
308
|
+
selector: DocumentSelector,
|
|
309
|
+
provider: DocumentSemanticTokensProvider,
|
|
310
|
+
legend: SemanticTokensLegend,
|
|
311
|
+
): Disposable {
|
|
312
|
+
return {
|
|
313
|
+
dispose: () => {
|
|
314
|
+
return;
|
|
315
|
+
},
|
|
316
|
+
};
|
|
317
|
+
}
|
|
318
|
+
registerDocumentRangeSemanticTokensProvider(
|
|
319
|
+
selector: DocumentSelector,
|
|
320
|
+
provider: DocumentRangeSemanticTokensProvider,
|
|
321
|
+
legend: SemanticTokensLegend,
|
|
322
|
+
): Disposable {
|
|
323
|
+
return {
|
|
324
|
+
dispose: () => {
|
|
325
|
+
return;
|
|
326
|
+
},
|
|
327
|
+
};
|
|
328
|
+
}
|
|
329
|
+
registerSignatureHelpProvider(
|
|
330
|
+
selector: DocumentSelector,
|
|
331
|
+
provider: SignatureHelpProvider,
|
|
332
|
+
firstItem?: string | SignatureHelpProviderMetadata,
|
|
333
|
+
...remaining: string[]
|
|
334
|
+
): Disposable {
|
|
335
|
+
return {
|
|
336
|
+
dispose: () => {
|
|
337
|
+
return;
|
|
338
|
+
},
|
|
339
|
+
};
|
|
340
|
+
}
|
|
341
|
+
registerCompletionItemProvider(
|
|
342
|
+
selector: DocumentSelector,
|
|
343
|
+
provider: CompletionItemProvider,
|
|
344
|
+
...triggerCharacters: string[]
|
|
345
|
+
): Disposable {
|
|
346
|
+
const completionProvider = this.createCompletionProvider(
|
|
347
|
+
provider,
|
|
348
|
+
...triggerCharacters,
|
|
349
|
+
);
|
|
350
|
+
return monaco.languages.registerCompletionItemProvider(
|
|
351
|
+
selector,
|
|
352
|
+
completionProvider,
|
|
353
|
+
);
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
protected createCompletionProvider(
|
|
357
|
+
provider: CompletionItemProvider,
|
|
358
|
+
...triggerCharacters: string[]
|
|
359
|
+
): monaco.languages.CompletionItemProvider {
|
|
360
|
+
return {
|
|
361
|
+
triggerCharacters,
|
|
362
|
+
provideCompletionItems: async (model, position, context, token) => {
|
|
363
|
+
const wordUntil = model.getWordUntilPosition(position);
|
|
364
|
+
const defaultRange = new monaco.Range(
|
|
365
|
+
position.lineNumber,
|
|
366
|
+
wordUntil.startColumn,
|
|
367
|
+
position.lineNumber,
|
|
368
|
+
wordUntil.endColumn,
|
|
369
|
+
);
|
|
370
|
+
const params = this.m2p.asCompletionParams(model, position, context);
|
|
371
|
+
const result = await provider?.provideCompletionItems(
|
|
372
|
+
this.p2c.asTextDcouemnt(params.textDocument),
|
|
373
|
+
this.p2c.asPosition(params.position),
|
|
374
|
+
token,
|
|
375
|
+
{
|
|
376
|
+
triggerCharacter: params.context?.triggerCharacter ?? '.',
|
|
377
|
+
triggerKind:
|
|
378
|
+
params.context?.triggerKind ?? CompletionTriggerKind.TriggerCharacter,
|
|
379
|
+
},
|
|
380
|
+
);
|
|
381
|
+
|
|
382
|
+
if (!result) {
|
|
383
|
+
return;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
let items: CompletionItem[];
|
|
387
|
+
if (Array.isArray(result)) {
|
|
388
|
+
items = result;
|
|
389
|
+
} else {
|
|
390
|
+
items = result.items;
|
|
391
|
+
}
|
|
392
|
+
const res = items.map((item) =>
|
|
393
|
+
this.p2m.asCompletionItem(this.c2p.asCompletionItem(item), defaultRange),
|
|
394
|
+
);
|
|
395
|
+
|
|
396
|
+
return { suggestions: res };
|
|
397
|
+
},
|
|
398
|
+
resolveCompletionItem: provider.resolveCompletionItem
|
|
399
|
+
? async (item, token) => {
|
|
400
|
+
const protocolItem = this.m2p.asCompletionItem(item);
|
|
401
|
+
const codeItem = this.p2c.asCompletionItem(protocolItem);
|
|
402
|
+
const resolvedItem = await provider.resolveCompletionItem?.(
|
|
403
|
+
codeItem,
|
|
404
|
+
token,
|
|
405
|
+
);
|
|
406
|
+
if (resolvedItem) {
|
|
407
|
+
const proItem = this.c2p.asCompletionItem(resolvedItem);
|
|
408
|
+
const resolvedCompletionItem = this.p2m.asCompletionItem(
|
|
409
|
+
proItem,
|
|
410
|
+
item.range,
|
|
411
|
+
);
|
|
412
|
+
overrideWithResolvedValue(item, resolvedCompletionItem);
|
|
413
|
+
}
|
|
414
|
+
return item;
|
|
415
|
+
}
|
|
416
|
+
: undefined,
|
|
417
|
+
};
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
registerInlineCompletionItemProvider(
|
|
421
|
+
selector: DocumentSelector,
|
|
422
|
+
provider: InlineCompletionItemProvider,
|
|
423
|
+
// metadata?: InlineCompletionItemProviderMetadata,
|
|
424
|
+
): Disposable {
|
|
425
|
+
return {
|
|
426
|
+
dispose: () => {
|
|
427
|
+
return;
|
|
428
|
+
},
|
|
429
|
+
};
|
|
430
|
+
}
|
|
431
|
+
registerDocumentLinkProvider(
|
|
432
|
+
selector: DocumentSelector,
|
|
433
|
+
provider: DocumentLinkProvider,
|
|
434
|
+
): Disposable {
|
|
435
|
+
return {
|
|
436
|
+
dispose: () => {
|
|
437
|
+
return;
|
|
438
|
+
},
|
|
439
|
+
};
|
|
440
|
+
}
|
|
441
|
+
registerColorProvider(
|
|
442
|
+
selector: DocumentSelector,
|
|
443
|
+
provider: DocumentColorProvider,
|
|
444
|
+
): Disposable {
|
|
445
|
+
return {
|
|
446
|
+
dispose: () => {
|
|
447
|
+
return;
|
|
448
|
+
},
|
|
449
|
+
};
|
|
450
|
+
}
|
|
451
|
+
registerFoldingRangeProvider(
|
|
452
|
+
selector: DocumentSelector,
|
|
453
|
+
provider: FoldingRangeProvider,
|
|
454
|
+
): Disposable {
|
|
455
|
+
return {
|
|
456
|
+
dispose: () => {
|
|
457
|
+
return;
|
|
458
|
+
},
|
|
459
|
+
};
|
|
460
|
+
}
|
|
461
|
+
registerSelectionRangeProvider(
|
|
462
|
+
selector: DocumentSelector,
|
|
463
|
+
provider: SelectionRangeProvider,
|
|
464
|
+
): Disposable {
|
|
465
|
+
return {
|
|
466
|
+
dispose: () => {
|
|
467
|
+
return;
|
|
468
|
+
},
|
|
469
|
+
};
|
|
470
|
+
}
|
|
471
|
+
registerCallHierarchyProvider(
|
|
472
|
+
selector: DocumentSelector,
|
|
473
|
+
provider: CallHierarchyProvider,
|
|
474
|
+
): Disposable {
|
|
475
|
+
return {
|
|
476
|
+
dispose: () => {
|
|
477
|
+
return;
|
|
478
|
+
},
|
|
479
|
+
};
|
|
480
|
+
}
|
|
481
|
+
registerTypeHierarchyProvider(
|
|
482
|
+
selector: DocumentSelector,
|
|
483
|
+
provider: TypeHierarchyProvider,
|
|
484
|
+
): Disposable {
|
|
485
|
+
return {
|
|
486
|
+
dispose: () => {
|
|
487
|
+
return;
|
|
488
|
+
},
|
|
489
|
+
};
|
|
490
|
+
}
|
|
491
|
+
setLanguageConfiguration(
|
|
492
|
+
language: string,
|
|
493
|
+
configuration: LanguageConfiguration,
|
|
494
|
+
): Disposable {
|
|
495
|
+
return {
|
|
496
|
+
dispose: () => {
|
|
497
|
+
return;
|
|
498
|
+
},
|
|
499
|
+
};
|
|
500
|
+
}
|
|
501
|
+
registerInlayHintsProvider(
|
|
502
|
+
selector: DocumentSelector,
|
|
503
|
+
provider: InlayHintsProvider,
|
|
504
|
+
): Disposable {
|
|
505
|
+
return {
|
|
506
|
+
dispose: () => {
|
|
507
|
+
return;
|
|
508
|
+
},
|
|
509
|
+
};
|
|
510
|
+
}
|
|
511
|
+
}
|