@jupyterlab/lsp 4.0.0-alpha.11 → 4.0.0-alpha.12
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/lib/adapters/adapter.d.ts +184 -54
- package/lib/adapters/adapter.js +177 -132
- package/lib/adapters/adapter.js.map +1 -1
- package/lib/adapters/statusmessage.d.ts +47 -0
- package/lib/adapters/statusmessage.js +74 -0
- package/lib/adapters/statusmessage.js.map +1 -0
- package/lib/connection.d.ts +113 -26
- package/lib/connection.js +166 -105
- package/lib/connection.js.map +1 -1
- package/lib/connection_manager.d.ts +143 -18
- package/lib/connection_manager.js +163 -49
- package/lib/connection_manager.js.map +1 -1
- package/lib/extractors/index.d.ts +3 -0
- package/lib/extractors/index.js +6 -0
- package/lib/extractors/index.js.map +1 -0
- package/lib/extractors/manager.d.ts +21 -4
- package/lib/extractors/manager.js +22 -5
- package/lib/extractors/manager.js.map +1 -1
- package/lib/extractors/text_extractor.d.ts +34 -7
- package/lib/extractors/text_extractor.js +11 -0
- package/lib/extractors/text_extractor.js.map +1 -1
- package/lib/extractors/types.d.ts +8 -6
- package/lib/extractors/types.js +2 -0
- package/lib/extractors/types.js.map +1 -1
- package/lib/feature.d.ts +18 -3
- package/lib/feature.js +20 -3
- package/lib/feature.js.map +1 -1
- package/lib/index.d.ts +6 -9
- package/lib/index.js +8 -13
- package/lib/index.js.map +1 -1
- package/lib/lsp.d.ts +10 -4
- package/lib/lsp.js +2 -0
- package/lib/lsp.js.map +1 -1
- package/lib/manager.d.ts +103 -16
- package/lib/manager.js +118 -31
- package/lib/manager.js.map +1 -1
- package/lib/plugin.d.ts +18 -13
- package/lib/plugin.js +2 -1
- package/lib/plugin.js.map +1 -1
- package/lib/positioning.d.ts +43 -6
- package/lib/positioning.js +28 -2
- package/lib/positioning.js.map +1 -1
- package/lib/schema.js +2 -1
- package/lib/schema.js.map +1 -1
- package/lib/tokens.d.ts +275 -45
- package/lib/tokens.js +28 -0
- package/lib/tokens.js.map +1 -1
- package/lib/utils.d.ts +15 -1
- package/lib/utils.js +18 -2
- package/lib/utils.js.map +1 -1
- package/lib/virtual/document.d.ts +374 -78
- package/lib/virtual/document.js +375 -148
- package/lib/virtual/document.js.map +1 -1
- package/lib/ws-connection/server-capability-registration.d.ts +18 -0
- package/lib/ws-connection/server-capability-registration.js +46 -0
- package/lib/ws-connection/server-capability-registration.js.map +1 -0
- package/lib/ws-connection/types.d.ts +75 -0
- package/lib/ws-connection/types.js +7 -0
- package/lib/ws-connection/types.js.map +1 -0
- package/lib/ws-connection/ws-connection.d.ts +82 -0
- package/lib/ws-connection/ws-connection.js +201 -0
- package/lib/ws-connection/ws-connection.js.map +1 -0
- package/package.json +15 -16
- package/style/index.css +0 -2
- package/style/index.js +0 -2
|
@@ -1,13 +1,30 @@
|
|
|
1
|
-
import { CellType } from '@jupyterlab/nbformat';
|
|
2
1
|
import { ILSPCodeExtractorsManager } from '../tokens';
|
|
3
2
|
import { IForeignCodeExtractor } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Manager for the code extractors
|
|
5
|
+
*/
|
|
4
6
|
export declare class CodeExtractorsManager implements ILSPCodeExtractorsManager {
|
|
5
|
-
private _extractorMap;
|
|
6
|
-
private _extractorMapAnyLanguage;
|
|
7
7
|
constructor();
|
|
8
|
-
|
|
8
|
+
/**
|
|
9
|
+
* Get the extractors for the input cell type and the main language of
|
|
10
|
+
* the document
|
|
11
|
+
*
|
|
12
|
+
* @param cellType - type of cell
|
|
13
|
+
* @param hostLanguage - main language of the document
|
|
14
|
+
*/
|
|
15
|
+
getExtractors(cellType: string, hostLanguage: string | null): IForeignCodeExtractor[];
|
|
9
16
|
/**
|
|
10
17
|
* Register an extractor to extract foreign code from host documents of specified language.
|
|
11
18
|
*/
|
|
12
19
|
register(extractor: IForeignCodeExtractor, hostLanguage: string | null): void;
|
|
20
|
+
/**
|
|
21
|
+
* The map with key is the type of cell, value is another map between
|
|
22
|
+
* the language of cell and its code extractor.
|
|
23
|
+
*/
|
|
24
|
+
private _extractorMap;
|
|
25
|
+
/**
|
|
26
|
+
* The map with key is the cell type, value is the code extractor associated
|
|
27
|
+
* with this cell type, this is used for the non-code cell types.
|
|
28
|
+
*/
|
|
29
|
+
private _extractorMapAnyLanguage;
|
|
13
30
|
}
|
|
@@ -1,16 +1,27 @@
|
|
|
1
|
+
// Copyright (c) Jupyter Development Team.
|
|
2
|
+
// Distributed under the terms of the Modified BSD License.
|
|
3
|
+
/**
|
|
4
|
+
* Manager for the code extractors
|
|
5
|
+
*/
|
|
1
6
|
export class CodeExtractorsManager {
|
|
2
7
|
constructor() {
|
|
3
8
|
this._extractorMap = new Map();
|
|
4
9
|
this._extractorMapAnyLanguage = new Map();
|
|
5
|
-
['code', 'markdown', 'raw'].forEach(cell => {
|
|
6
|
-
this._extractorMap.set(cell, new Map());
|
|
7
|
-
this._extractorMapAnyLanguage.set(cell, []);
|
|
8
|
-
});
|
|
9
10
|
}
|
|
11
|
+
/**
|
|
12
|
+
* Get the extractors for the input cell type and the main language of
|
|
13
|
+
* the document
|
|
14
|
+
*
|
|
15
|
+
* @param cellType - type of cell
|
|
16
|
+
* @param hostLanguage - main language of the document
|
|
17
|
+
*/
|
|
10
18
|
getExtractors(cellType, hostLanguage) {
|
|
11
19
|
var _a, _b;
|
|
12
20
|
if (hostLanguage) {
|
|
13
21
|
const currentMap = this._extractorMap.get(cellType);
|
|
22
|
+
if (!currentMap) {
|
|
23
|
+
return [];
|
|
24
|
+
}
|
|
14
25
|
return (_a = currentMap.get(hostLanguage)) !== null && _a !== void 0 ? _a : [];
|
|
15
26
|
}
|
|
16
27
|
else {
|
|
@@ -24,18 +35,24 @@ export class CodeExtractorsManager {
|
|
|
24
35
|
const cellType = extractor.cellType;
|
|
25
36
|
if (hostLanguage) {
|
|
26
37
|
cellType.forEach(type => {
|
|
38
|
+
if (!this._extractorMap.has(type)) {
|
|
39
|
+
this._extractorMap.set(type, new Map());
|
|
40
|
+
}
|
|
27
41
|
const currentMap = this._extractorMap.get(type);
|
|
28
42
|
const extractorList = currentMap.get(hostLanguage);
|
|
29
43
|
if (!extractorList) {
|
|
30
44
|
currentMap.set(hostLanguage, [extractor]);
|
|
31
45
|
}
|
|
32
46
|
else {
|
|
33
|
-
extractorList
|
|
47
|
+
extractorList.push(extractor);
|
|
34
48
|
}
|
|
35
49
|
});
|
|
36
50
|
}
|
|
37
51
|
else {
|
|
38
52
|
cellType.forEach(type => {
|
|
53
|
+
if (!this._extractorMapAnyLanguage.has(type)) {
|
|
54
|
+
this._extractorMapAnyLanguage.set(type, []);
|
|
55
|
+
}
|
|
39
56
|
this._extractorMapAnyLanguage.get(type).push(extractor);
|
|
40
57
|
});
|
|
41
58
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manager.js","sourceRoot":"","sources":["../../src/extractors/manager.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"manager.js","sourceRoot":"","sources":["../../src/extractors/manager.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,2DAA2D;AAK3D;;GAEG;AACH,MAAM,OAAO,qBAAqB;IAChC;QACE,IAAI,CAAC,aAAa,GAAG,IAAI,GAAG,EAGzB,CAAC;QAEJ,IAAI,CAAC,wBAAwB,GAAG,IAAI,GAAG,EAAmC,CAAC;IAC7E,CAAC;IAED;;;;;;OAMG;IACH,aAAa,CACX,QAAgB,EAChB,YAA2B;;QAE3B,IAAI,YAAY,EAAE;YAChB,MAAM,UAAU,GAAG,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;YACpD,IAAI,CAAC,UAAU,EAAE;gBACf,OAAO,EAAE,CAAC;aACX;YACD,OAAO,MAAA,UAAW,CAAC,GAAG,CAAC,YAAY,CAAC,mCAAI,EAAE,CAAC;SAC5C;aAAM;YACL,OAAO,MAAA,IAAI,CAAC,wBAAwB,CAAC,GAAG,CAAC,QAAQ,CAAC,mCAAI,EAAE,CAAC;SAC1D;IACH,CAAC;IAED;;OAEG;IACH,QAAQ,CACN,SAAgC,EAChC,YAA2B;QAE3B,MAAM,QAAQ,GAAG,SAAS,CAAC,QAAQ,CAAC;QACpC,IAAI,YAAY,EAAE;YAChB,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;gBACtB,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;oBACjC,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,GAAG,EAAE,CAAC,CAAC;iBACzC;gBACD,MAAM,UAAU,GAAG,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,CAAE,CAAC;gBACjD,MAAM,aAAa,GAAG,UAAU,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;gBACnD,IAAI,CAAC,aAAa,EAAE;oBAClB,UAAU,CAAC,GAAG,CAAC,YAAY,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC;iBAC3C;qBAAM;oBACL,aAAa,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;iBAC/B;YACH,CAAC,CAAC,CAAC;SACJ;aAAM;YACL,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;gBACtB,IAAI,CAAC,IAAI,CAAC,wBAAwB,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;oBAC5C,IAAI,CAAC,wBAAwB,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;iBAC7C;gBACD,IAAI,CAAC,wBAAwB,CAAC,GAAG,CAAC,IAAI,CAAE,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YAC3D,CAAC,CAAC,CAAC;SACJ;IACH,CAAC;CAaF"}
|
|
@@ -1,13 +1,34 @@
|
|
|
1
|
-
import { CellType } from '@jupyterlab/nbformat';
|
|
2
1
|
import { LanguageIdentifier } from '../lsp';
|
|
3
2
|
import { IExtractedCode, IForeignCodeExtractor } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* The code extractor for the raw and markdown text.
|
|
5
|
+
*/
|
|
4
6
|
export declare class TextForeignCodeExtractor implements IForeignCodeExtractor {
|
|
5
|
-
language: LanguageIdentifier;
|
|
6
|
-
standalone: boolean;
|
|
7
|
-
fileExtension: string;
|
|
8
|
-
cellType: CellType[];
|
|
9
7
|
constructor(options: TextForeignCodeExtractor.IOptions);
|
|
10
|
-
|
|
8
|
+
/**
|
|
9
|
+
* The foreign language.
|
|
10
|
+
*/
|
|
11
|
+
readonly language: LanguageIdentifier;
|
|
12
|
+
/**
|
|
13
|
+
* Should the foreign code be appended (False) to the previously established virtual document of the same language,
|
|
14
|
+
* or is it standalone snippet which requires separate connection?
|
|
15
|
+
*/
|
|
16
|
+
readonly standalone: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Extension of the virtual document (some servers check extensions of files), e.g. 'py' or 'R'.
|
|
19
|
+
*/
|
|
20
|
+
readonly fileExtension: string;
|
|
21
|
+
/**
|
|
22
|
+
* The supported cell types.
|
|
23
|
+
*/
|
|
24
|
+
readonly cellType: string[];
|
|
25
|
+
/**
|
|
26
|
+
* Test if there is any foreign code in provided code snippet.
|
|
27
|
+
*/
|
|
28
|
+
hasForeignCode(code: string, cellType: string): boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Split the code into the host and foreign code (if any foreign code was detected)
|
|
31
|
+
*/
|
|
11
32
|
extractForeignCode(code: string): IExtractedCode[];
|
|
12
33
|
}
|
|
13
34
|
declare namespace TextForeignCodeExtractor {
|
|
@@ -21,8 +42,14 @@ declare namespace TextForeignCodeExtractor {
|
|
|
21
42
|
* or is it standalone snippet which requires separate connection?
|
|
22
43
|
*/
|
|
23
44
|
isStandalone: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Extension of the virtual document (some servers check extensions of files), e.g. 'py' or 'R'.
|
|
47
|
+
*/
|
|
24
48
|
file_extension: string;
|
|
25
|
-
|
|
49
|
+
/**
|
|
50
|
+
* The supported cell types.
|
|
51
|
+
*/
|
|
52
|
+
cellType: string[];
|
|
26
53
|
}
|
|
27
54
|
}
|
|
28
55
|
export {};
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
+
// Copyright (c) Jupyter Development Team.
|
|
2
|
+
// Distributed under the terms of the Modified BSD License.
|
|
1
3
|
import { positionAtOffset } from '../positioning';
|
|
4
|
+
/**
|
|
5
|
+
* The code extractor for the raw and markdown text.
|
|
6
|
+
*/
|
|
2
7
|
export class TextForeignCodeExtractor {
|
|
3
8
|
constructor(options) {
|
|
4
9
|
this.language = options.language;
|
|
@@ -6,9 +11,15 @@ export class TextForeignCodeExtractor {
|
|
|
6
11
|
this.fileExtension = options.file_extension;
|
|
7
12
|
this.cellType = options.cellType;
|
|
8
13
|
}
|
|
14
|
+
/**
|
|
15
|
+
* Test if there is any foreign code in provided code snippet.
|
|
16
|
+
*/
|
|
9
17
|
hasForeignCode(code, cellType) {
|
|
10
18
|
return this.cellType.includes(cellType);
|
|
11
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* Split the code into the host and foreign code (if any foreign code was detected)
|
|
22
|
+
*/
|
|
12
23
|
extractForeignCode(code) {
|
|
13
24
|
let lines = code.split('\n');
|
|
14
25
|
let extracts = new Array();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text_extractor.js","sourceRoot":"","sources":["../../src/extractors/text_extractor.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"text_extractor.js","sourceRoot":"","sources":["../../src/extractors/text_extractor.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,2DAA2D;AAG3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAIlD;;GAEG;AACH,MAAM,OAAO,wBAAwB;IACnC,YAAY,OAA0C;QACpD,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;QACjC,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,YAAY,CAAC;QACvC,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC,cAAc,CAAC;QAC5C,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;IACnC,CAAC;IAsBD;;OAEG;IACH,cAAc,CAAC,IAAY,EAAE,QAAgB;QAC3C,OAAO,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IAC1C,CAAC;IAED;;OAEG;IACH,kBAAkB,CAAC,IAAY;QAC7B,IAAI,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAE7B,IAAI,QAAQ,GAAG,IAAI,KAAK,EAAkB,CAAC;QAE3C,IAAI,mBAAmB,GAAG,IAAI,CAAC;QAE/B,IAAI,KAAK,GAAG,gBAAgB,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;QACvC,IAAI,GAAG,GAAG,gBAAgB,CAAC,mBAAmB,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;QAE9D,QAAQ,CAAC,IAAI,CAAC;YACZ,QAAQ,EAAE,EAAE;YACZ,WAAW,EAAE,mBAAmB;YAChC,KAAK,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE;YACrB,YAAY,EAAE,IAAI;SACnB,CAAC,CAAC;QAEH,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { CodeEditor } from '@jupyterlab/codeeditor';
|
|
2
|
-
import { CellType } from '@jupyterlab/nbformat';
|
|
3
2
|
import { LanguageIdentifier } from '../lsp';
|
|
4
3
|
export interface IExtractedCode {
|
|
5
4
|
/**
|
|
@@ -43,8 +42,11 @@ export interface IForeignCodeExtractor {
|
|
|
43
42
|
/**
|
|
44
43
|
* The foreign language.
|
|
45
44
|
*/
|
|
46
|
-
language: LanguageIdentifier;
|
|
47
|
-
|
|
45
|
+
readonly language: LanguageIdentifier;
|
|
46
|
+
/**
|
|
47
|
+
* The supported cell types.
|
|
48
|
+
*/
|
|
49
|
+
readonly cellType: string[];
|
|
48
50
|
/**
|
|
49
51
|
* Split the code into the host and foreign code (if any foreign code was detected)
|
|
50
52
|
*/
|
|
@@ -53,13 +55,13 @@ export interface IForeignCodeExtractor {
|
|
|
53
55
|
* Does the extractor produce code which should be appended to the previously established virtual document (False)
|
|
54
56
|
* of the same language, or does it produce standalone snippets which require separate connections (True)?
|
|
55
57
|
*/
|
|
56
|
-
standalone: boolean;
|
|
58
|
+
readonly standalone: boolean;
|
|
57
59
|
/**
|
|
58
60
|
* Test if there is any foreign code in provided code snippet.
|
|
59
61
|
*/
|
|
60
|
-
hasForeignCode(code: string, cellType:
|
|
62
|
+
hasForeignCode(code: string, cellType: string): boolean;
|
|
61
63
|
/**
|
|
62
64
|
* Extension of the virtual document (some servers check extensions of files), e.g. 'py' or 'R'.
|
|
63
65
|
*/
|
|
64
|
-
fileExtension: string;
|
|
66
|
+
readonly fileExtension: string;
|
|
65
67
|
}
|
package/lib/extractors/types.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/extractors/types.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/extractors/types.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,2DAA2D"}
|
package/lib/feature.d.ts
CHANGED
|
@@ -1,11 +1,26 @@
|
|
|
1
1
|
import { ISignal } from '@lumino/signaling';
|
|
2
2
|
import { ClientCapabilities } from './lsp';
|
|
3
3
|
import { IFeature, ILSPFeatureManager } from './tokens';
|
|
4
|
+
/**
|
|
5
|
+
* Class to manager the registered features of the language servers.
|
|
6
|
+
*/
|
|
4
7
|
export declare class FeatureManager implements ILSPFeatureManager {
|
|
5
|
-
readonly features: Array<IFeature>;
|
|
6
|
-
private _featuresRegistered;
|
|
7
8
|
constructor();
|
|
8
|
-
|
|
9
|
+
/**
|
|
10
|
+
* List of registered features
|
|
11
|
+
*/
|
|
12
|
+
readonly features: Array<IFeature>;
|
|
13
|
+
/**
|
|
14
|
+
* Signal emitted when a new feature is registered.
|
|
15
|
+
*/
|
|
9
16
|
get featuresRegistered(): ISignal<ILSPFeatureManager, IFeature>;
|
|
17
|
+
/**
|
|
18
|
+
* Register a new feature, skip if it is already registered.
|
|
19
|
+
*/
|
|
20
|
+
register(feature: IFeature): void;
|
|
21
|
+
/**
|
|
22
|
+
* Get the capabilities of all clients.
|
|
23
|
+
*/
|
|
10
24
|
clientCapabilities(): ClientCapabilities;
|
|
25
|
+
private _featuresRegistered;
|
|
11
26
|
}
|
package/lib/feature.js
CHANGED
|
@@ -1,10 +1,27 @@
|
|
|
1
|
+
// Copyright (c) Jupyter Development Team.
|
|
2
|
+
// Distributed under the terms of the Modified BSD License.
|
|
1
3
|
import { Signal } from '@lumino/signaling';
|
|
2
4
|
import mergeWith from 'lodash.mergewith';
|
|
5
|
+
/**
|
|
6
|
+
* Class to manager the registered features of the language servers.
|
|
7
|
+
*/
|
|
3
8
|
export class FeatureManager {
|
|
4
9
|
constructor() {
|
|
10
|
+
/**
|
|
11
|
+
* List of registered features
|
|
12
|
+
*/
|
|
5
13
|
this.features = [];
|
|
6
14
|
this._featuresRegistered = new Signal(this);
|
|
7
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* Signal emitted when a new feature is registered.
|
|
18
|
+
*/
|
|
19
|
+
get featuresRegistered() {
|
|
20
|
+
return this._featuresRegistered;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Register a new feature, skip if it is already registered.
|
|
24
|
+
*/
|
|
8
25
|
register(feature) {
|
|
9
26
|
if (this.features.some(ft => ft.id === feature.id)) {
|
|
10
27
|
console.warn(`Feature with id ${feature.id} is already registered, skipping.`);
|
|
@@ -14,9 +31,9 @@ export class FeatureManager {
|
|
|
14
31
|
this._featuresRegistered.emit(feature);
|
|
15
32
|
}
|
|
16
33
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
34
|
+
/**
|
|
35
|
+
* Get the capabilities of all clients.
|
|
36
|
+
*/
|
|
20
37
|
clientCapabilities() {
|
|
21
38
|
let capabilities = {};
|
|
22
39
|
for (const feature of this.features) {
|
package/lib/feature.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"feature.js","sourceRoot":"","sources":["../src/feature.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,MAAM,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,SAAS,MAAM,kBAAkB,CAAC;AAKzC,MAAM,OAAO,cAAc;
|
|
1
|
+
{"version":3,"file":"feature.js","sourceRoot":"","sources":["../src/feature.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,2DAA2D;AAE3D,OAAO,EAAW,MAAM,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,SAAS,MAAM,kBAAkB,CAAC;AAKzC;;GAEG;AACH,MAAM,OAAO,cAAc;IACzB;QAGA;;WAEG;QACM,aAAQ,GAAoB,EAAE,CAAC;QALtC,IAAI,CAAC,mBAAmB,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,CAAC;IAC9C,CAAC;IAMD;;OAEG;IACH,IAAI,kBAAkB;QACpB,OAAO,IAAI,CAAC,mBAAmB,CAAC;IAClC,CAAC;IAED;;OAEG;IACH,QAAQ,CAAC,OAAiB;QACxB,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,OAAO,CAAC,EAAE,CAAC,EAAE;YAClD,OAAO,CAAC,IAAI,CACV,mBAAmB,OAAO,CAAC,EAAE,mCAAmC,CACjE,CAAC;SACH;aAAM;YACL,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YAC5B,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;SACxC;IACH,CAAC;IAED;;OAEG;IACH,kBAAkB;QAChB,IAAI,YAAY,GAAuB,EAAE,CAAC;QAC1C,KAAK,MAAM,OAAO,IAAI,IAAI,CAAC,QAAQ,EAAE;YACnC,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE;gBACzB,SAAS;aACV;YACD,YAAY,GAAG,SAAS,CAAC,YAAY,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;SAC9D;QACD,OAAO,YAAY,CAAC;IACtB,CAAC;CAGF"}
|
package/lib/index.d.ts
CHANGED
|
@@ -2,16 +2,13 @@
|
|
|
2
2
|
* @packageDocumentation
|
|
3
3
|
* @module lsp
|
|
4
4
|
*/
|
|
5
|
+
export * from './adapters/adapter';
|
|
5
6
|
export * from './connection_manager';
|
|
7
|
+
export * from './extractors';
|
|
8
|
+
export * from './feature';
|
|
6
9
|
export * from './manager';
|
|
7
|
-
export * from './
|
|
8
|
-
export * from './adapters/adapter';
|
|
10
|
+
export * from './plugin';
|
|
9
11
|
export * from './positioning';
|
|
10
|
-
export * from './
|
|
12
|
+
export * from './tokens';
|
|
11
13
|
export * from './utils';
|
|
12
|
-
export * from './
|
|
13
|
-
export * from './feature';
|
|
14
|
-
export * from './extractors/manager';
|
|
15
|
-
export * from './extractors/text_extractor';
|
|
16
|
-
export * from './extractors/types';
|
|
17
|
-
export * from './plugin';
|
|
14
|
+
export * from './virtual/document';
|
package/lib/index.js
CHANGED
|
@@ -1,22 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
| Distributed under the terms of the Modified BSD License.
|
|
4
|
-
|----------------------------------------------------------------------------*/
|
|
1
|
+
// Copyright (c) Jupyter Development Team.
|
|
2
|
+
// Distributed under the terms of the Modified BSD License.
|
|
5
3
|
/**
|
|
6
4
|
* @packageDocumentation
|
|
7
5
|
* @module lsp
|
|
8
6
|
*/
|
|
7
|
+
export * from './adapters/adapter';
|
|
9
8
|
export * from './connection_manager';
|
|
9
|
+
export * from './extractors';
|
|
10
|
+
export * from './feature';
|
|
10
11
|
export * from './manager';
|
|
11
|
-
export * from './
|
|
12
|
-
export * from './adapters/adapter';
|
|
12
|
+
export * from './plugin';
|
|
13
13
|
export * from './positioning';
|
|
14
|
-
export * from './
|
|
14
|
+
export * from './tokens';
|
|
15
15
|
export * from './utils';
|
|
16
|
-
export * from './
|
|
17
|
-
export * from './feature';
|
|
18
|
-
export * from './extractors/manager';
|
|
19
|
-
export * from './extractors/text_extractor';
|
|
20
|
-
export * from './extractors/types';
|
|
21
|
-
export * from './plugin';
|
|
16
|
+
export * from './virtual/document';
|
|
22
17
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,2DAA2D;AAC3D;;;GAGG;AAEH,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,oBAAoB,CAAC"}
|
package/lib/lsp.d.ts
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import type * as lsp from 'vscode-languageserver-protocol';
|
|
2
|
-
|
|
3
|
-
export declare type ClientCapabilities = Omit<lsp.ClientCapabilities, 'textDocument'> & {
|
|
4
|
-
textDocument?: Omit<lsp.TextDocumentClientCapabilities, 'moniker'>;
|
|
5
|
-
};
|
|
2
|
+
export declare type ClientCapabilities = lsp.ClientCapabilities;
|
|
6
3
|
export declare enum DiagnosticSeverity {
|
|
7
4
|
Error = 1,
|
|
8
5
|
Warning = 2,
|
|
@@ -127,3 +124,12 @@ export declare type RecommendedLanguageIdentifier = keyof typeof Languages;
|
|
|
127
124
|
* the identifiers as recommended by the LSP documentation.
|
|
128
125
|
*/
|
|
129
126
|
export declare type LanguageIdentifier = RecommendedLanguageIdentifier | string;
|
|
127
|
+
/**
|
|
128
|
+
* Type represents a location inside a resource, such as a line
|
|
129
|
+
* inside a text file.
|
|
130
|
+
*/
|
|
131
|
+
export declare type AnyLocation = lsp.Location | lsp.Location[] | lsp.LocationLink[] | undefined | null;
|
|
132
|
+
/**
|
|
133
|
+
* Type represents the completion result.
|
|
134
|
+
*/
|
|
135
|
+
export declare type AnyCompletion = lsp.CompletionList | lsp.CompletionItem[];
|
package/lib/lsp.js
CHANGED
package/lib/lsp.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lsp.js","sourceRoot":"","sources":["../src/lsp.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"lsp.js","sourceRoot":"","sources":["../src/lsp.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,2DAA2D;AAM3D,MAAM,CAAN,IAAY,kBAKX;AALD,WAAY,kBAAkB;IAC5B,6DAAS,CAAA;IACT,iEAAW,CAAA;IACX,yEAAe,CAAA;IACf,2DAAQ,CAAA;AACV,CAAC,EALW,kBAAkB,KAAlB,kBAAkB,QAK7B;AAED,MAAM,CAAN,IAAY,aAGX;AAHD,WAAY,aAAa;IACvB,+DAAe,CAAA;IACf,6DAAc,CAAA;AAChB,CAAC,EAHW,aAAa,KAAb,aAAa,QAGxB;AAED,MAAM,CAAN,IAAY,iBAEX;AAFD,WAAY,iBAAiB;IAC3B,qEAAc,CAAA;AAChB,CAAC,EAFW,iBAAiB,KAAjB,iBAAiB,QAE5B;AAED,MAAM,CAAN,IAAY,kBA0BX;AA1BD,WAAY,kBAAkB;IAC5B,2DAAQ,CAAA;IACR,+DAAU,CAAA;IACV,mEAAY,CAAA;IACZ,yEAAe,CAAA;IACf,6DAAS,CAAA;IACT,mEAAY,CAAA;IACZ,6DAAS,CAAA;IACT,qEAAa,CAAA;IACb,+DAAU,CAAA;IACV,oEAAa,CAAA;IACb,4DAAS,CAAA;IACT,8DAAU,CAAA;IACV,4DAAS,CAAA;IACT,kEAAY,CAAA;IACZ,kEAAY,CAAA;IACZ,8DAAU,CAAA;IACV,4DAAS,CAAA;IACT,sEAAc,CAAA;IACd,gEAAW,CAAA;IACX,wEAAe,CAAA;IACf,oEAAa,CAAA;IACb,gEAAW,CAAA;IACX,8DAAU,CAAA;IACV,oEAAa,CAAA;IACb,8EAAkB,CAAA;AACpB,CAAC,EA1BW,kBAAkB,KAAlB,kBAAkB,QA0B7B;AAED,MAAM,CAAN,IAAY,qBAIX;AAJD,WAAY,qBAAqB;IAC/B,iEAAQ,CAAA;IACR,iEAAQ,CAAA;IACR,mEAAS,CAAA;AACX,CAAC,EAJW,qBAAqB,KAArB,qBAAqB,QAIhC;AAED,MAAM,CAAN,IAAY,qBAIX;AAJD,WAAY,qBAAqB;IAC/B,uEAAW,CAAA;IACX,yFAAoB,CAAA;IACpB,uHAAmC,CAAA;AACrC,CAAC,EAJW,qBAAqB,KAArB,qBAAqB,QAIhC;AAED,MAAM,CAAN,IAAY,gCAEX;AAFD,WAAY,gCAAgC;IAC1C,wGAAkB,CAAA;AACpB,CAAC,EAFW,gCAAgC,KAAhC,gCAAgC,QAE3C;AAQD;;;GAGG;AACH,MAAM,CAAN,IAAY,SA0DX;AA1DD,WAAY,SAAS;IACnB,0BAAe,CAAA;IACf,gCAAqB,CAAA;IACrB,8BAAmB,CAAA;IACnB,gCAAqB,CAAA;IACrB,0CAA+B,CAAA;IAC/B,oBAAS,CAAA;IACT,wBAAa,CAAA;IACb,0BAAe,CAAA;IACf,wBAAa,CAAA;IACb,0BAAe,CAAA;IACf,0BAAe,CAAA;IACf,sCAA2B,CAAA;IAC3B,8BAAmB,CAAA;IACnB,8BAAmB,CAAA;IACnB,0BAAe,CAAA;IACf,wCAA6B,CAAA;IAC7B,wCAA6B,CAAA;IAC7B,sBAAW,CAAA;IACX,8BAAmB,CAAA;IACnB,sCAA2B,CAAA;IAC3B,0BAAe,CAAA;IACf,wBAAa,CAAA;IACb,0BAAe,CAAA;IACf,sCAA2B,CAAA;IAC3B,iDAAsC,CAAA;IACtC,0BAAe,CAAA;IACf,4BAAiB,CAAA;IACjB,0BAAe,CAAA;IACf,wBAAa,CAAA;IACb,kCAAuB,CAAA;IACvB,kCAAuB,CAAA;IACvB,wCAA6B,CAAA;IAC7B,4CAAiC,CAAA;IACjC,0BAAe,CAAA;IACf,6BAAkB,CAAA;IAClB,wBAAa,CAAA;IACb,sCAA2B,CAAA;IAC3B,yBAAc,CAAA;IACd,8BAAmB,CAAA;IACnB,oBAAS,CAAA;IACT,qCAA0B,CAAA;IAC1B,0BAAe,CAAA;IACf,0BAAe,CAAA;IACf,wDAA6C,CAAA;IAC7C,4CAAiC,CAAA;IACjC,4BAAiB,CAAA;IACjB,oCAAyB,CAAA;IACzB,gDAAqC,CAAA;IACrC,wBAAa,CAAA;IACb,4BAAiB,CAAA;IACjB,sCAA2B,CAAA;IAC3B,iDAAsC,CAAA;IACtC,wBAAa,CAAA;IACb,gCAAqB,CAAA;IACrB,wBAAa,CAAA;IACb,wBAAa,CAAA;IACb,0BAAe,CAAA;AACjB,CAAC,EA1DW,SAAS,KAAT,SAAS,QA0DpB"}
|
package/lib/manager.d.ts
CHANGED
|
@@ -1,29 +1,116 @@
|
|
|
1
|
-
import { ISignal
|
|
1
|
+
import { ISignal } from '@lumino/signaling';
|
|
2
2
|
import { ILanguageServerManager, TLanguageServerConfigurations, TLanguageServerId, TSessionMap, TSpecsMap } from './tokens';
|
|
3
3
|
import { ServerSpecProperties } from './schema';
|
|
4
4
|
export declare class LanguageServerManager implements ILanguageServerManager {
|
|
5
|
-
protected _sessionsChanged: Signal<ILanguageServerManager, void>;
|
|
6
|
-
protected _sessions: TSessionMap;
|
|
7
|
-
protected _specs: TSpecsMap;
|
|
8
|
-
protected _version: number;
|
|
9
|
-
private _settings;
|
|
10
|
-
private _baseUrl;
|
|
11
|
-
private _statusCode;
|
|
12
|
-
private _retries;
|
|
13
|
-
private _retriesInterval;
|
|
14
|
-
private _configuration;
|
|
15
|
-
private _warningsEmitted;
|
|
16
5
|
constructor(options: ILanguageServerManager.IOptions);
|
|
6
|
+
/**
|
|
7
|
+
* Check if the manager is disposed.
|
|
8
|
+
*/
|
|
9
|
+
get isDisposed(): boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Get the language server specs.
|
|
12
|
+
*/
|
|
17
13
|
get specs(): TSpecsMap;
|
|
14
|
+
/**
|
|
15
|
+
* Get the status end point.
|
|
16
|
+
*/
|
|
18
17
|
get statusUrl(): string;
|
|
18
|
+
/**
|
|
19
|
+
* Signal emitted when a language server session is changed
|
|
20
|
+
*/
|
|
19
21
|
get sessionsChanged(): ISignal<ILanguageServerManager, void>;
|
|
22
|
+
/**
|
|
23
|
+
* Get the map of language server sessions.
|
|
24
|
+
*/
|
|
20
25
|
get sessions(): TSessionMap;
|
|
26
|
+
/**
|
|
27
|
+
* A promise resolved when this server manager is ready.
|
|
28
|
+
*/
|
|
29
|
+
get ready(): Promise<void>;
|
|
30
|
+
/**
|
|
31
|
+
* Get the status code of server's responses.
|
|
32
|
+
*/
|
|
33
|
+
get statusCode(): number;
|
|
34
|
+
/**
|
|
35
|
+
* Dispose the manager.
|
|
36
|
+
*/
|
|
37
|
+
dispose(): void;
|
|
38
|
+
/**
|
|
39
|
+
* Update the language server configuration.
|
|
40
|
+
*/
|
|
21
41
|
setConfiguration(configuration: TLanguageServerConfigurations): void;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
42
|
+
/**
|
|
43
|
+
* Get matching language server for input language option.
|
|
44
|
+
*/
|
|
25
45
|
getMatchingServers(options: ILanguageServerManager.IGetServerIdOptions): TLanguageServerId[];
|
|
46
|
+
/**
|
|
47
|
+
* Get matching language server spec for input language option.
|
|
48
|
+
*/
|
|
26
49
|
getMatchingSpecs(options: ILanguageServerManager.IGetServerIdOptions): TSpecsMap;
|
|
27
|
-
|
|
50
|
+
/**
|
|
51
|
+
* Fetch the server session list from the status endpoint. The server
|
|
52
|
+
* manager is ready once this method finishes.
|
|
53
|
+
*/
|
|
28
54
|
fetchSessions(): Promise<void>;
|
|
55
|
+
/**
|
|
56
|
+
* Version number of sever session.
|
|
57
|
+
*/
|
|
58
|
+
protected version: number;
|
|
59
|
+
/**
|
|
60
|
+
* Check if input language option maths the language server spec.
|
|
61
|
+
*/
|
|
62
|
+
protected isMatchingSpec(options: ILanguageServerManager.IGetServerIdOptions, spec: ServerSpecProperties): boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Helper function to warn a message only once.
|
|
65
|
+
*/
|
|
66
|
+
protected warnOnce(arg: string): void;
|
|
67
|
+
/**
|
|
68
|
+
* Compare the rank of two servers with the same language.
|
|
69
|
+
*/
|
|
70
|
+
protected compareRanks(a: TLanguageServerId, b: TLanguageServerId): number;
|
|
71
|
+
/**
|
|
72
|
+
* map of language server sessions.
|
|
73
|
+
*/
|
|
74
|
+
private _sessions;
|
|
75
|
+
/**
|
|
76
|
+
* Map of language server specs.
|
|
77
|
+
*/
|
|
78
|
+
private _specs;
|
|
79
|
+
/**
|
|
80
|
+
* Server connection setting.
|
|
81
|
+
*/
|
|
82
|
+
private _settings;
|
|
83
|
+
/**
|
|
84
|
+
* Base URL to connect to the language server handler.
|
|
85
|
+
*/
|
|
86
|
+
private _baseUrl;
|
|
87
|
+
/**
|
|
88
|
+
* Status code of server response
|
|
89
|
+
*/
|
|
90
|
+
private _statusCode;
|
|
91
|
+
/**
|
|
92
|
+
* Number of connection retry, default to 2.
|
|
93
|
+
*/
|
|
94
|
+
private _retries;
|
|
95
|
+
/**
|
|
96
|
+
* Interval between each retry, default to 10s.
|
|
97
|
+
*/
|
|
98
|
+
private _retriesInterval;
|
|
99
|
+
/**
|
|
100
|
+
* Language server configuration.
|
|
101
|
+
*/
|
|
102
|
+
private _configuration;
|
|
103
|
+
/**
|
|
104
|
+
* Set of emitted warning message, message in this set will not be warned again.
|
|
105
|
+
*/
|
|
106
|
+
private _warningsEmitted;
|
|
107
|
+
/**
|
|
108
|
+
* A promise resolved when this server manager is ready.
|
|
109
|
+
*/
|
|
110
|
+
private _ready;
|
|
111
|
+
/**
|
|
112
|
+
* Signal emitted when a language server session is changed
|
|
113
|
+
*/
|
|
114
|
+
private _sessionsChanged;
|
|
115
|
+
private _isDisposed;
|
|
29
116
|
}
|