@difizen/libro-lsp 0.1.2
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/adapters/adapter.d.ts +255 -0
- package/es/adapters/adapter.d.ts.map +1 -0
- package/es/adapters/adapter.js +647 -0
- package/es/adapters/notebook-adapter.d.ts +150 -0
- package/es/adapters/notebook-adapter.d.ts.map +1 -0
- package/es/adapters/notebook-adapter.js +588 -0
- package/es/adapters/status-message.d.ts +48 -0
- package/es/adapters/status-message.d.ts.map +1 -0
- package/es/adapters/status-message.js +110 -0
- package/es/connection-manager.d.ts +199 -0
- package/es/connection-manager.d.ts.map +1 -0
- package/es/connection-manager.js +685 -0
- package/es/connection.d.ts +149 -0
- package/es/connection.d.ts.map +1 -0
- package/es/connection.js +591 -0
- package/es/extractors/index.d.ts +4 -0
- package/es/extractors/index.d.ts.map +1 -0
- package/es/extractors/index.js +6 -0
- package/es/extractors/manager.d.ts +31 -0
- package/es/extractors/manager.d.ts.map +1 -0
- package/es/extractors/manager.js +90 -0
- package/es/extractors/text-extractor.d.ts +56 -0
- package/es/extractors/text-extractor.d.ts.map +1 -0
- package/es/extractors/text-extractor.js +72 -0
- package/es/extractors/types.d.ts +68 -0
- package/es/extractors/types.d.ts.map +1 -0
- package/es/extractors/types.js +1 -0
- package/es/feature.d.ts +29 -0
- package/es/feature.d.ts.map +1 -0
- package/es/feature.js +85 -0
- package/es/index.d.ts +19 -0
- package/es/index.d.ts.map +1 -0
- package/es/index.js +21 -0
- package/es/lsp-app-contribution.d.ts +19 -0
- package/es/lsp-app-contribution.d.ts.map +1 -0
- package/es/lsp-app-contribution.js +155 -0
- package/es/lsp-protocol.d.ts +10 -0
- package/es/lsp-protocol.d.ts.map +1 -0
- package/es/lsp-protocol.js +1 -0
- package/es/lsp.d.ts +136 -0
- package/es/lsp.d.ts.map +1 -0
- package/es/lsp.js +141 -0
- package/es/manager.d.ts +142 -0
- package/es/manager.d.ts.map +1 -0
- package/es/manager.js +423 -0
- package/es/module.d.ts +3 -0
- package/es/module.d.ts.map +1 -0
- package/es/module.js +21 -0
- package/es/plugin.d.ts +56 -0
- package/es/plugin.d.ts.map +1 -0
- package/es/plugin.js +0 -0
- package/es/positioning.d.ts +66 -0
- package/es/positioning.d.ts.map +1 -0
- package/es/positioning.js +96 -0
- package/es/schema.d.ts +240 -0
- package/es/schema.d.ts.map +1 -0
- package/es/schema.js +0 -0
- package/es/tokens.d.ts +677 -0
- package/es/tokens.d.ts.map +1 -0
- package/es/tokens.js +183 -0
- package/es/utils.d.ts +33 -0
- package/es/utils.d.ts.map +1 -0
- package/es/utils.js +168 -0
- package/es/virtual/document.d.ts +546 -0
- package/es/virtual/document.d.ts.map +1 -0
- package/es/virtual/document.js +1263 -0
- package/es/ws-connection/server-capability-registration.d.ts +19 -0
- package/es/ws-connection/server-capability-registration.d.ts.map +1 -0
- package/es/ws-connection/server-capability-registration.js +51 -0
- package/es/ws-connection/types.d.ts +76 -0
- package/es/ws-connection/types.d.ts.map +1 -0
- package/es/ws-connection/types.js +1 -0
- package/es/ws-connection/ws-connection.d.ts +105 -0
- package/es/ws-connection/ws-connection.d.ts.map +1 -0
- package/es/ws-connection/ws-connection.js +301 -0
- package/package.json +67 -0
- package/src/adapters/adapter.ts +611 -0
- package/src/adapters/notebook-adapter.ts +463 -0
- package/src/adapters/status-message.ts +93 -0
- package/src/connection-manager.ts +626 -0
- package/src/connection.ts +570 -0
- package/src/extractors/index.ts +6 -0
- package/src/extractors/manager.ts +82 -0
- package/src/extractors/text-extractor.ts +94 -0
- package/src/extractors/types.ts +78 -0
- package/src/feature.ts +60 -0
- package/src/index.spec.ts +10 -0
- package/src/index.ts +21 -0
- package/src/lsp-app-contribution.ts +83 -0
- package/src/lsp-protocol.ts +10 -0
- package/src/lsp.ts +160 -0
- package/src/manager.ts +358 -0
- package/src/module.ts +32 -0
- package/src/plugin.ts +62 -0
- package/src/positioning.ts +121 -0
- package/src/schema.ts +249 -0
- package/src/tokens.ts +843 -0
- package/src/utils.ts +109 -0
- package/src/virtual/document.ts +1250 -0
- package/src/ws-connection/server-capability-registration.ts +77 -0
- package/src/ws-connection/types.ts +102 -0
- package/src/ws-connection/ws-connection.ts +320 -0
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import type * as nbformat from '@difizen/libro-common';
|
|
2
|
+
import type { CellView, CellViewChange, LibroModel, LibroView } from '@difizen/libro-core';
|
|
3
|
+
import type { ExecutableNotebookModel } from '@difizen/libro-kernel';
|
|
4
|
+
import { Deferred } from '@difizen/mana-app';
|
|
5
|
+
import type { IVirtualPosition } from '../positioning.js';
|
|
6
|
+
import type { Document } from '../tokens.js';
|
|
7
|
+
import { VirtualDocument } from '../virtual/document.js';
|
|
8
|
+
import type { IAdapterOptions } from './adapter.js';
|
|
9
|
+
import { WidgetLSPAdapter } from './adapter.js';
|
|
10
|
+
type ILanguageInfoMetadata = nbformat.ILanguageInfoMetadata;
|
|
11
|
+
export declare class NotebookAdapter extends WidgetLSPAdapter<LibroView> {
|
|
12
|
+
editorWidget: LibroView;
|
|
13
|
+
protected options: IAdapterOptions;
|
|
14
|
+
constructor(editorWidget: LibroView, options: IAdapterOptions);
|
|
15
|
+
/**
|
|
16
|
+
* The wrapped `Notebook` widget.
|
|
17
|
+
*/
|
|
18
|
+
readonly editor: LibroView;
|
|
19
|
+
get notebookModel(): ExecutableNotebookModel;
|
|
20
|
+
get fileContents(): import("@difizen/libro-kernel").IContentsModel;
|
|
21
|
+
/**
|
|
22
|
+
* Get current path of the document.
|
|
23
|
+
*/
|
|
24
|
+
get documentPath(): string;
|
|
25
|
+
/**
|
|
26
|
+
* Get the mime type of the document.
|
|
27
|
+
*/
|
|
28
|
+
get mimeType(): string;
|
|
29
|
+
/**
|
|
30
|
+
* Get the file extension of the document.
|
|
31
|
+
*/
|
|
32
|
+
get languageFileExtension(): string | undefined;
|
|
33
|
+
/**
|
|
34
|
+
* Get the inner HTMLElement of the document widget.
|
|
35
|
+
*/
|
|
36
|
+
get wrapperElement(): HTMLElement;
|
|
37
|
+
/**
|
|
38
|
+
* Get the list of CM editor with its type in the document,
|
|
39
|
+
*/
|
|
40
|
+
get editors(): Document.ICodeBlockOptions[];
|
|
41
|
+
/**
|
|
42
|
+
* Get the activated CM editor.
|
|
43
|
+
*/
|
|
44
|
+
get activeEditor(): Document.IEditor | undefined;
|
|
45
|
+
/**
|
|
46
|
+
* Promise that resolves once the adapter is initialized
|
|
47
|
+
*/
|
|
48
|
+
get ready(): Promise<void>;
|
|
49
|
+
/**
|
|
50
|
+
* Get the index of editor from the cursor position in the virtual
|
|
51
|
+
* document.
|
|
52
|
+
*
|
|
53
|
+
* @param position - the position of cursor in the virtual document.
|
|
54
|
+
*/
|
|
55
|
+
getEditorIndexAt(position: IVirtualPosition): number;
|
|
56
|
+
/**
|
|
57
|
+
* Get the index of input editor
|
|
58
|
+
*
|
|
59
|
+
* @param ceEditor - instance of the code editor
|
|
60
|
+
*/
|
|
61
|
+
getEditorIndex(ceEditor: Document.IEditor): number;
|
|
62
|
+
/**
|
|
63
|
+
* Get the wrapper of input editor.
|
|
64
|
+
*
|
|
65
|
+
* @param ceEditor - instance of the code editor
|
|
66
|
+
*/
|
|
67
|
+
getEditorWrapper(ceEditor: Document.IEditor): HTMLElement | undefined;
|
|
68
|
+
/**
|
|
69
|
+
* Callback on kernel changed event, it will disconnect the
|
|
70
|
+
* document with the language server and then reconnect.
|
|
71
|
+
*
|
|
72
|
+
* @param _session - Session context of changed kernel
|
|
73
|
+
* @param change - Changed data
|
|
74
|
+
*/
|
|
75
|
+
onKernelChanged(): Promise<void>;
|
|
76
|
+
/**
|
|
77
|
+
* Dispose the widget.
|
|
78
|
+
*/
|
|
79
|
+
dispose(): void;
|
|
80
|
+
/**
|
|
81
|
+
* Method to check if the notebook context is ready.
|
|
82
|
+
*/
|
|
83
|
+
isReady(): boolean;
|
|
84
|
+
handleCellSourceChange: () => Promise<void>;
|
|
85
|
+
/**
|
|
86
|
+
* Update the virtual document on cell changing event.
|
|
87
|
+
*
|
|
88
|
+
* @param cells - Observable list of changed cells
|
|
89
|
+
* @param change - Changed data
|
|
90
|
+
*/
|
|
91
|
+
handleCellChange: (change: CellViewChange) => Promise<void>;
|
|
92
|
+
/**
|
|
93
|
+
* Generate the virtual document associated with the document.
|
|
94
|
+
*/
|
|
95
|
+
createVirtualDocument(): VirtualDocument;
|
|
96
|
+
/**
|
|
97
|
+
* Get the metadata of notebook.
|
|
98
|
+
*/
|
|
99
|
+
protected language_info(): ILanguageInfoMetadata;
|
|
100
|
+
/**
|
|
101
|
+
* Initialization function called once the editor and the LSP connection
|
|
102
|
+
* manager is ready. This function will create the virtual document and
|
|
103
|
+
* connect various signals.
|
|
104
|
+
*/
|
|
105
|
+
protected initOnceReady: () => Promise<void>;
|
|
106
|
+
/**
|
|
107
|
+
* Connect the cell changed event to its handler
|
|
108
|
+
*
|
|
109
|
+
* @param notebook - The notebook that emitted event.
|
|
110
|
+
*/
|
|
111
|
+
protected _connectModelSignals(notebook: LibroView): void;
|
|
112
|
+
/**
|
|
113
|
+
* Update the stored language info with the one from the notebook.
|
|
114
|
+
*/
|
|
115
|
+
protected _updateLanguageInfo(): Promise<void>;
|
|
116
|
+
/**
|
|
117
|
+
* Handle the cell changed event
|
|
118
|
+
* @param notebook - The notebook that emitted event
|
|
119
|
+
* @param cell - Changed cell.
|
|
120
|
+
*/
|
|
121
|
+
protected _activeCellChanged(libroModel: LibroModel | null): void;
|
|
122
|
+
/**
|
|
123
|
+
* Get the cell at the cursor position of the virtual document.
|
|
124
|
+
* @param pos - Position in the virtual document.
|
|
125
|
+
*/
|
|
126
|
+
protected _getCellAt(pos: IVirtualPosition): CellView;
|
|
127
|
+
/**
|
|
128
|
+
* Get the cell editor and add new ones to the mappings.
|
|
129
|
+
*
|
|
130
|
+
* @param cell Cell widget
|
|
131
|
+
* @returns Cell editor accessor
|
|
132
|
+
*/
|
|
133
|
+
getCellEditor(cell: CellView): Document.IEditor | undefined;
|
|
134
|
+
/**
|
|
135
|
+
* A map between the editor accessor and the containing cell
|
|
136
|
+
*/
|
|
137
|
+
protected _editorToCell: Map<Document.IEditor, CellView>;
|
|
138
|
+
/**
|
|
139
|
+
* Mapping of cell to editor accessor to ensure accessor uniqueness.
|
|
140
|
+
*/
|
|
141
|
+
protected _cellToEditor: WeakMap<CellView, Document.IEditor>;
|
|
142
|
+
/**
|
|
143
|
+
* Metadata of the notebook
|
|
144
|
+
*/
|
|
145
|
+
protected _languageInfo: ILanguageInfoMetadata;
|
|
146
|
+
protected _type: nbformat.CellType;
|
|
147
|
+
protected _readyDelegate: Deferred<void>;
|
|
148
|
+
}
|
|
149
|
+
export {};
|
|
150
|
+
//# sourceMappingURL=notebook-adapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notebook-adapter.d.ts","sourceRoot":"","sources":["../../src/adapters/notebook-adapter.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,KAAK,QAAQ,MAAM,uBAAuB,CAAC;AACvD,OAAO,KAAK,EACV,QAAQ,EACR,cAAc,EACd,UAAU,EACV,SAAS,EACV,MAAM,qBAAqB,CAAC;AAE7B,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAErE,OAAO,EAAS,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAE7C,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEhD,KAAK,qBAAqB,GAAG,QAAQ,CAAC,qBAAqB,CAAC;AAE5D,qBAAa,eAAgB,SAAQ,gBAAgB,CAAC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