@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,261 @@
|
|
|
1
|
+
import type { LibroView } from '@difizen/libro-core';
|
|
2
|
+
import { LibroService } from '@difizen/libro-core';
|
|
3
|
+
import { inject, noop, singleton } from '@difizen/mana-app';
|
|
4
|
+
import type {
|
|
5
|
+
NotebookDocument,
|
|
6
|
+
WorkspaceFolder,
|
|
7
|
+
Event,
|
|
8
|
+
WorkspaceFoldersChangeEvent,
|
|
9
|
+
ConfigurationChangeEvent,
|
|
10
|
+
ConfigurationScope,
|
|
11
|
+
WorkspaceConfiguration,
|
|
12
|
+
WorkspaceEdit,
|
|
13
|
+
WorkspaceEditMetadata,
|
|
14
|
+
NotebookDocumentChangeEvent,
|
|
15
|
+
TextDocumentWillSaveEvent,
|
|
16
|
+
TextDocumentChangeEvent,
|
|
17
|
+
FileCreateEvent,
|
|
18
|
+
FileRenameEvent,
|
|
19
|
+
FileWillRenameEvent,
|
|
20
|
+
FileDeleteEvent,
|
|
21
|
+
FileWillDeleteEvent,
|
|
22
|
+
FileWillCreateEvent,
|
|
23
|
+
GlobPattern,
|
|
24
|
+
FileSystemWatcher,
|
|
25
|
+
Uri,
|
|
26
|
+
TextDocument,
|
|
27
|
+
FileSystem,
|
|
28
|
+
} from 'vscode';
|
|
29
|
+
|
|
30
|
+
import { l2c } from './convertor.js';
|
|
31
|
+
import { Range } from './extHostTypes.js';
|
|
32
|
+
import { LibroFileWatcher } from './fileWatcher.js';
|
|
33
|
+
import { LibroFS } from './libro-fs.js';
|
|
34
|
+
import { ILibroWorkspace } from './services.js';
|
|
35
|
+
import { unsupported } from './util.js';
|
|
36
|
+
|
|
37
|
+
@singleton({ token: ILibroWorkspace })
|
|
38
|
+
export class LibroWorkspace implements ILibroWorkspace {
|
|
39
|
+
@inject(LibroService) private readonly libroService: LibroService;
|
|
40
|
+
|
|
41
|
+
isValidNotebook(view: LibroView): boolean {
|
|
42
|
+
if ((view as any).lspEnabled === true) {
|
|
43
|
+
return true;
|
|
44
|
+
}
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
workspaceFolders: WorkspaceFolder[] | undefined = [];
|
|
49
|
+
getWorkspaceFolder(uri: Uri): WorkspaceFolder | undefined {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
get notebookDocuments(): NotebookDocument[] {
|
|
53
|
+
return Array.from(this.libroService.getViewCache().values()).map(
|
|
54
|
+
l2c.asNotebookDocument,
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
textDocuments: TextDocument[] = [];
|
|
58
|
+
fs: FileSystem = new LibroFS();
|
|
59
|
+
onDidChangeWorkspaceFolders: Event<WorkspaceFoldersChangeEvent> = () => {
|
|
60
|
+
return {
|
|
61
|
+
dispose: () => {
|
|
62
|
+
return;
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
onDidChangeConfiguration: Event<ConfigurationChangeEvent> = () => {
|
|
67
|
+
return {
|
|
68
|
+
dispose: () => {
|
|
69
|
+
return;
|
|
70
|
+
},
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
getConfiguration(
|
|
74
|
+
section?: string | undefined,
|
|
75
|
+
scope?: ConfigurationScope | null | undefined,
|
|
76
|
+
): WorkspaceConfiguration {
|
|
77
|
+
return {
|
|
78
|
+
get: noop,
|
|
79
|
+
has: () => false,
|
|
80
|
+
update: async () => {
|
|
81
|
+
//noop
|
|
82
|
+
},
|
|
83
|
+
inspect: noop,
|
|
84
|
+
} as WorkspaceConfiguration;
|
|
85
|
+
}
|
|
86
|
+
applyEdit(edit: WorkspaceEdit, metadata?: WorkspaceEditMetadata): Thenable<boolean> {
|
|
87
|
+
return Promise.resolve(true);
|
|
88
|
+
}
|
|
89
|
+
onDidOpenNotebookDocument: Event<NotebookDocument> = (
|
|
90
|
+
listener,
|
|
91
|
+
thisArgs,
|
|
92
|
+
disposables,
|
|
93
|
+
) => {
|
|
94
|
+
const disposable = this.libroService.onNotebookViewCreated((libroView) => {
|
|
95
|
+
if (!this.isValidNotebook(libroView)) {
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
listener(l2c.asNotebookDocument(libroView));
|
|
99
|
+
});
|
|
100
|
+
disposables?.push(disposable);
|
|
101
|
+
return disposable;
|
|
102
|
+
};
|
|
103
|
+
onDidSaveNotebookDocument: Event<NotebookDocument> = (
|
|
104
|
+
listener,
|
|
105
|
+
thisArgs,
|
|
106
|
+
disposables,
|
|
107
|
+
) => {
|
|
108
|
+
const disposable = this.libroService.onNotebookViewSaved((libroView) => {
|
|
109
|
+
if (!this.isValidNotebook(libroView)) {
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
listener(l2c.asNotebookDocument(libroView));
|
|
113
|
+
});
|
|
114
|
+
disposables?.push(disposable);
|
|
115
|
+
return disposable;
|
|
116
|
+
};
|
|
117
|
+
onDidCloseNotebookDocument: Event<NotebookDocument> = (
|
|
118
|
+
listener,
|
|
119
|
+
thisArgs,
|
|
120
|
+
disposables,
|
|
121
|
+
) => {
|
|
122
|
+
const disposable = this.libroService.onNotebookViewClosed((libroView) => {
|
|
123
|
+
if (!this.isValidNotebook(libroView)) {
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
listener(l2c.asNotebookDocument(libroView));
|
|
127
|
+
});
|
|
128
|
+
disposables?.push(disposable);
|
|
129
|
+
return disposable;
|
|
130
|
+
};
|
|
131
|
+
onDidChangeNotebookDocument: Event<NotebookDocumentChangeEvent> = (
|
|
132
|
+
listener,
|
|
133
|
+
thisArgs,
|
|
134
|
+
disposables,
|
|
135
|
+
) => {
|
|
136
|
+
const disposable = this.libroService.onNotebookViewChanged((e) => {
|
|
137
|
+
if (!this.isValidNotebook(e.libroView)) {
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
listener({
|
|
141
|
+
notebook: l2c.asNotebookDocument(e.libroView),
|
|
142
|
+
metadata: {},
|
|
143
|
+
cellChanges: [],
|
|
144
|
+
contentChanges: e.contentChanges.map((item) => {
|
|
145
|
+
return {
|
|
146
|
+
range: {
|
|
147
|
+
start: item.range.start,
|
|
148
|
+
end: item.range.end,
|
|
149
|
+
isEmpty: item.range.start === item.range.end,
|
|
150
|
+
with: unsupported,
|
|
151
|
+
},
|
|
152
|
+
addedCells: item.addedCells.map(l2c.asNotebookCell),
|
|
153
|
+
removedCells: item.removedCells.map(l2c.asNotebookCell),
|
|
154
|
+
};
|
|
155
|
+
}),
|
|
156
|
+
});
|
|
157
|
+
});
|
|
158
|
+
disposables?.push(disposable);
|
|
159
|
+
return disposable;
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
onDidOpenTextDocument: Event<TextDocument> = (listener) => {
|
|
163
|
+
return this.libroService.onNotebookCellCreated((cells) => {
|
|
164
|
+
cells.forEach((cell) => {
|
|
165
|
+
listener(l2c.asNotebookCell(cell).document);
|
|
166
|
+
});
|
|
167
|
+
});
|
|
168
|
+
};
|
|
169
|
+
onDidSaveTextDocument: Event<TextDocument> = () => {
|
|
170
|
+
return {
|
|
171
|
+
dispose: () => {
|
|
172
|
+
return;
|
|
173
|
+
},
|
|
174
|
+
};
|
|
175
|
+
};
|
|
176
|
+
onWillSaveTextDocument: Event<TextDocumentWillSaveEvent> = () => {
|
|
177
|
+
return {
|
|
178
|
+
dispose: () => {
|
|
179
|
+
return;
|
|
180
|
+
},
|
|
181
|
+
};
|
|
182
|
+
};
|
|
183
|
+
onDidCloseTextDocument: Event<TextDocument> = () => {
|
|
184
|
+
return {
|
|
185
|
+
dispose: () => {
|
|
186
|
+
return;
|
|
187
|
+
},
|
|
188
|
+
};
|
|
189
|
+
};
|
|
190
|
+
onDidChangeTextDocument: Event<TextDocumentChangeEvent> = (listener, thisArgs) => {
|
|
191
|
+
return this.libroService.onNotebookCellChanged((e) => {
|
|
192
|
+
return listener.call(thisArgs, {
|
|
193
|
+
document: l2c.asNotebookCell(e.cell).document,
|
|
194
|
+
contentChanges: e.changes.map((change) => {
|
|
195
|
+
return {
|
|
196
|
+
range: new Range(
|
|
197
|
+
change.range.start.line,
|
|
198
|
+
change.range.start.column,
|
|
199
|
+
change.range.end.line,
|
|
200
|
+
change.range.end.column,
|
|
201
|
+
),
|
|
202
|
+
rangeLength: change.rangeLength,
|
|
203
|
+
rangeOffset: change.rangeOffset,
|
|
204
|
+
text: change.text,
|
|
205
|
+
};
|
|
206
|
+
}),
|
|
207
|
+
reason: undefined,
|
|
208
|
+
});
|
|
209
|
+
});
|
|
210
|
+
};
|
|
211
|
+
onDidCreateFiles: Event<FileCreateEvent> = () => {
|
|
212
|
+
return {
|
|
213
|
+
dispose: () => {
|
|
214
|
+
return;
|
|
215
|
+
},
|
|
216
|
+
};
|
|
217
|
+
};
|
|
218
|
+
onDidRenameFiles: Event<FileRenameEvent> = () => {
|
|
219
|
+
return {
|
|
220
|
+
dispose: () => {
|
|
221
|
+
return;
|
|
222
|
+
},
|
|
223
|
+
};
|
|
224
|
+
};
|
|
225
|
+
onWillRenameFiles: Event<FileWillRenameEvent> = () => {
|
|
226
|
+
return {
|
|
227
|
+
dispose: () => {
|
|
228
|
+
return;
|
|
229
|
+
},
|
|
230
|
+
};
|
|
231
|
+
};
|
|
232
|
+
onDidDeleteFiles: Event<FileDeleteEvent> = () => {
|
|
233
|
+
return {
|
|
234
|
+
dispose: () => {
|
|
235
|
+
return;
|
|
236
|
+
},
|
|
237
|
+
};
|
|
238
|
+
};
|
|
239
|
+
onWillDeleteFiles: Event<FileWillDeleteEvent> = () => {
|
|
240
|
+
return {
|
|
241
|
+
dispose: () => {
|
|
242
|
+
return;
|
|
243
|
+
},
|
|
244
|
+
};
|
|
245
|
+
};
|
|
246
|
+
onWillCreateFiles: Event<FileWillCreateEvent> = () => {
|
|
247
|
+
return {
|
|
248
|
+
dispose: () => {
|
|
249
|
+
return;
|
|
250
|
+
},
|
|
251
|
+
};
|
|
252
|
+
};
|
|
253
|
+
createFileSystemWatcher(
|
|
254
|
+
pattern: GlobPattern,
|
|
255
|
+
optionsOrIgnoreCreate: any,
|
|
256
|
+
ignoreChange?: boolean,
|
|
257
|
+
ignoreDelete?: boolean,
|
|
258
|
+
): FileSystemWatcher {
|
|
259
|
+
return new LibroFileWatcher();
|
|
260
|
+
}
|
|
261
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ApplicationContribution, singleton } from '@difizen/mana-app';
|
|
2
|
+
import { Deferred } from '@difizen/mana-app';
|
|
3
|
+
|
|
4
|
+
import { initLspEnv } from './vscodeAdaptor.js';
|
|
5
|
+
|
|
6
|
+
@singleton({ contrib: [ApplicationContribution] })
|
|
7
|
+
export class LSPEnv implements ApplicationContribution {
|
|
8
|
+
protected readyDefer = new Deferred<void>();
|
|
9
|
+
get ready() {
|
|
10
|
+
return this.readyDefer.promise;
|
|
11
|
+
}
|
|
12
|
+
onStart() {
|
|
13
|
+
initLspEnv();
|
|
14
|
+
this.readyDefer.resolve();
|
|
15
|
+
}
|
|
16
|
+
}
|