@depup/vscode-languageserver 10.1.1-depup.0
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.txt +11 -0
- package/README.md +25 -0
- package/bin/installServerIntoExtension +73 -0
- package/changes.json +5 -0
- package/eslint.config.js +10 -0
- package/lib/browser/main.d.ts +20 -0
- package/lib/browser/main.js +61 -0
- package/lib/common/api.d.ts +15 -0
- package/lib/common/api.js +35 -0
- package/lib/common/callHierarchy.d.ts +15 -0
- package/lib/common/callHierarchy.js +34 -0
- package/lib/common/configuration.d.ts +9 -0
- package/lib/common/configuration.js +71 -0
- package/lib/common/diagnostic.d.ts +29 -0
- package/lib/common/diagnostic.js +30 -0
- package/lib/common/fileOperations.d.ts +16 -0
- package/lib/common/fileOperations.js +43 -0
- package/lib/common/foldingRange.d.ts +22 -0
- package/lib/common/foldingRange.js +26 -0
- package/lib/common/inlayHint.d.ts +28 -0
- package/lib/common/inlayHint.js +30 -0
- package/lib/common/inlineCompletion.d.ts +18 -0
- package/lib/common/inlineCompletion.js +22 -0
- package/lib/common/inlineValue.d.ts +22 -0
- package/lib/common/inlineValue.js +25 -0
- package/lib/common/linkedEditingRange.d.ts +16 -0
- package/lib/common/linkedEditingRange.js +18 -0
- package/lib/common/moniker.d.ts +13 -0
- package/lib/common/moniker.js +23 -0
- package/lib/common/notebook.d.ts +99 -0
- package/lib/common/notebook.js +262 -0
- package/lib/common/progress.d.ts +25 -0
- package/lib/common/progress.js +172 -0
- package/lib/common/semanticTokens.d.ts +43 -0
- package/lib/common/semanticTokens.js +251 -0
- package/lib/common/server.d.ts +812 -0
- package/lib/common/server.js +798 -0
- package/lib/common/showDocument.d.ts +6 -0
- package/lib/common/showDocument.js +16 -0
- package/lib/common/textDocumentContent.d.ts +14 -0
- package/lib/common/textDocumentContent.js +25 -0
- package/lib/common/textDocuments.d.ts +133 -0
- package/lib/common/textDocuments.js +180 -0
- package/lib/common/typeHierarchy.d.ts +15 -0
- package/lib/common/typeHierarchy.js +34 -0
- package/lib/common/utils/is.d.ts +9 -0
- package/lib/common/utils/is.js +42 -0
- package/lib/common/utils/uuid.d.ts +22 -0
- package/lib/common/utils/uuid.js +98 -0
- package/lib/common/workspaceFolder.d.ts +7 -0
- package/lib/common/workspaceFolder.js +47 -0
- package/lib/node/files.d.ts +19 -0
- package/lib/node/files.js +295 -0
- package/lib/node/main.d.ts +60 -0
- package/lib/node/main.js +295 -0
- package/lib/node/resolve.d.ts +1 -0
- package/lib/node/resolve.js +20 -0
- package/package.json +65 -0
- package/thirdpartynotices.txt +84 -0
- package/typings/thenable.d.ts +5 -0
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ShowDocumentParams, ShowDocumentResult } from 'vscode-languageserver-protocol';
|
|
2
|
+
import type { Feature, _RemoteWindow } from './server';
|
|
3
|
+
export interface ShowDocumentFeatureShape {
|
|
4
|
+
showDocument(params: ShowDocumentParams): Promise<ShowDocumentResult>;
|
|
5
|
+
}
|
|
6
|
+
export declare const ShowDocumentFeature: Feature<_RemoteWindow, ShowDocumentFeatureShape>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* --------------------------------------------------------------------------------------------
|
|
3
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4
|
+
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
5
|
+
* ------------------------------------------------------------------------------------------ */
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.ShowDocumentFeature = void 0;
|
|
8
|
+
const vscode_languageserver_protocol_1 = require("vscode-languageserver-protocol");
|
|
9
|
+
const ShowDocumentFeature = (Base) => {
|
|
10
|
+
return class extends Base {
|
|
11
|
+
showDocument(params) {
|
|
12
|
+
return this.connection.sendRequest(vscode_languageserver_protocol_1.ShowDocumentRequest.type, params);
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
exports.ShowDocumentFeature = ShowDocumentFeature;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type Disposable, type DocumentUri, type RequestHandler, type TextDocumentContentParams, type TextDocumentContentResult } from 'vscode-languageserver-protocol';
|
|
2
|
+
import type { Feature, _RemoteWorkspace } from './server';
|
|
3
|
+
/**
|
|
4
|
+
* Shape of the text document content feature
|
|
5
|
+
*
|
|
6
|
+
* @since 3.18.0
|
|
7
|
+
*/
|
|
8
|
+
export interface TextDocumentContentFeatureShape {
|
|
9
|
+
textDocumentContent: {
|
|
10
|
+
refresh(uri: DocumentUri): Promise<void>;
|
|
11
|
+
on(handler: RequestHandler<TextDocumentContentParams, TextDocumentContentResult | null, void>): Disposable;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
export declare const TextDocumentContentFeature: Feature<_RemoteWorkspace, TextDocumentContentFeatureShape>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* --------------------------------------------------------------------------------------------
|
|
3
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4
|
+
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
5
|
+
* ------------------------------------------------------------------------------------------ */
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.TextDocumentContentFeature = void 0;
|
|
8
|
+
const vscode_languageserver_protocol_1 = require("vscode-languageserver-protocol");
|
|
9
|
+
const TextDocumentContentFeature = (Base) => {
|
|
10
|
+
return class extends Base {
|
|
11
|
+
get textDocumentContent() {
|
|
12
|
+
return {
|
|
13
|
+
refresh: (uri) => {
|
|
14
|
+
return this.connection.sendRequest(vscode_languageserver_protocol_1.TextDocumentContentRefreshRequest.type, { uri });
|
|
15
|
+
},
|
|
16
|
+
on: (handler) => {
|
|
17
|
+
return this.connection.onRequest(vscode_languageserver_protocol_1.TextDocumentContentRequest.type, (params, cancel) => {
|
|
18
|
+
return handler(params, cancel);
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
exports.TextDocumentContentFeature = TextDocumentContentFeature;
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { NotificationHandler, DidOpenTextDocumentParams, DidChangeTextDocumentParams, DidCloseTextDocumentParams, WillSaveTextDocumentParams, RequestHandler, TextEdit, DidSaveTextDocumentParams, DocumentUri, TextDocumentContentChangeEvent, TextDocumentSaveReason, Event, TextDocumentSyncKind, Disposable, LanguageKind } from 'vscode-languageserver-protocol';
|
|
2
|
+
/**
|
|
3
|
+
* We should use a mapped type to create this from Connection.
|
|
4
|
+
*/
|
|
5
|
+
export interface TextDocumentConnection {
|
|
6
|
+
onDidOpenTextDocument(handler: NotificationHandler<DidOpenTextDocumentParams>): Disposable;
|
|
7
|
+
onDidChangeTextDocument(handler: NotificationHandler<DidChangeTextDocumentParams>): Disposable;
|
|
8
|
+
onDidCloseTextDocument(handler: NotificationHandler<DidCloseTextDocumentParams>): Disposable;
|
|
9
|
+
onWillSaveTextDocument(handler: NotificationHandler<WillSaveTextDocumentParams>): Disposable;
|
|
10
|
+
onWillSaveTextDocumentWaitUntil(handler: RequestHandler<WillSaveTextDocumentParams, TextEdit[] | undefined | null, void>): Disposable;
|
|
11
|
+
onDidSaveTextDocument(handler: NotificationHandler<DidSaveTextDocumentParams>): Disposable;
|
|
12
|
+
}
|
|
13
|
+
export interface ConnectionState {
|
|
14
|
+
__textDocumentSync: TextDocumentSyncKind | undefined;
|
|
15
|
+
}
|
|
16
|
+
export interface TextDocumentsConfiguration<T extends {
|
|
17
|
+
uri: DocumentUri;
|
|
18
|
+
}> {
|
|
19
|
+
create(uri: DocumentUri, languageId: LanguageKind, version: number, content: string): T;
|
|
20
|
+
update(document: T, changes: TextDocumentContentChangeEvent[], version: number): T;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Event to signal changes to a text document.
|
|
24
|
+
*/
|
|
25
|
+
export interface TextDocumentChangeEvent<T> {
|
|
26
|
+
/**
|
|
27
|
+
* The document that has changed.
|
|
28
|
+
*/
|
|
29
|
+
document: T;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Event to signal that a document will be saved.
|
|
33
|
+
*/
|
|
34
|
+
export interface TextDocumentWillSaveEvent<T> {
|
|
35
|
+
/**
|
|
36
|
+
* The document that will be saved
|
|
37
|
+
*/
|
|
38
|
+
document: T;
|
|
39
|
+
/**
|
|
40
|
+
* The reason why save was triggered.
|
|
41
|
+
*/
|
|
42
|
+
reason: TextDocumentSaveReason;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* A manager for simple text documents. The manager requires at a minimum that
|
|
46
|
+
* the server registered for the following text document sync events in the
|
|
47
|
+
* initialize handler or via dynamic registration:
|
|
48
|
+
*
|
|
49
|
+
* - open and close events.
|
|
50
|
+
* - change events.
|
|
51
|
+
*
|
|
52
|
+
* Registering for save and will save events is optional.
|
|
53
|
+
*/
|
|
54
|
+
export declare class TextDocuments<T extends {
|
|
55
|
+
uri: DocumentUri;
|
|
56
|
+
}> {
|
|
57
|
+
private readonly _configuration;
|
|
58
|
+
private readonly _syncedDocuments;
|
|
59
|
+
private readonly _onDidChangeContent;
|
|
60
|
+
private readonly _onDidOpen;
|
|
61
|
+
private readonly _onDidClose;
|
|
62
|
+
private readonly _onDidSave;
|
|
63
|
+
private readonly _onWillSave;
|
|
64
|
+
private _willSaveWaitUntil;
|
|
65
|
+
/**
|
|
66
|
+
* Create a new text document manager.
|
|
67
|
+
*/
|
|
68
|
+
constructor(configuration: TextDocumentsConfiguration<T>);
|
|
69
|
+
/**
|
|
70
|
+
* An event that fires when a text document managed by this manager
|
|
71
|
+
* has been opened.
|
|
72
|
+
*/
|
|
73
|
+
get onDidOpen(): Event<TextDocumentChangeEvent<T>>;
|
|
74
|
+
/**
|
|
75
|
+
* An event that fires when a text document managed by this manager
|
|
76
|
+
* has been opened or the content changes.
|
|
77
|
+
*/
|
|
78
|
+
get onDidChangeContent(): Event<TextDocumentChangeEvent<T>>;
|
|
79
|
+
/**
|
|
80
|
+
* An event that fires when a text document managed by this manager
|
|
81
|
+
* will be saved.
|
|
82
|
+
*/
|
|
83
|
+
get onWillSave(): Event<TextDocumentWillSaveEvent<T>>;
|
|
84
|
+
/**
|
|
85
|
+
* Sets a handler that will be called if a participant wants to provide
|
|
86
|
+
* edits during a text document save.
|
|
87
|
+
*/
|
|
88
|
+
onWillSaveWaitUntil(handler: RequestHandler<TextDocumentWillSaveEvent<T>, TextEdit[], void>): void;
|
|
89
|
+
/**
|
|
90
|
+
* An event that fires when a text document managed by this manager
|
|
91
|
+
* has been saved.
|
|
92
|
+
*/
|
|
93
|
+
get onDidSave(): Event<TextDocumentChangeEvent<T>>;
|
|
94
|
+
/**
|
|
95
|
+
* An event that fires when a text document managed by this manager
|
|
96
|
+
* has been closed.
|
|
97
|
+
*/
|
|
98
|
+
get onDidClose(): Event<TextDocumentChangeEvent<T>>;
|
|
99
|
+
/**
|
|
100
|
+
* Returns the document for the given URI. Returns undefined if
|
|
101
|
+
* the document is not managed by this instance.
|
|
102
|
+
*
|
|
103
|
+
* @param uri The text document's URI to retrieve.
|
|
104
|
+
* @return the text document or `undefined`.
|
|
105
|
+
*/
|
|
106
|
+
get(uri: string): T | undefined;
|
|
107
|
+
/**
|
|
108
|
+
* Returns all text documents managed by this instance.
|
|
109
|
+
*
|
|
110
|
+
* @return all text documents.
|
|
111
|
+
*/
|
|
112
|
+
all(): T[];
|
|
113
|
+
/**
|
|
114
|
+
* Returns the URIs of all text documents managed by this instance.
|
|
115
|
+
*
|
|
116
|
+
* @return the URI's of all text documents.
|
|
117
|
+
*/
|
|
118
|
+
keys(): string[];
|
|
119
|
+
/**
|
|
120
|
+
* Listens for `low level` notification on the given connection to
|
|
121
|
+
* update the text documents managed by this instance.
|
|
122
|
+
*
|
|
123
|
+
* Please note that the connection only provides handlers not an event model. Therefore
|
|
124
|
+
* listening on a connection will overwrite the following handlers on a connection:
|
|
125
|
+
* `onDidOpenTextDocument`, `onDidChangeTextDocument`, `onDidCloseTextDocument`,
|
|
126
|
+
* `onWillSaveTextDocument`, `onWillSaveTextDocumentWaitUntil` and `onDidSaveTextDocument`.
|
|
127
|
+
*
|
|
128
|
+
* Use the corresponding events on the TextDocuments instance instead.
|
|
129
|
+
*
|
|
130
|
+
* @param connection The connection to listen on.
|
|
131
|
+
*/
|
|
132
|
+
listen(connection: TextDocumentConnection): Disposable;
|
|
133
|
+
}
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* --------------------------------------------------------------------------------------------
|
|
3
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4
|
+
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
5
|
+
* ------------------------------------------------------------------------------------------ */
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.TextDocuments = void 0;
|
|
8
|
+
const vscode_languageserver_protocol_1 = require("vscode-languageserver-protocol");
|
|
9
|
+
/**
|
|
10
|
+
* A manager for simple text documents. The manager requires at a minimum that
|
|
11
|
+
* the server registered for the following text document sync events in the
|
|
12
|
+
* initialize handler or via dynamic registration:
|
|
13
|
+
*
|
|
14
|
+
* - open and close events.
|
|
15
|
+
* - change events.
|
|
16
|
+
*
|
|
17
|
+
* Registering for save and will save events is optional.
|
|
18
|
+
*/
|
|
19
|
+
class TextDocuments {
|
|
20
|
+
_configuration;
|
|
21
|
+
_syncedDocuments;
|
|
22
|
+
_onDidChangeContent;
|
|
23
|
+
_onDidOpen;
|
|
24
|
+
_onDidClose;
|
|
25
|
+
_onDidSave;
|
|
26
|
+
_onWillSave;
|
|
27
|
+
_willSaveWaitUntil;
|
|
28
|
+
/**
|
|
29
|
+
* Create a new text document manager.
|
|
30
|
+
*/
|
|
31
|
+
constructor(configuration) {
|
|
32
|
+
this._configuration = configuration;
|
|
33
|
+
this._syncedDocuments = new Map();
|
|
34
|
+
this._onDidChangeContent = new vscode_languageserver_protocol_1.Emitter();
|
|
35
|
+
this._onDidOpen = new vscode_languageserver_protocol_1.Emitter();
|
|
36
|
+
this._onDidClose = new vscode_languageserver_protocol_1.Emitter();
|
|
37
|
+
this._onDidSave = new vscode_languageserver_protocol_1.Emitter();
|
|
38
|
+
this._onWillSave = new vscode_languageserver_protocol_1.Emitter();
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* An event that fires when a text document managed by this manager
|
|
42
|
+
* has been opened.
|
|
43
|
+
*/
|
|
44
|
+
get onDidOpen() {
|
|
45
|
+
return this._onDidOpen.event;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* An event that fires when a text document managed by this manager
|
|
49
|
+
* has been opened or the content changes.
|
|
50
|
+
*/
|
|
51
|
+
get onDidChangeContent() {
|
|
52
|
+
return this._onDidChangeContent.event;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* An event that fires when a text document managed by this manager
|
|
56
|
+
* will be saved.
|
|
57
|
+
*/
|
|
58
|
+
get onWillSave() {
|
|
59
|
+
return this._onWillSave.event;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Sets a handler that will be called if a participant wants to provide
|
|
63
|
+
* edits during a text document save.
|
|
64
|
+
*/
|
|
65
|
+
onWillSaveWaitUntil(handler) {
|
|
66
|
+
this._willSaveWaitUntil = handler;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* An event that fires when a text document managed by this manager
|
|
70
|
+
* has been saved.
|
|
71
|
+
*/
|
|
72
|
+
get onDidSave() {
|
|
73
|
+
return this._onDidSave.event;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* An event that fires when a text document managed by this manager
|
|
77
|
+
* has been closed.
|
|
78
|
+
*/
|
|
79
|
+
get onDidClose() {
|
|
80
|
+
return this._onDidClose.event;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Returns the document for the given URI. Returns undefined if
|
|
84
|
+
* the document is not managed by this instance.
|
|
85
|
+
*
|
|
86
|
+
* @param uri The text document's URI to retrieve.
|
|
87
|
+
* @return the text document or `undefined`.
|
|
88
|
+
*/
|
|
89
|
+
get(uri) {
|
|
90
|
+
return this._syncedDocuments.get(uri);
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Returns all text documents managed by this instance.
|
|
94
|
+
*
|
|
95
|
+
* @return all text documents.
|
|
96
|
+
*/
|
|
97
|
+
all() {
|
|
98
|
+
return Array.from(this._syncedDocuments.values());
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Returns the URIs of all text documents managed by this instance.
|
|
102
|
+
*
|
|
103
|
+
* @return the URI's of all text documents.
|
|
104
|
+
*/
|
|
105
|
+
keys() {
|
|
106
|
+
return Array.from(this._syncedDocuments.keys());
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Listens for `low level` notification on the given connection to
|
|
110
|
+
* update the text documents managed by this instance.
|
|
111
|
+
*
|
|
112
|
+
* Please note that the connection only provides handlers not an event model. Therefore
|
|
113
|
+
* listening on a connection will overwrite the following handlers on a connection:
|
|
114
|
+
* `onDidOpenTextDocument`, `onDidChangeTextDocument`, `onDidCloseTextDocument`,
|
|
115
|
+
* `onWillSaveTextDocument`, `onWillSaveTextDocumentWaitUntil` and `onDidSaveTextDocument`.
|
|
116
|
+
*
|
|
117
|
+
* Use the corresponding events on the TextDocuments instance instead.
|
|
118
|
+
*
|
|
119
|
+
* @param connection The connection to listen on.
|
|
120
|
+
*/
|
|
121
|
+
listen(connection) {
|
|
122
|
+
connection.__textDocumentSync = vscode_languageserver_protocol_1.TextDocumentSyncKind.Incremental;
|
|
123
|
+
const disposables = [];
|
|
124
|
+
disposables.push(connection.onDidOpenTextDocument((event) => {
|
|
125
|
+
const td = event.textDocument;
|
|
126
|
+
const document = this._configuration.create(td.uri, td.languageId, td.version, td.text);
|
|
127
|
+
this._syncedDocuments.set(td.uri, document);
|
|
128
|
+
const toFire = Object.freeze({ document });
|
|
129
|
+
this._onDidOpen.fire(toFire);
|
|
130
|
+
this._onDidChangeContent.fire(toFire);
|
|
131
|
+
}));
|
|
132
|
+
disposables.push(connection.onDidChangeTextDocument((event) => {
|
|
133
|
+
const td = event.textDocument;
|
|
134
|
+
const changes = event.contentChanges;
|
|
135
|
+
if (changes.length === 0) {
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
const { version } = td;
|
|
139
|
+
if (version === null || version === undefined) {
|
|
140
|
+
throw new Error(`Received document change event for ${td.uri} without valid version identifier`);
|
|
141
|
+
}
|
|
142
|
+
let syncedDocument = this._syncedDocuments.get(td.uri);
|
|
143
|
+
if (syncedDocument !== undefined) {
|
|
144
|
+
syncedDocument = this._configuration.update(syncedDocument, changes, version);
|
|
145
|
+
this._syncedDocuments.set(td.uri, syncedDocument);
|
|
146
|
+
this._onDidChangeContent.fire(Object.freeze({ document: syncedDocument }));
|
|
147
|
+
}
|
|
148
|
+
}));
|
|
149
|
+
disposables.push(connection.onDidCloseTextDocument((event) => {
|
|
150
|
+
const syncedDocument = this._syncedDocuments.get(event.textDocument.uri);
|
|
151
|
+
if (syncedDocument !== undefined) {
|
|
152
|
+
this._syncedDocuments.delete(event.textDocument.uri);
|
|
153
|
+
this._onDidClose.fire(Object.freeze({ document: syncedDocument }));
|
|
154
|
+
}
|
|
155
|
+
}));
|
|
156
|
+
disposables.push(connection.onWillSaveTextDocument((event) => {
|
|
157
|
+
const syncedDocument = this._syncedDocuments.get(event.textDocument.uri);
|
|
158
|
+
if (syncedDocument !== undefined) {
|
|
159
|
+
this._onWillSave.fire(Object.freeze({ document: syncedDocument, reason: event.reason }));
|
|
160
|
+
}
|
|
161
|
+
}));
|
|
162
|
+
disposables.push(connection.onWillSaveTextDocumentWaitUntil((event, token) => {
|
|
163
|
+
const syncedDocument = this._syncedDocuments.get(event.textDocument.uri);
|
|
164
|
+
if (syncedDocument !== undefined && this._willSaveWaitUntil) {
|
|
165
|
+
return this._willSaveWaitUntil(Object.freeze({ document: syncedDocument, reason: event.reason }), token);
|
|
166
|
+
}
|
|
167
|
+
else {
|
|
168
|
+
return [];
|
|
169
|
+
}
|
|
170
|
+
}));
|
|
171
|
+
disposables.push(connection.onDidSaveTextDocument((event) => {
|
|
172
|
+
const syncedDocument = this._syncedDocuments.get(event.textDocument.uri);
|
|
173
|
+
if (syncedDocument !== undefined) {
|
|
174
|
+
this._onDidSave.fire(Object.freeze({ document: syncedDocument }));
|
|
175
|
+
}
|
|
176
|
+
}));
|
|
177
|
+
return vscode_languageserver_protocol_1.Disposable.create(() => { disposables.forEach(disposable => disposable.dispose()); });
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
exports.TextDocuments = TextDocuments;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { TypeHierarchyItem, Disposable, TypeHierarchyPrepareParams, TypeHierarchySupertypesParams, TypeHierarchySubtypesParams } from 'vscode-languageserver-protocol';
|
|
2
|
+
import type { Feature, _Languages, ServerRequestHandler } from './server';
|
|
3
|
+
/**
|
|
4
|
+
* Shape of the type hierarchy feature
|
|
5
|
+
*
|
|
6
|
+
* @since 3.17.0
|
|
7
|
+
*/
|
|
8
|
+
export interface TypeHierarchyFeatureShape {
|
|
9
|
+
typeHierarchy: {
|
|
10
|
+
onPrepare(handler: ServerRequestHandler<TypeHierarchyPrepareParams, TypeHierarchyItem[] | null, never, void>): Disposable;
|
|
11
|
+
onSupertypes(handler: ServerRequestHandler<TypeHierarchySupertypesParams, TypeHierarchyItem[] | null, TypeHierarchyItem[], void>): Disposable;
|
|
12
|
+
onSubtypes(handler: ServerRequestHandler<TypeHierarchySubtypesParams, TypeHierarchyItem[] | null, TypeHierarchyItem[], void>): Disposable;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
export declare const TypeHierarchyFeature: Feature<_Languages, TypeHierarchyFeatureShape>;
|
|
@@ -0,0 +1,34 @@
|
|
|
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
|
+
'use strict';
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.TypeHierarchyFeature = void 0;
|
|
8
|
+
const vscode_languageserver_protocol_1 = require("vscode-languageserver-protocol");
|
|
9
|
+
const TypeHierarchyFeature = (Base) => {
|
|
10
|
+
return class extends Base {
|
|
11
|
+
get typeHierarchy() {
|
|
12
|
+
return {
|
|
13
|
+
onPrepare: (handler) => {
|
|
14
|
+
return this.connection.onRequest(vscode_languageserver_protocol_1.TypeHierarchyPrepareRequest.type, (params, cancel) => {
|
|
15
|
+
return handler(params, cancel, this.attachWorkDoneProgress(params), undefined);
|
|
16
|
+
});
|
|
17
|
+
},
|
|
18
|
+
onSupertypes: (handler) => {
|
|
19
|
+
const type = vscode_languageserver_protocol_1.TypeHierarchySupertypesRequest.type;
|
|
20
|
+
return this.connection.onRequest(type, (params, cancel) => {
|
|
21
|
+
return handler(params, cancel, this.attachWorkDoneProgress(params), this.attachPartialResultProgress(type, params));
|
|
22
|
+
});
|
|
23
|
+
},
|
|
24
|
+
onSubtypes: (handler) => {
|
|
25
|
+
const type = vscode_languageserver_protocol_1.TypeHierarchySubtypesRequest.type;
|
|
26
|
+
return this.connection.onRequest(type, (params, cancel) => {
|
|
27
|
+
return handler(params, cancel, this.attachWorkDoneProgress(params), this.attachPartialResultProgress(type, params));
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
exports.TypeHierarchyFeature = TypeHierarchyFeature;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare function boolean(value: any): value is boolean;
|
|
2
|
+
export declare function string(value: any): value is string;
|
|
3
|
+
export declare function number(value: any): value is number;
|
|
4
|
+
export declare function error(value: any): value is Error;
|
|
5
|
+
export declare function func(value: any): value is Function;
|
|
6
|
+
export declare function array<T>(value: any): value is T[];
|
|
7
|
+
export declare function stringArray(value: any): value is string[];
|
|
8
|
+
export declare function typedArray<T>(value: any, check: (value: any) => boolean): value is T[];
|
|
9
|
+
export declare function thenable<T>(value: any): value is Thenable<T>;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* --------------------------------------------------------------------------------------------
|
|
3
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4
|
+
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
5
|
+
* ------------------------------------------------------------------------------------------ */
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.boolean = boolean;
|
|
8
|
+
exports.string = string;
|
|
9
|
+
exports.number = number;
|
|
10
|
+
exports.error = error;
|
|
11
|
+
exports.func = func;
|
|
12
|
+
exports.array = array;
|
|
13
|
+
exports.stringArray = stringArray;
|
|
14
|
+
exports.typedArray = typedArray;
|
|
15
|
+
exports.thenable = thenable;
|
|
16
|
+
function boolean(value) {
|
|
17
|
+
return value === true || value === false;
|
|
18
|
+
}
|
|
19
|
+
function string(value) {
|
|
20
|
+
return typeof value === 'string' || value instanceof String;
|
|
21
|
+
}
|
|
22
|
+
function number(value) {
|
|
23
|
+
return typeof value === 'number' || value instanceof Number;
|
|
24
|
+
}
|
|
25
|
+
function error(value) {
|
|
26
|
+
return value instanceof Error;
|
|
27
|
+
}
|
|
28
|
+
function func(value) {
|
|
29
|
+
return typeof value === 'function';
|
|
30
|
+
}
|
|
31
|
+
function array(value) {
|
|
32
|
+
return Array.isArray(value);
|
|
33
|
+
}
|
|
34
|
+
function stringArray(value) {
|
|
35
|
+
return array(value) && value.every(elem => string(elem));
|
|
36
|
+
}
|
|
37
|
+
function typedArray(value, check) {
|
|
38
|
+
return Array.isArray(value) && value.every(check);
|
|
39
|
+
}
|
|
40
|
+
function thenable(value) {
|
|
41
|
+
return value && func(value.then);
|
|
42
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents a UUID as defined by rfc4122.
|
|
3
|
+
*/
|
|
4
|
+
export interface UUID {
|
|
5
|
+
/**
|
|
6
|
+
* @returns the canonical representation in sets of hexadecimal numbers separated by dashes.
|
|
7
|
+
*/
|
|
8
|
+
asHex(): string;
|
|
9
|
+
equals(other: UUID): boolean;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* An empty UUID that contains only zeros.
|
|
13
|
+
*/
|
|
14
|
+
export declare const empty: UUID;
|
|
15
|
+
export declare function v4(): UUID;
|
|
16
|
+
export declare function isUUID(value: string): boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Parses a UUID that is of the format xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.
|
|
19
|
+
* @param value A uuid string.
|
|
20
|
+
*/
|
|
21
|
+
export declare function parse(value: string): UUID;
|
|
22
|
+
export declare function generateUuid(): string;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*---------------------------------------------------------------------------------------------
|
|
3
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4
|
+
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
5
|
+
*--------------------------------------------------------------------------------------------*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.empty = void 0;
|
|
8
|
+
exports.v4 = v4;
|
|
9
|
+
exports.isUUID = isUUID;
|
|
10
|
+
exports.parse = parse;
|
|
11
|
+
exports.generateUuid = generateUuid;
|
|
12
|
+
class ValueUUID {
|
|
13
|
+
_value;
|
|
14
|
+
constructor(_value) {
|
|
15
|
+
this._value = _value;
|
|
16
|
+
// empty
|
|
17
|
+
}
|
|
18
|
+
asHex() {
|
|
19
|
+
return this._value;
|
|
20
|
+
}
|
|
21
|
+
equals(other) {
|
|
22
|
+
return this.asHex() === other.asHex();
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
class V4UUID extends ValueUUID {
|
|
26
|
+
static _chars = ['0', '1', '2', '3', '4', '5', '6', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'];
|
|
27
|
+
static _timeHighBits = ['8', '9', 'a', 'b'];
|
|
28
|
+
static _oneOf(array) {
|
|
29
|
+
return array[Math.floor(array.length * Math.random())];
|
|
30
|
+
}
|
|
31
|
+
static _randomHex() {
|
|
32
|
+
return V4UUID._oneOf(V4UUID._chars);
|
|
33
|
+
}
|
|
34
|
+
constructor() {
|
|
35
|
+
super([
|
|
36
|
+
V4UUID._randomHex(),
|
|
37
|
+
V4UUID._randomHex(),
|
|
38
|
+
V4UUID._randomHex(),
|
|
39
|
+
V4UUID._randomHex(),
|
|
40
|
+
V4UUID._randomHex(),
|
|
41
|
+
V4UUID._randomHex(),
|
|
42
|
+
V4UUID._randomHex(),
|
|
43
|
+
V4UUID._randomHex(),
|
|
44
|
+
'-',
|
|
45
|
+
V4UUID._randomHex(),
|
|
46
|
+
V4UUID._randomHex(),
|
|
47
|
+
V4UUID._randomHex(),
|
|
48
|
+
V4UUID._randomHex(),
|
|
49
|
+
'-',
|
|
50
|
+
'4',
|
|
51
|
+
V4UUID._randomHex(),
|
|
52
|
+
V4UUID._randomHex(),
|
|
53
|
+
V4UUID._randomHex(),
|
|
54
|
+
'-',
|
|
55
|
+
V4UUID._oneOf(V4UUID._timeHighBits),
|
|
56
|
+
V4UUID._randomHex(),
|
|
57
|
+
V4UUID._randomHex(),
|
|
58
|
+
V4UUID._randomHex(),
|
|
59
|
+
'-',
|
|
60
|
+
V4UUID._randomHex(),
|
|
61
|
+
V4UUID._randomHex(),
|
|
62
|
+
V4UUID._randomHex(),
|
|
63
|
+
V4UUID._randomHex(),
|
|
64
|
+
V4UUID._randomHex(),
|
|
65
|
+
V4UUID._randomHex(),
|
|
66
|
+
V4UUID._randomHex(),
|
|
67
|
+
V4UUID._randomHex(),
|
|
68
|
+
V4UUID._randomHex(),
|
|
69
|
+
V4UUID._randomHex(),
|
|
70
|
+
V4UUID._randomHex(),
|
|
71
|
+
V4UUID._randomHex(),
|
|
72
|
+
].join(''));
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* An empty UUID that contains only zeros.
|
|
77
|
+
*/
|
|
78
|
+
exports.empty = new ValueUUID('00000000-0000-0000-0000-000000000000');
|
|
79
|
+
function v4() {
|
|
80
|
+
return new V4UUID();
|
|
81
|
+
}
|
|
82
|
+
const _UUIDPattern = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
83
|
+
function isUUID(value) {
|
|
84
|
+
return _UUIDPattern.test(value);
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Parses a UUID that is of the format xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.
|
|
88
|
+
* @param value A uuid string.
|
|
89
|
+
*/
|
|
90
|
+
function parse(value) {
|
|
91
|
+
if (!isUUID(value)) {
|
|
92
|
+
throw new Error('invalid uuid');
|
|
93
|
+
}
|
|
94
|
+
return new ValueUUID(value);
|
|
95
|
+
}
|
|
96
|
+
function generateUuid() {
|
|
97
|
+
return v4().asHex();
|
|
98
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Event, WorkspaceFolder, WorkspaceFoldersChangeEvent } from 'vscode-languageserver-protocol';
|
|
2
|
+
import type { Feature, _RemoteWorkspace } from './server';
|
|
3
|
+
export interface WorkspaceFolders {
|
|
4
|
+
getWorkspaceFolders(): Promise<WorkspaceFolder[] | null>;
|
|
5
|
+
onDidChangeWorkspaceFolders: Event<WorkspaceFoldersChangeEvent>;
|
|
6
|
+
}
|
|
7
|
+
export declare const WorkspaceFoldersFeature: Feature<_RemoteWorkspace, WorkspaceFolders>;
|
|
@@ -0,0 +1,47 @@
|
|
|
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
|
+
'use strict';
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.WorkspaceFoldersFeature = void 0;
|
|
8
|
+
const vscode_languageserver_protocol_1 = require("vscode-languageserver-protocol");
|
|
9
|
+
const WorkspaceFoldersFeature = (Base) => {
|
|
10
|
+
return class extends Base {
|
|
11
|
+
_onDidChangeWorkspaceFolders;
|
|
12
|
+
_unregistration;
|
|
13
|
+
_notificationIsAutoRegistered;
|
|
14
|
+
constructor() {
|
|
15
|
+
super();
|
|
16
|
+
this._notificationIsAutoRegistered = false;
|
|
17
|
+
}
|
|
18
|
+
initialize(capabilities) {
|
|
19
|
+
super.initialize(capabilities);
|
|
20
|
+
const workspaceCapabilities = capabilities.workspace;
|
|
21
|
+
if (workspaceCapabilities && workspaceCapabilities.workspaceFolders) {
|
|
22
|
+
this._onDidChangeWorkspaceFolders = new vscode_languageserver_protocol_1.Emitter();
|
|
23
|
+
this.connection.onNotification(vscode_languageserver_protocol_1.DidChangeWorkspaceFoldersNotification.type, (params) => {
|
|
24
|
+
this._onDidChangeWorkspaceFolders.fire(params.event);
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
fillServerCapabilities(capabilities) {
|
|
29
|
+
super.fillServerCapabilities(capabilities);
|
|
30
|
+
const changeNotifications = capabilities.workspace?.workspaceFolders?.changeNotifications;
|
|
31
|
+
this._notificationIsAutoRegistered = changeNotifications === true || typeof changeNotifications === 'string';
|
|
32
|
+
}
|
|
33
|
+
getWorkspaceFolders() {
|
|
34
|
+
return this.connection.sendRequest(vscode_languageserver_protocol_1.WorkspaceFoldersRequest.type);
|
|
35
|
+
}
|
|
36
|
+
get onDidChangeWorkspaceFolders() {
|
|
37
|
+
if (!this._onDidChangeWorkspaceFolders) {
|
|
38
|
+
throw new Error('Client doesn\'t support sending workspace folder change events.');
|
|
39
|
+
}
|
|
40
|
+
if (!this._notificationIsAutoRegistered && !this._unregistration) {
|
|
41
|
+
this._unregistration = this.connection.client.register(vscode_languageserver_protocol_1.DidChangeWorkspaceFoldersNotification.type);
|
|
42
|
+
}
|
|
43
|
+
return this._onDidChangeWorkspaceFolders.event;
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
exports.WorkspaceFoldersFeature = WorkspaceFoldersFeature;
|