@codingame/monaco-languageclient-wrapper 1.1.5 → 1.2.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.d.ts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/languageClient.d.ts +3 -3
- package/dist/main.js +73 -17
- package/dist/monaco-languageclient-wrapper.d.ts +1478 -0
- package/dist/staticOptions.d.ts +4 -2
- package/dist/tsdoc-metadata.json +11 -0
- package/package.json +1 -1
- package/stats.html +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { MonacoLanguageClient, Middleware, ErrorHandler } from '@codingame/monaco-languageclient';
|
|
2
|
-
import { StaticLanguageClientOptions } from './staticOptions';
|
|
3
|
-
declare function createLanguageClient(id:
|
|
2
|
+
import { LanguageClientId, StaticLanguageClientOptions } from './staticOptions';
|
|
3
|
+
declare function createLanguageClient(id: LanguageClientId, sessionId: string | undefined, { documentSelector, synchronize, initializationOptions }: StaticLanguageClientOptions, languageServerAddress: string, getSecurityToken: () => Promise<string>, libraryUrls: string[], errorHandler: ErrorHandler, middleware?: Middleware): MonacoLanguageClient;
|
|
4
4
|
export default createLanguageClient;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import 'proxy-polyfill';
|
|
2
2
|
import './hacks';
|
|
3
|
-
import '@codingame/monaco-editor-wrapper/dist/extensionConfigurations';
|
|
4
3
|
import { createLanguageClientManager, StatusChangeEvent } from './languageClient';
|
|
4
|
+
import { LanguageClientId } from './staticOptions';
|
|
5
5
|
export { createLanguageClientManager };
|
|
6
|
-
export type { StatusChangeEvent };
|
|
6
|
+
export type { StatusChangeEvent, LanguageClientId };
|
package/dist/languageClient.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MonacoLanguageClient, Emitter, Event, TextDocument } from '@codingame/monaco-languageclient';
|
|
2
|
-
import { StaticLanguageClientOptions } from './staticOptions';
|
|
2
|
+
import { LanguageClientId, StaticLanguageClientOptions } from './staticOptions';
|
|
3
3
|
declare type Status = {
|
|
4
4
|
type: string;
|
|
5
5
|
message: string;
|
|
@@ -23,7 +23,7 @@ export declare class LanguageClientManager implements LanguageClient {
|
|
|
23
23
|
protected readonly onErrorEmitter: Emitter<Error>;
|
|
24
24
|
protected readonly onWillCloseEmitter: Emitter<void>;
|
|
25
25
|
protected currentStatus?: Status;
|
|
26
|
-
constructor(id:
|
|
26
|
+
constructor(id: LanguageClientId, sessionId: string | undefined, languageServerAddress: string, getSecurityToken: () => Promise<string>, languageServerOptions: StaticLanguageClientOptions, libraryUrls: string[]);
|
|
27
27
|
private updateStatus;
|
|
28
28
|
private notifyStatusChanged;
|
|
29
29
|
isReady(): boolean;
|
|
@@ -39,7 +39,7 @@ export declare class LanguageClientManager implements LanguageClient {
|
|
|
39
39
|
sendNotification(method: string, params: unknown): void;
|
|
40
40
|
sendRequest<R>(method: string, params: unknown): Promise<R>;
|
|
41
41
|
}
|
|
42
|
-
declare function createLanguageClientManager(id:
|
|
42
|
+
declare function createLanguageClientManager(id: LanguageClientId, sessionId: string | undefined, languageServerAddress: string, getSecurityToken: () => Promise<string>, libraryUrls: string[]): LanguageClientManager;
|
|
43
43
|
declare function getAllLanguageClientManagers(): LanguageClientManager[];
|
|
44
44
|
declare function getAllLanguageClientManagersByTextDocument(textDocument: TextDocument): LanguageClientManager[];
|
|
45
45
|
export { createLanguageClientManager, getAllLanguageClientManagers, getAllLanguageClientManagersByTextDocument };
|
package/dist/main.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import * as monaco from 'monaco-editor/esm/vs/editor/edcore.main';
|
|
2
2
|
import { Uri } from 'monaco-editor/esm/vs/editor/edcore.main';
|
|
3
|
-
import '@codingame/monaco-editor-wrapper/dist/extensionConfigurations';
|
|
4
3
|
import { registerTextModelContentProvider } from '@codingame/monaco-editor-wrapper';
|
|
5
4
|
import swal from 'sweetalert';
|
|
6
5
|
import once from 'once';
|
|
@@ -20641,9 +20640,11 @@ class InitializeTextDocumentFeature {
|
|
|
20641
20640
|
fillClientCapabilities() {}
|
|
20642
20641
|
|
|
20643
20642
|
initialize(capabilities, documentSelector) {
|
|
20643
|
+
var _textDocumentSyncOpti;
|
|
20644
|
+
|
|
20644
20645
|
const textDocumentSyncOptions = capabilities.resolvedTextDocumentSync;
|
|
20645
20646
|
|
|
20646
|
-
if (documentSelector == null) {
|
|
20647
|
+
if (documentSelector == null || ((_textDocumentSyncOpti = textDocumentSyncOptions === null || textDocumentSyncOptions === void 0 ? void 0 : textDocumentSyncOptions.openClose) !== null && _textDocumentSyncOpti !== void 0 ? _textDocumentSyncOpti : false)) {
|
|
20647
20648
|
return;
|
|
20648
20649
|
}
|
|
20649
20650
|
|
|
@@ -20654,9 +20655,9 @@ class InitializeTextDocumentFeature {
|
|
|
20654
20655
|
await updateFile(textDocument.uri, textDocument.getText(), languageClient); // send save notification if there is the capability
|
|
20655
20656
|
|
|
20656
20657
|
if (textDocumentSyncOptions != null && textDocumentSyncOptions.save != null && (typeof textDocumentSyncOptions.save !== 'boolean' || textDocumentSyncOptions.save)) {
|
|
20657
|
-
var
|
|
20658
|
+
var _textDocumentSyncOpti2;
|
|
20658
20659
|
|
|
20659
|
-
const includeText = typeof textDocumentSyncOptions.save === 'boolean' ? false : (
|
|
20660
|
+
const includeText = typeof textDocumentSyncOptions.save === 'boolean' ? false : (_textDocumentSyncOpti2 = textDocumentSyncOptions.save.includeText) !== null && _textDocumentSyncOpti2 !== void 0 ? _textDocumentSyncOpti2 : false;
|
|
20660
20661
|
languageClient.sendNotification(lib$1.DidSaveTextDocumentNotification.type, {
|
|
20661
20662
|
textDocument: {
|
|
20662
20663
|
uri: textDocument.uri
|
|
@@ -20760,7 +20761,9 @@ async function openConnection(url, errorHandler, closeHandler) {
|
|
|
20760
20761
|
|
|
20761
20762
|
return connection.onRequest(args[0], function () {
|
|
20762
20763
|
// Hack for https://github.com/OmniSharp/omnisharp-roslyn/issues/2119
|
|
20763
|
-
|
|
20764
|
+
const method = args[0].method;
|
|
20765
|
+
|
|
20766
|
+
if (method === lib$1.RegistrationRequest.type.method) {
|
|
20764
20767
|
const registrationParams = arguments.length <= 0 ? undefined : arguments[0];
|
|
20765
20768
|
registrationParams.registrations = registrationParams.registrations.filter(registration => {
|
|
20766
20769
|
const alreadyExisting = existingRegistrations.has(registration.id);
|
|
@@ -20776,7 +20779,7 @@ async function openConnection(url, errorHandler, closeHandler) {
|
|
|
20776
20779
|
});
|
|
20777
20780
|
}
|
|
20778
20781
|
|
|
20779
|
-
if (
|
|
20782
|
+
if (method === lib$1.UnregistrationRequest.type.method) {
|
|
20780
20783
|
const unregistrationParams = arguments.length <= 0 ? undefined : arguments[0];
|
|
20781
20784
|
|
|
20782
20785
|
for (const unregistration of unregistrationParams.unregisterations) {
|
|
@@ -20873,7 +20876,9 @@ function createLanguageClient(id, sessionId, _ref, languageServerAddress, getSec
|
|
|
20873
20876
|
return client;
|
|
20874
20877
|
}
|
|
20875
20878
|
|
|
20876
|
-
const
|
|
20879
|
+
const asLanguageClientOptionsById = options => options;
|
|
20880
|
+
|
|
20881
|
+
const staticOptions = asLanguageClientOptionsById({
|
|
20877
20882
|
angular: {
|
|
20878
20883
|
documentSelector: [{
|
|
20879
20884
|
scheme: 'file',
|
|
@@ -21089,6 +21094,18 @@ const staticOptions = {
|
|
|
21089
21094
|
language: 'sql'
|
|
21090
21095
|
}]
|
|
21091
21096
|
},
|
|
21097
|
+
'sql-sqls': {
|
|
21098
|
+
documentSelector: [{
|
|
21099
|
+
language: 'sql'
|
|
21100
|
+
}],
|
|
21101
|
+
// Disable code actions
|
|
21102
|
+
middleware: {
|
|
21103
|
+
provideCodeActions() {
|
|
21104
|
+
return [];
|
|
21105
|
+
}
|
|
21106
|
+
|
|
21107
|
+
}
|
|
21108
|
+
},
|
|
21092
21109
|
swift: {
|
|
21093
21110
|
// https://github.com/apple/sourcekit-lsp/blob/59b5e68f7f8408b5bc44bd47f71ef1afdc63e7a6/Editors/vscode/src/extension.ts#L22
|
|
21094
21111
|
documentSelector: ['swift', 'cpp', 'c', 'objective-c', 'objective-cpp'],
|
|
@@ -21108,7 +21125,7 @@ const staticOptions = {
|
|
|
21108
21125
|
}],
|
|
21109
21126
|
synchronize: {}
|
|
21110
21127
|
}
|
|
21111
|
-
};
|
|
21128
|
+
});
|
|
21112
21129
|
|
|
21113
21130
|
class LanguageClientManager {
|
|
21114
21131
|
constructor(id, sessionId, languageServerAddress, getSecurityToken, languageServerOptions, libraryUrls) {
|
|
@@ -21201,38 +21218,71 @@ class LanguageClientManager {
|
|
|
21201
21218
|
}
|
|
21202
21219
|
|
|
21203
21220
|
start() {
|
|
21221
|
+
var _this$languageServerO;
|
|
21222
|
+
|
|
21204
21223
|
const onServerResponse = new lib$1.Emitter();
|
|
21205
21224
|
const languageClient = createLanguageClient(this.id, this.sessionId, this.languageServerOptions, this.languageServerAddress, this.getSecurityToken, this.libraryUrls, {
|
|
21206
21225
|
error: this.handleError,
|
|
21207
21226
|
closed: this.handleClose
|
|
21208
|
-
}, {
|
|
21227
|
+
}, _objectSpread2(_objectSpread2({}, (_this$languageServerO = this.languageServerOptions.middleware) !== null && _this$languageServerO !== void 0 ? _this$languageServerO : {}), {}, {
|
|
21209
21228
|
handleDiagnostics: (uri, diagnostics, next) => {
|
|
21210
|
-
|
|
21229
|
+
var _this$languageServerO2;
|
|
21230
|
+
|
|
21231
|
+
if (((_this$languageServerO2 = this.languageServerOptions.middleware) === null || _this$languageServerO2 === void 0 ? void 0 : _this$languageServerO2.handleDiagnostics) != null) {
|
|
21232
|
+
this.languageServerOptions.middleware.handleDiagnostics(uri, diagnostics, next);
|
|
21233
|
+
} else {
|
|
21234
|
+
next(uri, diagnostics);
|
|
21235
|
+
}
|
|
21236
|
+
|
|
21211
21237
|
onServerResponse.fire();
|
|
21212
21238
|
},
|
|
21213
21239
|
provideCodeActions: async (document, range, context, token, next) => {
|
|
21214
21240
|
try {
|
|
21215
|
-
|
|
21241
|
+
var _this$languageServerO3;
|
|
21242
|
+
|
|
21243
|
+
if (((_this$languageServerO3 = this.languageServerOptions.middleware) === null || _this$languageServerO3 === void 0 ? void 0 : _this$languageServerO3.provideCodeActions) != null) {
|
|
21244
|
+
return await this.languageServerOptions.middleware.provideCodeActions(document, range, context, token, next);
|
|
21245
|
+
} else {
|
|
21246
|
+
return await next(document, range, context, token);
|
|
21247
|
+
}
|
|
21216
21248
|
} finally {
|
|
21217
21249
|
onServerResponse.fire();
|
|
21218
21250
|
}
|
|
21219
21251
|
},
|
|
21220
21252
|
provideDocumentRangeSemanticTokens: async (document, range, token, next) => {
|
|
21221
21253
|
try {
|
|
21222
|
-
|
|
21254
|
+
var _this$languageServerO4;
|
|
21255
|
+
|
|
21256
|
+
if (((_this$languageServerO4 = this.languageServerOptions.middleware) === null || _this$languageServerO4 === void 0 ? void 0 : _this$languageServerO4.provideDocumentRangeSemanticTokens) != null) {
|
|
21257
|
+
return await this.languageServerOptions.middleware.provideDocumentRangeSemanticTokens(document, range, token, next);
|
|
21258
|
+
} else {
|
|
21259
|
+
return await next(document, range, token);
|
|
21260
|
+
}
|
|
21223
21261
|
} finally {
|
|
21224
21262
|
onServerResponse.fire();
|
|
21225
21263
|
}
|
|
21226
21264
|
},
|
|
21227
21265
|
provideDocumentSemanticTokens: async (document, token, next) => {
|
|
21228
21266
|
try {
|
|
21229
|
-
|
|
21267
|
+
var _this$languageServerO5;
|
|
21268
|
+
|
|
21269
|
+
if (((_this$languageServerO5 = this.languageServerOptions.middleware) === null || _this$languageServerO5 === void 0 ? void 0 : _this$languageServerO5.provideDocumentSemanticTokens) != null) {
|
|
21270
|
+
return await this.languageServerOptions.middleware.provideDocumentSemanticTokens(document, token, next);
|
|
21271
|
+
} else {
|
|
21272
|
+
return await next(document, token);
|
|
21273
|
+
}
|
|
21230
21274
|
} finally {
|
|
21231
21275
|
onServerResponse.fire();
|
|
21232
21276
|
}
|
|
21233
21277
|
},
|
|
21234
21278
|
handleWorkDoneProgress: async (token, params, next) => {
|
|
21235
|
-
|
|
21279
|
+
var _this$languageServerO6;
|
|
21280
|
+
|
|
21281
|
+
if (((_this$languageServerO6 = this.languageServerOptions.middleware) === null || _this$languageServerO6 === void 0 ? void 0 : _this$languageServerO6.handleWorkDoneProgress) != null) {
|
|
21282
|
+
this.languageServerOptions.middleware.handleWorkDoneProgress(token, params, next);
|
|
21283
|
+
} else {
|
|
21284
|
+
next(token, params);
|
|
21285
|
+
}
|
|
21236
21286
|
|
|
21237
21287
|
if (params.kind === 'end') {
|
|
21238
21288
|
onServerResponse.fire();
|
|
@@ -21240,12 +21290,18 @@ class LanguageClientManager {
|
|
|
21240
21290
|
},
|
|
21241
21291
|
provideHover: async (document, position, token, next) => {
|
|
21242
21292
|
try {
|
|
21243
|
-
|
|
21293
|
+
var _this$languageServerO7;
|
|
21294
|
+
|
|
21295
|
+
if (((_this$languageServerO7 = this.languageServerOptions.middleware) === null || _this$languageServerO7 === void 0 ? void 0 : _this$languageServerO7.provideHover) != null) {
|
|
21296
|
+
return await this.languageServerOptions.middleware.provideHover(document, position, token, next);
|
|
21297
|
+
} else {
|
|
21298
|
+
return await next(document, position, token);
|
|
21299
|
+
}
|
|
21244
21300
|
} finally {
|
|
21245
21301
|
onServerResponse.fire();
|
|
21246
21302
|
}
|
|
21247
21303
|
}
|
|
21248
|
-
});
|
|
21304
|
+
}));
|
|
21249
21305
|
this.languageClient = languageClient;
|
|
21250
21306
|
let readyPromise = null;
|
|
21251
21307
|
languageClient.onDidChangeState(async state => {
|
|
@@ -21311,7 +21367,7 @@ function createLanguageClientManager(id, sessionId, languageServerAddress, getSe
|
|
|
21311
21367
|
throw new Error("Language client for language ".concat(id, " already started"));
|
|
21312
21368
|
}
|
|
21313
21369
|
|
|
21314
|
-
const languageServerOptions = staticOptions[id];
|
|
21370
|
+
const languageServerOptions = staticOptions[id]; // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
21315
21371
|
|
|
21316
21372
|
if (languageServerOptions == null) {
|
|
21317
21373
|
throw new Error("Unknown ".concat(id, " language server"));
|