@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,278 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
NotebookDocument,
|
|
3
|
+
WorkspaceFolder,
|
|
4
|
+
WorkspaceFoldersChangeEvent,
|
|
5
|
+
ConfigurationChangeEvent,
|
|
6
|
+
ConfigurationScope,
|
|
7
|
+
WorkspaceConfiguration,
|
|
8
|
+
WorkspaceEdit,
|
|
9
|
+
WorkspaceEditMetadata,
|
|
10
|
+
NotebookDocumentChangeEvent,
|
|
11
|
+
TextDocumentWillSaveEvent,
|
|
12
|
+
TextDocumentChangeEvent,
|
|
13
|
+
FileCreateEvent,
|
|
14
|
+
FileRenameEvent,
|
|
15
|
+
FileWillRenameEvent,
|
|
16
|
+
FileDeleteEvent,
|
|
17
|
+
FileWillDeleteEvent,
|
|
18
|
+
FileWillCreateEvent,
|
|
19
|
+
GlobPattern,
|
|
20
|
+
FileSystemWatcher,
|
|
21
|
+
TextDocument,
|
|
22
|
+
} from 'vscode';
|
|
23
|
+
import type {
|
|
24
|
+
TabGroups,
|
|
25
|
+
TextEditor,
|
|
26
|
+
Event,
|
|
27
|
+
OutputChannel,
|
|
28
|
+
MessageOptions,
|
|
29
|
+
MessageItem,
|
|
30
|
+
Uri,
|
|
31
|
+
ProgressOptions,
|
|
32
|
+
Progress,
|
|
33
|
+
ViewColumn,
|
|
34
|
+
TextDocumentShowOptions,
|
|
35
|
+
CancellationToken,
|
|
36
|
+
} from 'vscode';
|
|
37
|
+
import type {
|
|
38
|
+
DiagnosticCollection,
|
|
39
|
+
DocumentSelector,
|
|
40
|
+
Disposable,
|
|
41
|
+
CallHierarchyProvider,
|
|
42
|
+
CodeActionProviderMetadata,
|
|
43
|
+
CodeActionProvider,
|
|
44
|
+
CompletionItemProvider,
|
|
45
|
+
DocumentSemanticTokensProvider,
|
|
46
|
+
CodeLensProvider,
|
|
47
|
+
DeclarationProvider,
|
|
48
|
+
DefinitionProvider,
|
|
49
|
+
DocumentColorProvider,
|
|
50
|
+
DocumentFormattingEditProvider,
|
|
51
|
+
DocumentHighlightProvider,
|
|
52
|
+
DocumentLinkProvider,
|
|
53
|
+
DocumentRangeFormattingEditProvider,
|
|
54
|
+
DocumentRangeSemanticTokensProvider,
|
|
55
|
+
DocumentSymbolProvider,
|
|
56
|
+
DocumentSymbolProviderMetadata,
|
|
57
|
+
FoldingRangeProvider,
|
|
58
|
+
HoverProvider,
|
|
59
|
+
ImplementationProvider,
|
|
60
|
+
InlineCompletionItemProvider,
|
|
61
|
+
InlineValuesProvider,
|
|
62
|
+
LanguageConfiguration,
|
|
63
|
+
LinkedEditingRangeProvider,
|
|
64
|
+
OnTypeFormattingEditProvider,
|
|
65
|
+
ReferenceProvider,
|
|
66
|
+
RenameProvider,
|
|
67
|
+
SelectionRangeProvider,
|
|
68
|
+
SemanticTokensLegend,
|
|
69
|
+
SignatureHelpProvider,
|
|
70
|
+
SignatureHelpProviderMetadata,
|
|
71
|
+
TypeDefinitionProvider,
|
|
72
|
+
TypeHierarchyProvider,
|
|
73
|
+
WorkspaceSymbolProvider,
|
|
74
|
+
InlayHintsProvider,
|
|
75
|
+
FileSystem,
|
|
76
|
+
} from 'vscode';
|
|
77
|
+
|
|
78
|
+
export const ILibroWorkspace = Symbol('ILibroWorkspace');
|
|
79
|
+
export interface ILibroWorkspace {
|
|
80
|
+
workspaceFolders: WorkspaceFolder[] | undefined;
|
|
81
|
+
getWorkspaceFolder(uri: Uri): WorkspaceFolder | undefined;
|
|
82
|
+
notebookDocuments: NotebookDocument[];
|
|
83
|
+
textDocuments: TextDocument[];
|
|
84
|
+
fs: FileSystem;
|
|
85
|
+
onDidChangeWorkspaceFolders: Event<WorkspaceFoldersChangeEvent>;
|
|
86
|
+
onDidChangeConfiguration: Event<ConfigurationChangeEvent>;
|
|
87
|
+
getConfiguration(
|
|
88
|
+
section?: string | undefined,
|
|
89
|
+
scope?: ConfigurationScope | null | undefined,
|
|
90
|
+
): WorkspaceConfiguration;
|
|
91
|
+
applyEdit(edit: WorkspaceEdit, metadata?: WorkspaceEditMetadata): Thenable<boolean>;
|
|
92
|
+
onDidOpenNotebookDocument: Event<NotebookDocument>;
|
|
93
|
+
onDidSaveNotebookDocument: Event<NotebookDocument>;
|
|
94
|
+
onDidCloseNotebookDocument: Event<NotebookDocument>;
|
|
95
|
+
onDidChangeNotebookDocument: Event<NotebookDocumentChangeEvent>;
|
|
96
|
+
onDidOpenTextDocument: Event<TextDocument>;
|
|
97
|
+
onDidSaveTextDocument: Event<TextDocument>;
|
|
98
|
+
onWillSaveTextDocument: Event<TextDocumentWillSaveEvent>;
|
|
99
|
+
onDidCloseTextDocument: Event<TextDocument>;
|
|
100
|
+
onDidChangeTextDocument: Event<TextDocumentChangeEvent>;
|
|
101
|
+
onDidCreateFiles: Event<FileCreateEvent>;
|
|
102
|
+
onDidRenameFiles: Event<FileRenameEvent>;
|
|
103
|
+
onWillRenameFiles: Event<FileWillRenameEvent>;
|
|
104
|
+
onDidDeleteFiles: Event<FileDeleteEvent>;
|
|
105
|
+
onWillDeleteFiles: Event<FileWillDeleteEvent>;
|
|
106
|
+
onWillCreateFiles: Event<FileWillCreateEvent>;
|
|
107
|
+
createFileSystemWatcher(
|
|
108
|
+
pattern: GlobPattern,
|
|
109
|
+
optionsOrIgnoreCreate: any,
|
|
110
|
+
ignoreChange?: boolean,
|
|
111
|
+
ignoreDelete?: boolean,
|
|
112
|
+
): FileSystemWatcher;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export type MsgFunc = <T extends MessageOptions | string | MessageItem>(
|
|
116
|
+
message: string,
|
|
117
|
+
...items: T[]
|
|
118
|
+
) => Thenable<T>;
|
|
119
|
+
|
|
120
|
+
export const ILibroWindow = Symbol('ILibroWindow');
|
|
121
|
+
export interface ILibroWindow {
|
|
122
|
+
tabGroups: TabGroups;
|
|
123
|
+
activeTextEditor: TextEditor | undefined;
|
|
124
|
+
onDidChangeActiveTextEditor: Event<TextEditor | undefined>;
|
|
125
|
+
createOutputChannel: (
|
|
126
|
+
name: string,
|
|
127
|
+
options?: string | { log: true },
|
|
128
|
+
) => OutputChannel;
|
|
129
|
+
showErrorMessage: MsgFunc;
|
|
130
|
+
showWarningMessage: MsgFunc;
|
|
131
|
+
showInformationMessage: MsgFunc;
|
|
132
|
+
showTextDocument(
|
|
133
|
+
documentOrUri: TextDocument | Uri,
|
|
134
|
+
columnOrOptions?: ViewColumn | TextDocumentShowOptions,
|
|
135
|
+
preserveFocus?: boolean,
|
|
136
|
+
): Promise<TextEditor>;
|
|
137
|
+
withProgress<R>(
|
|
138
|
+
options: ProgressOptions,
|
|
139
|
+
task: (
|
|
140
|
+
progress: Progress<{ message?: string; worked?: number }>,
|
|
141
|
+
token: CancellationToken,
|
|
142
|
+
) => Thenable<R>,
|
|
143
|
+
): void;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
export const IMonacoLanguages = Symbol('IMonacoLanguages');
|
|
147
|
+
export interface IMonacoLanguages {
|
|
148
|
+
createDiagnosticCollection(name?: string): DiagnosticCollection;
|
|
149
|
+
match(selector: DocumentSelector, document: TextDocument): number;
|
|
150
|
+
|
|
151
|
+
registerCodeActionsProvider(
|
|
152
|
+
selector: DocumentSelector,
|
|
153
|
+
provider: CodeActionProvider,
|
|
154
|
+
metadata?: CodeActionProviderMetadata,
|
|
155
|
+
): Disposable;
|
|
156
|
+
registerCodeLensProvider(
|
|
157
|
+
selector: DocumentSelector,
|
|
158
|
+
provider: CodeLensProvider,
|
|
159
|
+
): Disposable;
|
|
160
|
+
registerDefinitionProvider(
|
|
161
|
+
selector: DocumentSelector,
|
|
162
|
+
provider: DefinitionProvider,
|
|
163
|
+
): Disposable;
|
|
164
|
+
registerDeclarationProvider(
|
|
165
|
+
selector: DocumentSelector,
|
|
166
|
+
provider: DeclarationProvider,
|
|
167
|
+
): Disposable;
|
|
168
|
+
registerImplementationProvider(
|
|
169
|
+
selector: DocumentSelector,
|
|
170
|
+
provider: ImplementationProvider,
|
|
171
|
+
): Disposable;
|
|
172
|
+
registerTypeDefinitionProvider(
|
|
173
|
+
selector: DocumentSelector,
|
|
174
|
+
provider: TypeDefinitionProvider,
|
|
175
|
+
): Disposable;
|
|
176
|
+
registerHoverProvider(
|
|
177
|
+
selector: DocumentSelector,
|
|
178
|
+
provider: HoverProvider,
|
|
179
|
+
): Disposable;
|
|
180
|
+
registerInlineValuesProvider(
|
|
181
|
+
selector: DocumentSelector,
|
|
182
|
+
provider: InlineValuesProvider,
|
|
183
|
+
): Disposable;
|
|
184
|
+
registerDocumentHighlightProvider(
|
|
185
|
+
selector: DocumentSelector,
|
|
186
|
+
provider: DocumentHighlightProvider,
|
|
187
|
+
): Disposable;
|
|
188
|
+
registerLinkedEditingRangeProvider(
|
|
189
|
+
selector: DocumentSelector,
|
|
190
|
+
provider: LinkedEditingRangeProvider,
|
|
191
|
+
): Disposable;
|
|
192
|
+
registerReferenceProvider(
|
|
193
|
+
selector: DocumentSelector,
|
|
194
|
+
provider: ReferenceProvider,
|
|
195
|
+
): Disposable;
|
|
196
|
+
registerRenameProvider(
|
|
197
|
+
selector: DocumentSelector,
|
|
198
|
+
provider: RenameProvider,
|
|
199
|
+
): Disposable;
|
|
200
|
+
registerDocumentSymbolProvider(
|
|
201
|
+
selector: DocumentSelector,
|
|
202
|
+
provider: DocumentSymbolProvider,
|
|
203
|
+
metadata?: DocumentSymbolProviderMetadata,
|
|
204
|
+
): Disposable;
|
|
205
|
+
registerWorkspaceSymbolProvider(provider: WorkspaceSymbolProvider): Disposable;
|
|
206
|
+
registerDocumentFormattingEditProvider(
|
|
207
|
+
selector: DocumentSelector,
|
|
208
|
+
provider: DocumentFormattingEditProvider,
|
|
209
|
+
): Disposable;
|
|
210
|
+
registerDocumentRangeFormattingEditProvider(
|
|
211
|
+
selector: DocumentSelector,
|
|
212
|
+
provider: DocumentRangeFormattingEditProvider,
|
|
213
|
+
): Disposable;
|
|
214
|
+
registerOnTypeFormattingEditProvider(
|
|
215
|
+
selector: DocumentSelector,
|
|
216
|
+
provider: OnTypeFormattingEditProvider,
|
|
217
|
+
firstTriggerCharacter: string,
|
|
218
|
+
...moreTriggerCharacters: string[]
|
|
219
|
+
): Disposable;
|
|
220
|
+
registerDocumentSemanticTokensProvider(
|
|
221
|
+
selector: DocumentSelector,
|
|
222
|
+
provider: DocumentSemanticTokensProvider,
|
|
223
|
+
legend: SemanticTokensLegend,
|
|
224
|
+
): Disposable;
|
|
225
|
+
registerDocumentRangeSemanticTokensProvider(
|
|
226
|
+
selector: DocumentSelector,
|
|
227
|
+
provider: DocumentRangeSemanticTokensProvider,
|
|
228
|
+
legend: SemanticTokensLegend,
|
|
229
|
+
): Disposable;
|
|
230
|
+
registerSignatureHelpProvider(
|
|
231
|
+
selector: DocumentSelector,
|
|
232
|
+
provider: SignatureHelpProvider,
|
|
233
|
+
firstItem?: string | SignatureHelpProviderMetadata,
|
|
234
|
+
...remaining: string[]
|
|
235
|
+
): Disposable;
|
|
236
|
+
registerCompletionItemProvider(
|
|
237
|
+
selector: DocumentSelector,
|
|
238
|
+
provider: CompletionItemProvider,
|
|
239
|
+
...triggerCharacters: string[]
|
|
240
|
+
): Disposable;
|
|
241
|
+
registerInlineCompletionItemProvider(
|
|
242
|
+
selector: DocumentSelector,
|
|
243
|
+
provider: InlineCompletionItemProvider,
|
|
244
|
+
// metadata?: InlineCompletionItemProviderMetadata,
|
|
245
|
+
): Disposable;
|
|
246
|
+
registerDocumentLinkProvider(
|
|
247
|
+
selector: DocumentSelector,
|
|
248
|
+
provider: DocumentLinkProvider,
|
|
249
|
+
): Disposable;
|
|
250
|
+
registerColorProvider(
|
|
251
|
+
selector: DocumentSelector,
|
|
252
|
+
provider: DocumentColorProvider,
|
|
253
|
+
): Disposable;
|
|
254
|
+
registerFoldingRangeProvider(
|
|
255
|
+
selector: DocumentSelector,
|
|
256
|
+
provider: FoldingRangeProvider,
|
|
257
|
+
): Disposable;
|
|
258
|
+
registerSelectionRangeProvider(
|
|
259
|
+
selector: DocumentSelector,
|
|
260
|
+
provider: SelectionRangeProvider,
|
|
261
|
+
): Disposable;
|
|
262
|
+
registerCallHierarchyProvider(
|
|
263
|
+
selector: DocumentSelector,
|
|
264
|
+
provider: CallHierarchyProvider,
|
|
265
|
+
): Disposable;
|
|
266
|
+
registerTypeHierarchyProvider(
|
|
267
|
+
selector: DocumentSelector,
|
|
268
|
+
provider: TypeHierarchyProvider,
|
|
269
|
+
): Disposable;
|
|
270
|
+
setLanguageConfiguration(
|
|
271
|
+
language: string,
|
|
272
|
+
configuration: LanguageConfiguration,
|
|
273
|
+
): Disposable;
|
|
274
|
+
registerInlayHintsProvider(
|
|
275
|
+
selector: DocumentSelector,
|
|
276
|
+
provider: InlayHintsProvider,
|
|
277
|
+
): Disposable;
|
|
278
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
declare module '@difizen/monaco-editor-core/esm/vs/editor/common/languageSelector.js' {
|
|
2
|
+
function score(
|
|
3
|
+
selector: LanguageSelector | undefined,
|
|
4
|
+
candidateUri: URI,
|
|
5
|
+
candidateLanguage: string,
|
|
6
|
+
candidateIsSynchronized: boolean,
|
|
7
|
+
candidateNotebookUri: URI | undefined,
|
|
8
|
+
candidateNotebookType: string | undefined,
|
|
9
|
+
): number;
|
|
10
|
+
}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import type { Syringe } from '@difizen/mana-app';
|
|
2
|
+
import { Emitter } from '@difizen/mana-common';
|
|
3
|
+
import * as monaco from '@difizen/monaco-editor-core';
|
|
4
|
+
import type { Disposable } from 'vscode';
|
|
5
|
+
import { URI } from 'vscode-uri';
|
|
6
|
+
|
|
7
|
+
import { ILibroWindow, ILibroWorkspace, IMonacoLanguages } from './services.js';
|
|
8
|
+
|
|
9
|
+
export const CompletionItemTag = monaco.languages.CompletionItemTag;
|
|
10
|
+
export type CompletionItemTag = monaco.languages.CompletionItemTag;
|
|
11
|
+
export const SignatureHelpTriggerKind = monaco.languages.SignatureHelpTriggerKind;
|
|
12
|
+
export type SignatureHelpTriggerKind = monaco.languages.SignatureHelpTriggerKind;
|
|
13
|
+
export const CompletionTriggerKind = monaco.languages.CompletionTriggerKind;
|
|
14
|
+
export type CompletionTriggerKind = monaco.languages.CompletionTriggerKind;
|
|
15
|
+
|
|
16
|
+
export const lspEnv: {
|
|
17
|
+
libroContainer: Syringe.Container;
|
|
18
|
+
} = {
|
|
19
|
+
libroContainer: {} as Syringe.Container,
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export let workspace: ILibroWorkspace = undefined as any;
|
|
23
|
+
export let window: ILibroWindow = undefined as any;
|
|
24
|
+
export let languages: IMonacoLanguages = undefined as any;
|
|
25
|
+
|
|
26
|
+
export const setupLspEnv = (container: Syringe.Container) => {
|
|
27
|
+
lspEnv.libroContainer = container;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export const initLspEnv = () => {
|
|
31
|
+
workspace = lspEnv.libroContainer.get(ILibroWorkspace);
|
|
32
|
+
window = lspEnv.libroContainer.get(ILibroWindow);
|
|
33
|
+
languages = lspEnv.libroContainer.get(IMonacoLanguages);
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export class Uri extends URI {}
|
|
37
|
+
|
|
38
|
+
export const version = '1.85.1';
|
|
39
|
+
|
|
40
|
+
class VscodeEnv {
|
|
41
|
+
language = 'python';
|
|
42
|
+
appName = 'libro';
|
|
43
|
+
openExternal(target: Uri): Thenable<boolean> {
|
|
44
|
+
return Promise.resolve(true);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export const env = new VscodeEnv();
|
|
49
|
+
|
|
50
|
+
export class CancellationTokenSource extends monaco.CancellationTokenSource {}
|
|
51
|
+
|
|
52
|
+
const canceledName = 'Canceled';
|
|
53
|
+
export class CancellationError extends Error {
|
|
54
|
+
constructor() {
|
|
55
|
+
super(canceledName);
|
|
56
|
+
this.name = this.message;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
class Commands {
|
|
61
|
+
registerCommand(
|
|
62
|
+
command: string,
|
|
63
|
+
callback: (...args: any[]) => any,
|
|
64
|
+
thisArg?: any,
|
|
65
|
+
): Disposable {
|
|
66
|
+
return {
|
|
67
|
+
dispose() {
|
|
68
|
+
return;
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export const commands = new Commands();
|
|
75
|
+
|
|
76
|
+
export { Emitter as EventEmitter };
|
|
77
|
+
|
|
78
|
+
export class TabInputText {
|
|
79
|
+
constructor(readonly uri: Uri) {}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export class TabInputTextDiff {
|
|
83
|
+
constructor(
|
|
84
|
+
readonly original: Uri,
|
|
85
|
+
readonly modified: Uri,
|
|
86
|
+
) {}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export class TabInputCustom {
|
|
90
|
+
constructor(
|
|
91
|
+
readonly uri: Uri,
|
|
92
|
+
readonly viewType: string,
|
|
93
|
+
) {}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export enum FileType {
|
|
97
|
+
/**
|
|
98
|
+
* File is unknown (neither file, directory nor symbolic link).
|
|
99
|
+
*/
|
|
100
|
+
Unknown = 0,
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* File is a normal file.
|
|
104
|
+
*/
|
|
105
|
+
File = 1,
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* File is a directory.
|
|
109
|
+
*/
|
|
110
|
+
Directory = 2,
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* File is a symbolic link.
|
|
114
|
+
*
|
|
115
|
+
* Note: even when the file is a symbolic link, you can test for
|
|
116
|
+
* `FileType.File` and `FileType.Directory` to know the type of
|
|
117
|
+
* the target the link points to.
|
|
118
|
+
*/
|
|
119
|
+
SymbolicLink = 64,
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export * from './extHostTypes.js';
|
|
@@ -0,0 +1,236 @@
|
|
|
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
|
+
InitializeParams,
|
|
9
|
+
CancellationToken,
|
|
10
|
+
ServerCapabilities,
|
|
11
|
+
WorkspaceFolder,
|
|
12
|
+
DidChangeWorkspaceFoldersParams,
|
|
13
|
+
RegistrationType,
|
|
14
|
+
} from '@difizen/vscode-languageserver-protocol';
|
|
15
|
+
import {
|
|
16
|
+
WorkspaceFoldersRequest,
|
|
17
|
+
DidChangeWorkspaceFoldersNotification,
|
|
18
|
+
} from '@difizen/vscode-languageserver-protocol';
|
|
19
|
+
import type {
|
|
20
|
+
Disposable,
|
|
21
|
+
WorkspaceFolder as VWorkspaceFolder,
|
|
22
|
+
WorkspaceFoldersChangeEvent as VWorkspaceFoldersChangeEvent,
|
|
23
|
+
} from 'vscode';
|
|
24
|
+
|
|
25
|
+
import type {
|
|
26
|
+
DynamicFeature,
|
|
27
|
+
RegistrationData,
|
|
28
|
+
FeatureClient,
|
|
29
|
+
NextSignature,
|
|
30
|
+
FeatureState,
|
|
31
|
+
} from './features.js';
|
|
32
|
+
import * as UUID from './utils/uuid.js';
|
|
33
|
+
import { workspace } from './vscodeAdaptor/vscodeAdaptor.js';
|
|
34
|
+
|
|
35
|
+
function access<T, K extends keyof T>(target: T | undefined, key: K): T[K] | undefined {
|
|
36
|
+
if (target === undefined || target === null) {
|
|
37
|
+
return undefined;
|
|
38
|
+
}
|
|
39
|
+
return target[key];
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export function arrayDiff<T>(left: ReadonlyArray<T>, right: ReadonlyArray<T>): T[] {
|
|
43
|
+
return left.filter((element) => right.indexOf(element) < 0);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export type WorkspaceFolderMiddleware = {
|
|
47
|
+
workspaceFolders?: WorkspaceFoldersRequest.MiddlewareSignature;
|
|
48
|
+
didChangeWorkspaceFolders?: NextSignature<
|
|
49
|
+
VWorkspaceFoldersChangeEvent,
|
|
50
|
+
Promise<void>
|
|
51
|
+
>;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
type WorkspaceFolderWorkspaceMiddleware = {
|
|
55
|
+
workspace?: WorkspaceFolderMiddleware;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export class WorkspaceFoldersFeature implements DynamicFeature<void> {
|
|
59
|
+
private readonly _client: FeatureClient<WorkspaceFolderWorkspaceMiddleware>;
|
|
60
|
+
private readonly _listeners: Map<string, Disposable>;
|
|
61
|
+
private _initialFolders: ReadonlyArray<VWorkspaceFolder> | undefined;
|
|
62
|
+
|
|
63
|
+
constructor(client: FeatureClient<WorkspaceFolderWorkspaceMiddleware>) {
|
|
64
|
+
this._client = client;
|
|
65
|
+
this._listeners = new Map();
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
getState(): FeatureState {
|
|
69
|
+
return {
|
|
70
|
+
kind: 'workspace',
|
|
71
|
+
id: this.registrationType.method,
|
|
72
|
+
registrations: this._listeners.size > 0,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
public get registrationType(): RegistrationType<void> {
|
|
77
|
+
return DidChangeWorkspaceFoldersNotification.type;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
public fillInitializeParams(params: InitializeParams): void {
|
|
81
|
+
const folders = workspace.workspaceFolders;
|
|
82
|
+
this.initializeWithFolders(folders);
|
|
83
|
+
|
|
84
|
+
if (folders === void 0) {
|
|
85
|
+
params.workspaceFolders = null;
|
|
86
|
+
} else {
|
|
87
|
+
params.workspaceFolders = folders.map((folder) => this.asProtocol(folder));
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
protected initializeWithFolders(
|
|
92
|
+
currentWorkspaceFolders: ReadonlyArray<VWorkspaceFolder> | undefined,
|
|
93
|
+
) {
|
|
94
|
+
this._initialFolders = currentWorkspaceFolders;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
public fillClientCapabilities(capabilities: ClientCapabilities): void {
|
|
98
|
+
capabilities.workspace = capabilities.workspace || {};
|
|
99
|
+
capabilities.workspace.workspaceFolders = true;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
public initialize(capabilities: ServerCapabilities): void {
|
|
103
|
+
const client = this._client;
|
|
104
|
+
client.onRequest(WorkspaceFoldersRequest.type, (token: CancellationToken) => {
|
|
105
|
+
const workspaceFolders: WorkspaceFoldersRequest.HandlerSignature = () => {
|
|
106
|
+
const folders = workspace.workspaceFolders;
|
|
107
|
+
if (folders === undefined) {
|
|
108
|
+
return null;
|
|
109
|
+
}
|
|
110
|
+
const result: WorkspaceFolder[] = folders.map((folder) => {
|
|
111
|
+
return this.asProtocol(folder);
|
|
112
|
+
});
|
|
113
|
+
return result;
|
|
114
|
+
};
|
|
115
|
+
const middleware = client.middleware.workspace;
|
|
116
|
+
return middleware && middleware.workspaceFolders
|
|
117
|
+
? middleware.workspaceFolders(token, workspaceFolders)
|
|
118
|
+
: workspaceFolders(token);
|
|
119
|
+
});
|
|
120
|
+
const value = access(
|
|
121
|
+
access(access(capabilities, 'workspace'), 'workspaceFolders'),
|
|
122
|
+
'changeNotifications',
|
|
123
|
+
);
|
|
124
|
+
let id: string | undefined;
|
|
125
|
+
if (typeof value === 'string') {
|
|
126
|
+
id = value;
|
|
127
|
+
} else if (value === true) {
|
|
128
|
+
id = UUID.generateUuid();
|
|
129
|
+
}
|
|
130
|
+
if (id) {
|
|
131
|
+
this.register({ id: id, registerOptions: undefined });
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
protected sendInitialEvent(
|
|
136
|
+
currentWorkspaceFolders: ReadonlyArray<VWorkspaceFolder> | undefined,
|
|
137
|
+
) {
|
|
138
|
+
let promise: Promise<void> | undefined;
|
|
139
|
+
if (this._initialFolders && currentWorkspaceFolders) {
|
|
140
|
+
const removed: VWorkspaceFolder[] = arrayDiff(
|
|
141
|
+
this._initialFolders,
|
|
142
|
+
currentWorkspaceFolders,
|
|
143
|
+
);
|
|
144
|
+
const added: VWorkspaceFolder[] = arrayDiff(
|
|
145
|
+
currentWorkspaceFolders,
|
|
146
|
+
this._initialFolders,
|
|
147
|
+
);
|
|
148
|
+
if (added.length > 0 || removed.length > 0) {
|
|
149
|
+
promise = this.doSendEvent(added, removed);
|
|
150
|
+
}
|
|
151
|
+
} else if (this._initialFolders) {
|
|
152
|
+
promise = this.doSendEvent([], this._initialFolders);
|
|
153
|
+
} else if (currentWorkspaceFolders) {
|
|
154
|
+
promise = this.doSendEvent(currentWorkspaceFolders, []);
|
|
155
|
+
}
|
|
156
|
+
if (promise !== undefined) {
|
|
157
|
+
promise.catch((error) => {
|
|
158
|
+
this._client.error(
|
|
159
|
+
`Sending notification ${DidChangeWorkspaceFoldersNotification.type.method} failed`,
|
|
160
|
+
error,
|
|
161
|
+
);
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
private doSendEvent(
|
|
167
|
+
addedFolders: ReadonlyArray<VWorkspaceFolder>,
|
|
168
|
+
removedFolders: ReadonlyArray<VWorkspaceFolder>,
|
|
169
|
+
): Promise<void> {
|
|
170
|
+
const params: DidChangeWorkspaceFoldersParams = {
|
|
171
|
+
event: {
|
|
172
|
+
added: addedFolders.map((folder) => this.asProtocol(folder)),
|
|
173
|
+
removed: removedFolders.map((folder) => this.asProtocol(folder)),
|
|
174
|
+
},
|
|
175
|
+
};
|
|
176
|
+
return this._client.sendNotification(
|
|
177
|
+
DidChangeWorkspaceFoldersNotification.type,
|
|
178
|
+
params,
|
|
179
|
+
);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
public register(data: RegistrationData<undefined>): void {
|
|
183
|
+
const id = data.id;
|
|
184
|
+
const client = this._client;
|
|
185
|
+
const disposable = workspace.onDidChangeWorkspaceFolders((event) => {
|
|
186
|
+
const didChangeWorkspaceFolders = (
|
|
187
|
+
event: VWorkspaceFoldersChangeEvent,
|
|
188
|
+
): Promise<void> => {
|
|
189
|
+
return this.doSendEvent(event.added, event.removed);
|
|
190
|
+
};
|
|
191
|
+
const middleware = client.middleware.workspace;
|
|
192
|
+
const promise =
|
|
193
|
+
middleware && middleware.didChangeWorkspaceFolders
|
|
194
|
+
? middleware.didChangeWorkspaceFolders(event, didChangeWorkspaceFolders)
|
|
195
|
+
: didChangeWorkspaceFolders(event);
|
|
196
|
+
promise.catch((error) => {
|
|
197
|
+
this._client.error(
|
|
198
|
+
`Sending notification ${DidChangeWorkspaceFoldersNotification.type.method} failed`,
|
|
199
|
+
error,
|
|
200
|
+
);
|
|
201
|
+
});
|
|
202
|
+
});
|
|
203
|
+
this._listeners.set(id, disposable);
|
|
204
|
+
this.sendInitialEvent(workspace.workspaceFolders);
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
public unregister(id: string): void {
|
|
208
|
+
const disposable = this._listeners.get(id);
|
|
209
|
+
if (disposable === void 0) {
|
|
210
|
+
return;
|
|
211
|
+
}
|
|
212
|
+
this._listeners.delete(id);
|
|
213
|
+
disposable.dispose();
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
public clear(): void {
|
|
217
|
+
for (const disposable of this._listeners.values()) {
|
|
218
|
+
disposable.dispose();
|
|
219
|
+
}
|
|
220
|
+
this._listeners.clear();
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
private asProtocol(workspaceFolder: VWorkspaceFolder): WorkspaceFolder;
|
|
224
|
+
private asProtocol(workspaceFolder: undefined): null;
|
|
225
|
+
private asProtocol(
|
|
226
|
+
workspaceFolder: VWorkspaceFolder | undefined,
|
|
227
|
+
): WorkspaceFolder | null {
|
|
228
|
+
if (workspaceFolder === void 0) {
|
|
229
|
+
return null;
|
|
230
|
+
}
|
|
231
|
+
return {
|
|
232
|
+
uri: this._client.code2ProtocolConverter.asUri(workspaceFolder.uri),
|
|
233
|
+
name: workspaceFolder.name,
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
}
|