@codingame/monaco-languageclient-wrapper 8.0.0 → 10.0.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/dist/createLanguageClient.js +9 -9
- package/dist/customRequests.js +1 -1
- package/dist/extensionConfiguration.js +3 -1
- package/dist/extensions/cobol.js +4 -4
- package/dist/extensions/java/extension.js +1 -1
- package/dist/extensions/java/inlayHintsProvider.js +3 -3
- package/dist/extensions/java/sourceAction.js +11 -11
- package/dist/extensions/java.js +4 -2
- package/dist/extensions/tools.js +42 -14
- package/dist/extensions.js +23 -14
- package/dist/index.d.ts +1 -1
- package/dist/infrastructure.js +10 -9
- package/dist/languageClient.js +14 -16
- package/dist/languageClientOptions.js +1 -1
- package/dist/services.js +1 -1
- package/dist/staticOptions.js +27 -46
- package/package.json +34 -43
- package/stats.html +2230 -2123
|
@@ -37,7 +37,7 @@ class MiddlewareMessageReader {
|
|
|
37
37
|
};
|
|
38
38
|
}
|
|
39
39
|
listen(callback) {
|
|
40
|
-
return this.delegate.listen(message => {
|
|
40
|
+
return this.delegate.listen((message) => {
|
|
41
41
|
callback(this.middleware(message));
|
|
42
42
|
});
|
|
43
43
|
}
|
|
@@ -56,17 +56,17 @@ class MonacoLanguageClient extends BaseLanguageClient {
|
|
|
56
56
|
}
|
|
57
57
|
function hackTransports(transports) {
|
|
58
58
|
return {
|
|
59
|
-
reader: new MiddlewareMessageReader(transports.reader, message => {
|
|
59
|
+
reader: new MiddlewareMessageReader(transports.reader, (message) => {
|
|
60
60
|
return message;
|
|
61
61
|
}),
|
|
62
|
-
writer: new MiddlewareMessageWriter(transports.writer, message => {
|
|
62
|
+
writer: new MiddlewareMessageWriter(transports.writer, (message) => {
|
|
63
63
|
var _a, _b, _c;
|
|
64
64
|
if (Message.isRequest(message) && message.method === InitializeRequest.type.method) {
|
|
65
65
|
const params = message.params;
|
|
66
66
|
const fixedParams = {
|
|
67
67
|
...params,
|
|
68
|
-
rootPath: (_a = params.rootPath) === null || _a ===
|
|
69
|
-
rootUri: (_c = (_b = params.rootUri) === null || _b ===
|
|
68
|
+
rootPath: (_a = params.rootPath) === null || _a === undefined ? undefined : _a.replace(/\\/g, '/'),
|
|
69
|
+
rootUri: (_c = (_b = params.rootUri) === null || _b === undefined ? undefined : _b.replace(/\\/g, '/')) !== null && _c !== undefined ? _c : null
|
|
70
70
|
};
|
|
71
71
|
return {
|
|
72
72
|
...message,
|
|
@@ -89,12 +89,12 @@ class CGLSPConnectionProvider {
|
|
|
89
89
|
async function createLanguageClient(id, infrastructure, { documentSelector, synchronize, initializationOptions, createAdditionalFeatures }, errorHandler, middleware) {
|
|
90
90
|
const allInitializationOptions = () => {
|
|
91
91
|
var _a;
|
|
92
|
-
const infrastructureInitOptions = (_a = infrastructure.getInitializationOptions) === null || _a ===
|
|
92
|
+
const infrastructureInitOptions = (_a = infrastructure.getInitializationOptions) === null || _a === undefined ? undefined : _a.call(infrastructure, documentSelector);
|
|
93
93
|
const languageInitOptions = typeof initializationOptions === 'function' ? initializationOptions() : initializationOptions;
|
|
94
94
|
if (infrastructureInitOptions != null || languageInitOptions != null) {
|
|
95
95
|
return {
|
|
96
|
-
...(infrastructureInitOptions !== null && infrastructureInitOptions !==
|
|
97
|
-
...(languageInitOptions !== null && languageInitOptions !==
|
|
96
|
+
...(infrastructureInitOptions !== null && infrastructureInitOptions !== undefined ? infrastructureInitOptions : {}),
|
|
97
|
+
...(languageInitOptions !== null && languageInitOptions !== undefined ? languageInitOptions : {})
|
|
98
98
|
};
|
|
99
99
|
}
|
|
100
100
|
return undefined;
|
|
@@ -109,7 +109,7 @@ async function createLanguageClient(id, infrastructure, { documentSelector, sync
|
|
|
109
109
|
try {
|
|
110
110
|
connection.dispose();
|
|
111
111
|
}
|
|
112
|
-
catch
|
|
112
|
+
catch {
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
115
|
}
|
package/dist/customRequests.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ProtocolRequestType, ProtocolNotificationType } from 'vscode-languageserver-protocol';
|
|
2
2
|
const willShutdownNotificationType = new ProtocolNotificationType('willShutdown');
|
|
3
3
|
const writeFileRequestType = new ProtocolRequestType('file/write');
|
|
4
4
|
const readFileRequestType = new ProtocolRequestType('file/read');
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { registerDefaultConfigurations } from '@codingame/monaco-editor-wrapper';
|
|
2
2
|
async function loadExtensionConfigurations(clientOptions) {
|
|
3
|
-
registerDefaultConfigurations(clientOptions
|
|
3
|
+
registerDefaultConfigurations(clientOptions
|
|
4
|
+
.map((clientOption) => clientOption.defaultConfigurationOverride)
|
|
5
|
+
.filter((v) => v != null));
|
|
4
6
|
}
|
|
5
7
|
export { loadExtensionConfigurations };
|
package/dist/extensions/cobol.js
CHANGED
|
@@ -11,16 +11,16 @@ class CobolResolveSubroutineFeature extends ExtensionFeature {
|
|
|
11
11
|
context.subscriptions.push(this.languageClient.onRequest(ResolveCobolSubroutineRequestType, (routineName) => {
|
|
12
12
|
var _a, _b, _c, _d;
|
|
13
13
|
const constantRoutinePaths = {
|
|
14
|
-
'assert-equals': `file:${(_c = (_b = (_a = vscode.workspace.workspaceFolders) === null || _a ===
|
|
14
|
+
'assert-equals': `file:${(_c = (_b = (_a = vscode.workspace.workspaceFolders) === null || _a === undefined ? undefined : _a[0]) === null || _b === undefined ? undefined : _b.uri.fsPath) !== null && _c !== undefined ? _c : '/tmp/project'}/deps/assert-equals.cbl`
|
|
15
15
|
};
|
|
16
16
|
const contantRoutinePath = constantRoutinePaths[routineName.toLowerCase()];
|
|
17
17
|
if (contantRoutinePath != null) {
|
|
18
18
|
return contantRoutinePath;
|
|
19
19
|
}
|
|
20
20
|
return (_d = vscode.workspace.textDocuments
|
|
21
|
-
.filter(textDocument => vscode.languages.match(documentSelector, textDocument))
|
|
22
|
-
.filter(document => document.getText().match(new RegExp(`PROGRAM-ID\\.\\W+${routineName}\\.`, 'gi')))
|
|
23
|
-
.sort((a, b) => a.uri.toString().localeCompare(b.uri.toString()))[0]) === null || _d ===
|
|
21
|
+
.filter((textDocument) => vscode.languages.match(documentSelector, textDocument))
|
|
22
|
+
.filter((document) => document.getText().match(new RegExp(`PROGRAM-ID\\.\\W+${routineName}\\.`, 'gi')))
|
|
23
|
+
.sort((a, b) => a.uri.toString().localeCompare(b.uri.toString()))[0]) === null || _d === undefined ? undefined : _d.uri.toString();
|
|
24
24
|
}));
|
|
25
25
|
}
|
|
26
26
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __awaiter } from '../../node_modules/tslib/tslib.es6.js';
|
|
2
2
|
import { workspace } from 'vscode';
|
|
3
3
|
function applyWorkspaceEdit(obj, languageClient) {
|
|
4
|
-
return __awaiter(this,
|
|
4
|
+
return __awaiter(this, undefined, undefined, function* () {
|
|
5
5
|
const edit = languageClient.protocol2CodeConverter.asWorkspaceEdit(obj);
|
|
6
6
|
if (edit) {
|
|
7
7
|
return workspace.applyEdit(edit);
|
|
@@ -6,13 +6,13 @@ class JavaInlayHintsProvider {
|
|
|
6
6
|
this.client = client;
|
|
7
7
|
this.onDidChange = new EventEmitter();
|
|
8
8
|
this.onDidChangeInlayHints = this.onDidChange.event;
|
|
9
|
-
this.client.onRequest(InlayHintRefreshRequest.type, () => __awaiter(this,
|
|
9
|
+
this.client.onRequest(InlayHintRefreshRequest.type, () => __awaiter(this, undefined, undefined, function* () {
|
|
10
10
|
this.onDidChange.fire();
|
|
11
11
|
}));
|
|
12
12
|
}
|
|
13
13
|
provideInlayHints(document, range, token) {
|
|
14
14
|
return (
|
|
15
|
-
__awaiter(this,
|
|
15
|
+
__awaiter(this, undefined, undefined, function* () {
|
|
16
16
|
const requestParams = {
|
|
17
17
|
textDocument: this.client.code2ProtocolConverter.asTextDocumentIdentifier(document),
|
|
18
18
|
range: this.client.code2ProtocolConverter.asRange(range)
|
|
@@ -42,7 +42,7 @@ var InlayHintRefreshRequest;
|
|
|
42
42
|
InlayHintRefreshRequest.type = new RequestType('workspace/inlayHint/refresh');
|
|
43
43
|
})(InlayHintRefreshRequest || (InlayHintRefreshRequest = {}));
|
|
44
44
|
function asInlayHints(values, client) {
|
|
45
|
-
return __awaiter(this,
|
|
45
|
+
return __awaiter(this, undefined, undefined, function* () {
|
|
46
46
|
if (!Array.isArray(values)) {
|
|
47
47
|
return undefined;
|
|
48
48
|
}
|
|
@@ -2,7 +2,7 @@ import { __awaiter } from '../../node_modules/tslib/tslib.es6.js';
|
|
|
2
2
|
import { commands, window, Uri, ViewColumn, workspace, TextEditorRevealType } from 'vscode';
|
|
3
3
|
import { Commands } from './commands.js';
|
|
4
4
|
import { applyWorkspaceEdit } from './extension.js';
|
|
5
|
-
import { ListOverridableMethodsRequest, AddOverridableMethodsRequest, CheckHashCodeEqualsStatusRequest, GenerateHashCodeEqualsRequest, OrganizeImportsRequest, CheckToStringStatusRequest, GenerateToStringRequest,
|
|
5
|
+
import { ListOverridableMethodsRequest, AddOverridableMethodsRequest, CheckHashCodeEqualsStatusRequest, GenerateHashCodeEqualsRequest, OrganizeImportsRequest, CheckToStringStatusRequest, GenerateToStringRequest, CheckConstructorStatusRequest, GenerateConstructorsRequest, CheckDelegateMethodsStatusRequest, GenerateDelegateMethodsRequest, AccessorCodeActionRequest, AccessorKind, GenerateAccessorsRequest } from './protocol.js';
|
|
6
6
|
function registerCommands(languageClient, context) {
|
|
7
7
|
registerOverrideMethodsCommand(languageClient, context);
|
|
8
8
|
registerHashCodeEqualsCommand(languageClient, context);
|
|
@@ -14,7 +14,7 @@ function registerCommands(languageClient, context) {
|
|
|
14
14
|
registerGenerateDelegateMethodsCommand(languageClient, context);
|
|
15
15
|
}
|
|
16
16
|
function registerOverrideMethodsCommand(languageClient, context) {
|
|
17
|
-
context.subscriptions.push(commands.registerCommand(Commands.OVERRIDE_METHODS_PROMPT, (params) => __awaiter(this,
|
|
17
|
+
context.subscriptions.push(commands.registerCommand(Commands.OVERRIDE_METHODS_PROMPT, (params) => __awaiter(this, undefined, undefined, function* () {
|
|
18
18
|
const result = yield languageClient.sendRequest(ListOverridableMethodsRequest.type, params);
|
|
19
19
|
if (!result || !result.methods || !result.methods.length) {
|
|
20
20
|
window.showWarningMessage('No overridable methods found in the super type.');
|
|
@@ -55,7 +55,7 @@ function registerOverrideMethodsCommand(languageClient, context) {
|
|
|
55
55
|
})));
|
|
56
56
|
}
|
|
57
57
|
function registerHashCodeEqualsCommand(languageClient, context) {
|
|
58
|
-
context.subscriptions.push(commands.registerCommand(Commands.HASHCODE_EQUALS_PROMPT, (params) => __awaiter(this,
|
|
58
|
+
context.subscriptions.push(commands.registerCommand(Commands.HASHCODE_EQUALS_PROMPT, (params) => __awaiter(this, undefined, undefined, function* () {
|
|
59
59
|
const result = yield languageClient.sendRequest(CheckHashCodeEqualsStatusRequest.type, params);
|
|
60
60
|
if (!result || !result.fields || !result.fields.length) {
|
|
61
61
|
window.showErrorMessage(`The operation is not applicable to the type ${result.type}.`);
|
|
@@ -94,13 +94,13 @@ function registerHashCodeEqualsCommand(languageClient, context) {
|
|
|
94
94
|
})));
|
|
95
95
|
}
|
|
96
96
|
function registerOrganizeImportsCommand(languageClient, context) {
|
|
97
|
-
context.subscriptions.push(commands.registerCommand(Commands.ORGANIZE_IMPORTS, (params) => __awaiter(this,
|
|
97
|
+
context.subscriptions.push(commands.registerCommand(Commands.ORGANIZE_IMPORTS, (params) => __awaiter(this, undefined, undefined, function* () {
|
|
98
98
|
const workspaceEdit = yield languageClient.sendRequest(OrganizeImportsRequest.type, params);
|
|
99
99
|
yield applyWorkspaceEdit(workspaceEdit, languageClient);
|
|
100
100
|
})));
|
|
101
101
|
}
|
|
102
102
|
function registerChooseImportCommand(context) {
|
|
103
|
-
context.subscriptions.push(commands.registerCommand(Commands.CHOOSE_IMPORTS, (uri, selections) => __awaiter(this,
|
|
103
|
+
context.subscriptions.push(commands.registerCommand(Commands.CHOOSE_IMPORTS, (uri, selections) => __awaiter(this, undefined, undefined, function* () {
|
|
104
104
|
const chosen = [];
|
|
105
105
|
const fileUri = Uri.parse(uri);
|
|
106
106
|
for (let i = 0; i < selections.length; i++) {
|
|
@@ -142,7 +142,7 @@ function registerChooseImportCommand(context) {
|
|
|
142
142
|
})));
|
|
143
143
|
}
|
|
144
144
|
function registerGenerateToStringCommand(languageClient, context) {
|
|
145
|
-
context.subscriptions.push(commands.registerCommand(Commands.GENERATE_TOSTRING_PROMPT, (params) => __awaiter(this,
|
|
145
|
+
context.subscriptions.push(commands.registerCommand(Commands.GENERATE_TOSTRING_PROMPT, (params) => __awaiter(this, undefined, undefined, function* () {
|
|
146
146
|
const result = yield languageClient.sendRequest(CheckToStringStatusRequest.type, params);
|
|
147
147
|
if (!result) {
|
|
148
148
|
return;
|
|
@@ -181,12 +181,12 @@ function registerGenerateToStringCommand(languageClient, context) {
|
|
|
181
181
|
})));
|
|
182
182
|
}
|
|
183
183
|
function registerGenerateAccessorsCommand(languageClient, context) {
|
|
184
|
-
context.subscriptions.push(commands.registerCommand(Commands.GENERATE_ACCESSORS_PROMPT, (params) => __awaiter(this,
|
|
184
|
+
context.subscriptions.push(commands.registerCommand(Commands.GENERATE_ACCESSORS_PROMPT, (params) => __awaiter(this, undefined, undefined, function* () {
|
|
185
185
|
yield generateAccessors(languageClient, params);
|
|
186
186
|
})));
|
|
187
187
|
}
|
|
188
188
|
function generateAccessors(languageClient, params) {
|
|
189
|
-
return __awaiter(this,
|
|
189
|
+
return __awaiter(this, undefined, undefined, function* () {
|
|
190
190
|
const accessors = yield languageClient.sendRequest(AccessorCodeActionRequest.type, params);
|
|
191
191
|
if (!accessors || !accessors.length) {
|
|
192
192
|
return;
|
|
@@ -235,7 +235,7 @@ function generateAccessors(languageClient, params) {
|
|
|
235
235
|
});
|
|
236
236
|
}
|
|
237
237
|
function registerGenerateConstructorsCommand(languageClient, context) {
|
|
238
|
-
context.subscriptions.push(commands.registerCommand(Commands.GENERATE_CONSTRUCTORS_PROMPT, (params) => __awaiter(this,
|
|
238
|
+
context.subscriptions.push(commands.registerCommand(Commands.GENERATE_CONSTRUCTORS_PROMPT, (params) => __awaiter(this, undefined, undefined, function* () {
|
|
239
239
|
const status = yield languageClient.sendRequest(CheckConstructorStatusRequest.type, params);
|
|
240
240
|
if (!status || !status.constructors || !status.constructors.length) {
|
|
241
241
|
return;
|
|
@@ -285,7 +285,7 @@ function registerGenerateConstructorsCommand(languageClient, context) {
|
|
|
285
285
|
})));
|
|
286
286
|
}
|
|
287
287
|
function registerGenerateDelegateMethodsCommand(languageClient, context) {
|
|
288
|
-
context.subscriptions.push(commands.registerCommand(Commands.GENERATE_DELEGATE_METHODS_PROMPT, (params) => __awaiter(this,
|
|
288
|
+
context.subscriptions.push(commands.registerCommand(Commands.GENERATE_DELEGATE_METHODS_PROMPT, (params) => __awaiter(this, undefined, undefined, function* () {
|
|
289
289
|
const status = yield languageClient.sendRequest(CheckDelegateMethodsStatusRequest.type, params);
|
|
290
290
|
if (!status || !status.delegateFields || !status.delegateFields.length) {
|
|
291
291
|
window.showWarningMessage("All delegatable methods are already implemented.");
|
|
@@ -340,7 +340,7 @@ function registerGenerateDelegateMethodsCommand(languageClient, context) {
|
|
|
340
340
|
})));
|
|
341
341
|
}
|
|
342
342
|
function revealWorkspaceEdit(workspaceEdit, languageClient) {
|
|
343
|
-
return __awaiter(this,
|
|
343
|
+
return __awaiter(this, undefined, undefined, function* () {
|
|
344
344
|
const codeWorkspaceEdit = languageClient.protocol2CodeConverter.asWorkspaceEdit(workspaceEdit);
|
|
345
345
|
if (!codeWorkspaceEdit) {
|
|
346
346
|
return;
|
package/dist/extensions/java.js
CHANGED
|
@@ -24,8 +24,10 @@ class JavaExtensionFeature extends ExtensionFeature {
|
|
|
24
24
|
registerCommands(this.languageClient, context);
|
|
25
25
|
context.subscriptions.push(workspace.registerTextDocumentContentProvider('jdt', {
|
|
26
26
|
provideTextDocumentContent: async (uri, token) => {
|
|
27
|
-
return this.languageClient
|
|
28
|
-
|
|
27
|
+
return this.languageClient
|
|
28
|
+
.sendRequest(ClassFileContentsRequest.type, { uri: uri.toString() }, token)
|
|
29
|
+
.then((v) => {
|
|
30
|
+
return v !== null && v !== undefined ? v : '';
|
|
29
31
|
});
|
|
30
32
|
}
|
|
31
33
|
}));
|
package/dist/extensions/tools.js
CHANGED
|
@@ -32,20 +32,48 @@ class SimpleExtensionContext {
|
|
|
32
32
|
throw new MultiDisposeError(errors);
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
|
-
get languageModelAccessInformation() {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
get
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
get
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
get
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
get
|
|
48
|
-
|
|
35
|
+
get languageModelAccessInformation() {
|
|
36
|
+
return unsupported();
|
|
37
|
+
}
|
|
38
|
+
get workspaceState() {
|
|
39
|
+
return unsupported();
|
|
40
|
+
}
|
|
41
|
+
get globalState() {
|
|
42
|
+
return unsupported();
|
|
43
|
+
}
|
|
44
|
+
get secrets() {
|
|
45
|
+
return unsupported();
|
|
46
|
+
}
|
|
47
|
+
get extensionUri() {
|
|
48
|
+
return unsupported();
|
|
49
|
+
}
|
|
50
|
+
get extensionPath() {
|
|
51
|
+
return unsupported();
|
|
52
|
+
}
|
|
53
|
+
get environmentVariableCollection() {
|
|
54
|
+
return unsupported();
|
|
55
|
+
}
|
|
56
|
+
get globalStorageUri() {
|
|
57
|
+
return unsupported();
|
|
58
|
+
}
|
|
59
|
+
get globalStoragePath() {
|
|
60
|
+
return unsupported();
|
|
61
|
+
}
|
|
62
|
+
get logUri() {
|
|
63
|
+
return unsupported();
|
|
64
|
+
}
|
|
65
|
+
get logPath() {
|
|
66
|
+
return unsupported();
|
|
67
|
+
}
|
|
68
|
+
get extensionMode() {
|
|
69
|
+
return unsupported();
|
|
70
|
+
}
|
|
71
|
+
get extension() {
|
|
72
|
+
return unsupported();
|
|
73
|
+
}
|
|
74
|
+
get extensionRuntime() {
|
|
75
|
+
return unsupported();
|
|
76
|
+
}
|
|
49
77
|
}
|
|
50
78
|
class ExtensionFeature {
|
|
51
79
|
constructor() {
|
package/dist/extensions.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { monaco } from '@codingame/monaco-editor-wrapper';
|
|
2
|
-
import { registerFileSystemOverlay, FileSystemProviderError, FileSystemProviderErrorCode, FileType } from '@codingame/monaco-vscode-files-service-override';
|
|
2
|
+
import { registerFileSystemOverlay, FileSystemProviderCapabilities, FileSystemProviderError, FileSystemProviderErrorCode, FileType } from '@codingame/monaco-vscode-files-service-override';
|
|
3
3
|
import { DidSaveTextDocumentNotification } from 'vscode-languageserver-protocol';
|
|
4
4
|
import * as vscode from 'vscode';
|
|
5
|
-
import { DisposableStore } from 'vscode/monaco';
|
|
5
|
+
import { DisposableStore } from '@codingame/monaco-vscode-api/monaco';
|
|
6
6
|
import { willShutdownNotificationType } from './customRequests.js';
|
|
7
7
|
async function bufferToBase64(buffer) {
|
|
8
8
|
const base64url = await new Promise((resolve) => {
|
|
@@ -26,16 +26,19 @@ class InitializeTextDocumentFeature {
|
|
|
26
26
|
fillClientCapabilities() { }
|
|
27
27
|
initialize(capabilities, documentSelector) {
|
|
28
28
|
var _a;
|
|
29
|
-
const textDocumentSyncOptions = capabilities
|
|
30
|
-
|
|
29
|
+
const textDocumentSyncOptions = capabilities
|
|
30
|
+
.resolvedTextDocumentSync;
|
|
31
|
+
if (documentSelector == null || ((_a = textDocumentSyncOptions === null || textDocumentSyncOptions === undefined ? undefined : textDocumentSyncOptions.openClose) !== null && _a !== undefined ? _a : false)) {
|
|
31
32
|
return;
|
|
32
33
|
}
|
|
33
34
|
const infrastructure = this.infrastructure;
|
|
34
35
|
const languageClient = this.languageClient;
|
|
35
36
|
async function saveFile(textDocument) {
|
|
36
37
|
var _a;
|
|
37
|
-
if (documentSelector != null &&
|
|
38
|
-
|
|
38
|
+
if (documentSelector != null &&
|
|
39
|
+
vscode.languages.match(documentSelector, textDocument) > 0 &&
|
|
40
|
+
textDocument.uri.scheme === 'file') {
|
|
41
|
+
await ((_a = infrastructure.writeFile) === null || _a === undefined ? undefined : _a.call(infrastructure, textDocument.uri, btoa(textDocument.getText()), languageClient));
|
|
39
42
|
await languageClient.sendNotification(DidSaveTextDocumentNotification.type, {
|
|
40
43
|
textDocument: {
|
|
41
44
|
uri: textDocument.uri.toString()
|
|
@@ -54,7 +57,7 @@ class InitializeTextDocumentFeature {
|
|
|
54
57
|
}
|
|
55
58
|
clear() {
|
|
56
59
|
var _a;
|
|
57
|
-
(_a = this.didOpenTextDocumentDisposable) === null || _a ===
|
|
60
|
+
(_a = this.didOpenTextDocumentDisposable) === null || _a === undefined ? undefined : _a.dispose();
|
|
58
61
|
}
|
|
59
62
|
}
|
|
60
63
|
class WillDisposeFeature {
|
|
@@ -79,7 +82,7 @@ class InfrastructureFileSystemUpdaterProvider {
|
|
|
79
82
|
constructor(infrastructure, languageClientManager) {
|
|
80
83
|
this.infrastructure = infrastructure;
|
|
81
84
|
this.languageClientManager = languageClientManager;
|
|
82
|
-
this.capabilities =
|
|
85
|
+
this.capabilities = FileSystemProviderCapabilities.FileReadWrite | FileSystemProviderCapabilities.PathCaseSensitive;
|
|
83
86
|
this.onDidChangeCapabilities = new vscode.EventEmitter().event;
|
|
84
87
|
this.onDidChangeFile = new vscode.EventEmitter().event;
|
|
85
88
|
this.onDidWatchError = new vscode.EventEmitter().event;
|
|
@@ -116,13 +119,19 @@ class InfrastructureFileSystemProvider {
|
|
|
116
119
|
constructor(infrastructure, languageClientManager) {
|
|
117
120
|
this.infrastructure = infrastructure;
|
|
118
121
|
this.languageClientManager = languageClientManager;
|
|
119
|
-
this.capabilities =
|
|
122
|
+
this.capabilities = FileSystemProviderCapabilities.FileReadWrite |
|
|
123
|
+
FileSystemProviderCapabilities.PathCaseSensitive |
|
|
124
|
+
FileSystemProviderCapabilities.Readonly;
|
|
120
125
|
this.onDidChangeCapabilities = new vscode.EventEmitter().event;
|
|
121
126
|
this.onDidChangeFile = new vscode.EventEmitter().event;
|
|
122
127
|
}
|
|
123
128
|
isBlacklisted(resource) {
|
|
124
|
-
const REMOTE_FILE_BLACKLIST = [
|
|
125
|
-
|
|
129
|
+
const REMOTE_FILE_BLACKLIST = [
|
|
130
|
+
'.git/config',
|
|
131
|
+
'.vscode',
|
|
132
|
+
monaco.Uri.parse(this.infrastructure.rootUri).path
|
|
133
|
+
];
|
|
134
|
+
const blacklisted = REMOTE_FILE_BLACKLIST.some((blacklisted) => resource.path.endsWith(blacklisted));
|
|
126
135
|
return blacklisted;
|
|
127
136
|
}
|
|
128
137
|
async readFile(resource) {
|
|
@@ -177,11 +186,11 @@ class InfrastructureFileSystemProvider {
|
|
|
177
186
|
}
|
|
178
187
|
async readdir(resource) {
|
|
179
188
|
var _a, _b;
|
|
180
|
-
const result = await ((_b = (_a = this.infrastructure).listFiles) === null || _b ===
|
|
189
|
+
const result = await ((_b = (_a = this.infrastructure).listFiles) === null || _b === undefined ? undefined : _b.call(_a, resource, this.languageClientManager));
|
|
181
190
|
if (result == null) {
|
|
182
191
|
return [];
|
|
183
192
|
}
|
|
184
|
-
return result.map(file => {
|
|
193
|
+
return result.map((file) => {
|
|
185
194
|
let name = file;
|
|
186
195
|
let type = FileType.File;
|
|
187
196
|
if (file.endsWith('/')) {
|
|
@@ -225,7 +234,7 @@ class FileSystemFeature {
|
|
|
225
234
|
}
|
|
226
235
|
dispose() {
|
|
227
236
|
var _a;
|
|
228
|
-
(_a = this.disposable) === null || _a ===
|
|
237
|
+
(_a = this.disposable) === null || _a === undefined ? undefined : _a.dispose();
|
|
229
238
|
this.disposable = undefined;
|
|
230
239
|
}
|
|
231
240
|
clear() {
|
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export { MessageTransports } from 'vscode-languageclient';
|
|
|
3
3
|
import * as vscode from 'vscode';
|
|
4
4
|
export { WorkspaceFolder } from 'vscode';
|
|
5
5
|
import * as monaco from 'monaco-editor';
|
|
6
|
-
import { Disposable,
|
|
6
|
+
import { Disposable, NotificationType, RequestType, CancellationToken, Emitter, Event, LSPAny } from 'vscode-languageserver-protocol';
|
|
7
7
|
import { StaticFeature, DynamicFeature } from 'vscode-languageclient/lib/common/api';
|
|
8
8
|
|
|
9
9
|
type LanguageClientOptionsById<T extends string> = Record<T, LanguageClientOptions>;
|
package/dist/infrastructure.js
CHANGED
|
@@ -33,11 +33,13 @@ class CodinGameInfrastructure {
|
|
|
33
33
|
this.libraryUrls = libraryUrls;
|
|
34
34
|
this.automaticTextDocumentUpdate = false;
|
|
35
35
|
this.rootUri = 'file:///tmp/project';
|
|
36
|
-
this.workspaceFolders = [
|
|
36
|
+
this.workspaceFolders = [
|
|
37
|
+
{
|
|
37
38
|
uri: monaco.Uri.file('/tmp/project'),
|
|
38
39
|
index: 0,
|
|
39
40
|
name: 'main'
|
|
40
|
-
}
|
|
41
|
+
}
|
|
42
|
+
];
|
|
41
43
|
}
|
|
42
44
|
useMutualizedProxy(languageClientId, options) {
|
|
43
45
|
return this._useMutualizedProxy && options.mutualizable;
|
|
@@ -51,13 +53,13 @@ class CodinGameInfrastructure {
|
|
|
51
53
|
return (await readFile(resource.toString(true), languageClient)).content;
|
|
52
54
|
}
|
|
53
55
|
async getFileStats(directory, languageClient) {
|
|
54
|
-
return
|
|
56
|
+
return await getFileStats(directory.toString(true), languageClient);
|
|
55
57
|
}
|
|
56
58
|
async listFiles(directory, languageClient) {
|
|
57
59
|
try {
|
|
58
60
|
return (await listFiles(directory.toString(true), languageClient)).files;
|
|
59
61
|
}
|
|
60
|
-
catch
|
|
62
|
+
catch {
|
|
61
63
|
return [];
|
|
62
64
|
}
|
|
63
65
|
}
|
|
@@ -65,7 +67,7 @@ class CodinGameInfrastructure {
|
|
|
65
67
|
var _a;
|
|
66
68
|
try {
|
|
67
69
|
const url = new URL(this.sessionId != null ? `run/${this.sessionId}/${id}` : `run/${id}`, this.serverAddress);
|
|
68
|
-
(_a = this.libraryUrls) === null || _a === void 0 ? void 0 : _a.forEach(libraryUrl => url.searchParams.append('libraryUrl', libraryUrl));
|
|
70
|
+
(_a = this.libraryUrls) === null || _a === void 0 ? void 0 : _a.forEach((libraryUrl) => url.searchParams.append('libraryUrl', libraryUrl));
|
|
69
71
|
url.searchParams.append('token', await this.getSecurityToken());
|
|
70
72
|
const connection = await openWebsocketConnection(url);
|
|
71
73
|
return connection;
|
|
@@ -78,12 +80,11 @@ class CodinGameInfrastructure {
|
|
|
78
80
|
}
|
|
79
81
|
}
|
|
80
82
|
getInitializationOptions(documentSelector) {
|
|
81
|
-
let documents = vscode.workspace.textDocuments.filter(doc => doc.uri.scheme === 'file');
|
|
83
|
+
let documents = vscode.workspace.textDocuments.filter((doc) => doc.uri.scheme === 'file');
|
|
82
84
|
if (documentSelector != null) {
|
|
83
|
-
documents = documents.filter(doc => vscode.languages.match(documentSelector, doc));
|
|
85
|
+
documents = documents.filter((doc) => vscode.languages.match(documentSelector, doc));
|
|
84
86
|
}
|
|
85
|
-
const files = documents
|
|
86
|
-
.reduce((map, doc) => {
|
|
87
|
+
const files = documents.reduce((map, doc) => {
|
|
87
88
|
map[doc.uri.toString(true)] = doc.getText();
|
|
88
89
|
return map;
|
|
89
90
|
}, {});
|
package/dist/languageClient.js
CHANGED
|
@@ -2,7 +2,7 @@ import { CloseAction, ErrorAction, State } from 'vscode-languageclient';
|
|
|
2
2
|
import delay from 'delay';
|
|
3
3
|
import { Emitter, LogMessageNotification } from 'vscode-languageserver-protocol';
|
|
4
4
|
import * as vscode from 'vscode';
|
|
5
|
-
import { errorHandler } from 'vscode/monaco';
|
|
5
|
+
import { errorHandler } from '@codingame/monaco-vscode-api/monaco';
|
|
6
6
|
import once from 'once';
|
|
7
7
|
import { DisposableCollection } from 'vscode-ws-jsonrpc';
|
|
8
8
|
import { initializePromise } from '@codingame/monaco-editor-wrapper';
|
|
@@ -71,7 +71,7 @@ class LanguageClientManager {
|
|
|
71
71
|
try {
|
|
72
72
|
await this.startPromise;
|
|
73
73
|
}
|
|
74
|
-
catch
|
|
74
|
+
catch {
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
77
|
if (this.languageClient != null) {
|
|
@@ -110,8 +110,7 @@ class LanguageClientManager {
|
|
|
110
110
|
let started = false;
|
|
111
111
|
let attempt = 0;
|
|
112
112
|
const maxStartAttemptCount = this.managerOptions.maxStartAttemptCount;
|
|
113
|
-
while (!this.isDisposed() &&
|
|
114
|
-
!started) {
|
|
113
|
+
while (!this.isDisposed() && !started) {
|
|
115
114
|
if (maxStartAttemptCount != null && attempt >= maxStartAttemptCount) {
|
|
116
115
|
throw new Error(`Max connection attempt count exceeded: ${maxStartAttemptCount}`);
|
|
117
116
|
}
|
|
@@ -142,10 +141,10 @@ class LanguageClientManager {
|
|
|
142
141
|
error: this.handleError,
|
|
143
142
|
closed: this.handleClose
|
|
144
143
|
}, {
|
|
145
|
-
...((_a = this.clientOptions.middleware) !== null && _a !==
|
|
144
|
+
...((_a = this.clientOptions.middleware) !== null && _a !== undefined ? _a : {}),
|
|
146
145
|
handleDiagnostics: (uri, diagnostics, next) => {
|
|
147
146
|
var _a;
|
|
148
|
-
if (((_a = this.clientOptions.middleware) === null || _a ===
|
|
147
|
+
if (((_a = this.clientOptions.middleware) === null || _a === undefined ? undefined : _a.handleDiagnostics) != null) {
|
|
149
148
|
this.clientOptions.middleware.handleDiagnostics(uri, diagnostics, next);
|
|
150
149
|
}
|
|
151
150
|
else {
|
|
@@ -197,7 +196,7 @@ class LanguageClientManager {
|
|
|
197
196
|
},
|
|
198
197
|
handleWorkDoneProgress: async (token, params, next) => {
|
|
199
198
|
var _a;
|
|
200
|
-
if (((_a = this.clientOptions.middleware) === null || _a ===
|
|
199
|
+
if (((_a = this.clientOptions.middleware) === null || _a === undefined ? undefined : _a.handleWorkDoneProgress) != null) {
|
|
201
200
|
this.clientOptions.middleware.handleWorkDoneProgress(token, params, next);
|
|
202
201
|
}
|
|
203
202
|
else {
|
|
@@ -233,8 +232,8 @@ class LanguageClientManager {
|
|
|
233
232
|
let readyPromise;
|
|
234
233
|
const { maxInitializeDuration, readinessMessageMatcher } = this.clientOptions;
|
|
235
234
|
if (readinessMessageMatcher != null && !this.useMutualizedProxy) {
|
|
236
|
-
readyPromise = new Promise(resolve => {
|
|
237
|
-
disposableCollection.push(languageClient.onNotification(LogMessageNotification.type, logMessage => {
|
|
235
|
+
readyPromise = new Promise((resolve) => {
|
|
236
|
+
disposableCollection.push(languageClient.onNotification(LogMessageNotification.type, (logMessage) => {
|
|
238
237
|
if (readinessMessageMatcher.exec(logMessage.message) != null) {
|
|
239
238
|
resolve();
|
|
240
239
|
}
|
|
@@ -242,14 +241,11 @@ class LanguageClientManager {
|
|
|
242
241
|
});
|
|
243
242
|
}
|
|
244
243
|
else {
|
|
245
|
-
readyPromise = new Promise(resolve => {
|
|
244
|
+
readyPromise = new Promise((resolve) => {
|
|
246
245
|
disposableCollection.push(onServerResponse.event(resolve));
|
|
247
246
|
});
|
|
248
247
|
}
|
|
249
|
-
await Promise.race([
|
|
250
|
-
readyPromise,
|
|
251
|
-
delay(maxInitializeDuration !== null && maxInitializeDuration !== void 0 ? maxInitializeDuration : 15000)
|
|
252
|
-
]);
|
|
248
|
+
await Promise.race([readyPromise, delay(maxInitializeDuration !== null && maxInitializeDuration !== undefined ? maxInitializeDuration : 15000)]);
|
|
253
249
|
disposableCollection.dispose();
|
|
254
250
|
}, (error) => {
|
|
255
251
|
errorHandler.onUnexpectedError(new Error(`[LSP] Error while waiting for the ${this.id} language client to be ready`, {
|
|
@@ -269,10 +265,12 @@ class LanguageClientManager {
|
|
|
269
265
|
setTimeout(() => {
|
|
270
266
|
void languageClient.dispose();
|
|
271
267
|
});
|
|
272
|
-
if (state.oldState === State.Running &&
|
|
268
|
+
if (state.oldState === State.Running &&
|
|
269
|
+
!this.isDisposed() &&
|
|
270
|
+
this.languageClient === languageClient) {
|
|
273
271
|
this.languageClient = undefined;
|
|
274
272
|
console.info('[LSP] Restarting language client', state);
|
|
275
|
-
this.start().catch(error => {
|
|
273
|
+
this.start().catch((error) => {
|
|
276
274
|
errorHandler.onUnexpectedError(new Error('[LSP] Language client stopped', {
|
|
277
275
|
cause: error
|
|
278
276
|
}));
|
|
@@ -11,6 +11,6 @@ function registerLanguageClient(id, options) {
|
|
|
11
11
|
}
|
|
12
12
|
function getLanguageClientOptions(id) {
|
|
13
13
|
var _a;
|
|
14
|
-
return (_a = dynamicOptions[id]) !== null && _a !==
|
|
14
|
+
return (_a = dynamicOptions[id]) !== null && _a !== undefined ? _a : staticOptions[id];
|
|
15
15
|
}
|
|
16
16
|
export { getLanguageClientOptions, registerLanguageClient };
|
package/dist/services.js
CHANGED
|
@@ -2,7 +2,7 @@ import * as vscode from 'vscode';
|
|
|
2
2
|
function updateServices(infrastructure) {
|
|
3
3
|
var _a;
|
|
4
4
|
if (infrastructure.workspaceFolders != null) {
|
|
5
|
-
vscode.workspace.updateWorkspaceFolders(0, (_a = vscode.workspace.workspaceFolders) === null || _a ===
|
|
5
|
+
vscode.workspace.updateWorkspaceFolders(0, (_a = vscode.workspace.workspaceFolders) === null || _a === undefined ? undefined : _a.length, ...infrastructure.workspaceFolders);
|
|
6
6
|
}
|
|
7
7
|
}
|
|
8
8
|
export { updateServices };
|