typescript-language-server 0.11.1 → 1.1.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/CHANGELOG.md +52 -0
- package/README.md +160 -27
- package/lib/calls.d.ts +3 -3
- package/lib/calls.d.ts.map +1 -1
- package/lib/calls.js +143 -195
- package/lib/calls.js.map +1 -1
- package/lib/cli.js +9 -33
- package/lib/cli.js.map +1 -1
- package/lib/commands.d.ts +1 -0
- package/lib/commands.d.ts.map +1 -1
- package/lib/commands.js +4 -5
- package/lib/commands.js.map +1 -1
- package/lib/completion.d.ts +8 -11
- package/lib/completion.d.ts.map +1 -1
- package/lib/completion.js +121 -163
- package/lib/completion.js.map +1 -1
- package/lib/configuration-manager.d.ts +47 -0
- package/lib/configuration-manager.d.ts.map +1 -0
- package/lib/configuration-manager.js +105 -0
- package/lib/configuration-manager.js.map +1 -0
- package/lib/diagnostic-queue.d.ts +10 -9
- package/lib/diagnostic-queue.d.ts.map +1 -1
- package/lib/diagnostic-queue.js +13 -21
- package/lib/diagnostic-queue.js.map +1 -1
- package/lib/document-symbol.d.ts +2 -2
- package/lib/document-symbol.d.ts.map +1 -1
- package/lib/document-symbol.js +20 -25
- package/lib/document-symbol.js.map +1 -1
- package/lib/document.d.ts +1 -1
- package/lib/document.d.ts.map +1 -1
- package/lib/document.js +6 -34
- package/lib/document.js.map +1 -1
- package/lib/features/fix-all.d.ts +4 -4
- package/lib/features/fix-all.d.ts.map +1 -1
- package/lib/features/fix-all.js +104 -147
- package/lib/features/fix-all.js.map +1 -1
- package/lib/features/inlay-hints.d.ts +11 -0
- package/lib/features/inlay-hints.d.ts.map +1 -0
- package/lib/features/inlay-hints.js +70 -0
- package/lib/features/inlay-hints.js.map +1 -0
- package/lib/features/source-definition.d.ts +11 -0
- package/lib/features/source-definition.d.ts.map +1 -0
- package/lib/features/source-definition.js +50 -0
- package/lib/features/source-definition.js.map +1 -0
- package/lib/file-lsp-server.spec.js +26 -36
- package/lib/file-lsp-server.spec.js.map +1 -1
- package/lib/hover.d.ts +4 -3
- package/lib/hover.d.ts.map +1 -1
- package/lib/hover.js +53 -17
- package/lib/hover.js.map +1 -1
- package/lib/logger.d.ts +12 -4
- package/lib/logger.d.ts.map +1 -1
- package/lib/logger.js +37 -44
- package/lib/logger.js.map +1 -1
- package/lib/lsp-client.d.ts +13 -17
- package/lib/lsp-client.d.ts.map +1 -1
- package/lib/lsp-client.js +32 -91
- package/lib/lsp-client.js.map +1 -1
- package/lib/lsp-connection.d.ts +1 -1
- package/lib/lsp-connection.d.ts.map +1 -1
- package/lib/lsp-connection.js +13 -39
- package/lib/lsp-connection.js.map +1 -1
- package/lib/lsp-protocol.calls.proposed.d.ts +1 -1
- package/lib/lsp-protocol.calls.proposed.d.ts.map +1 -1
- package/lib/lsp-protocol.calls.proposed.js +7 -32
- package/lib/lsp-protocol.calls.proposed.js.map +1 -1
- package/lib/lsp-protocol.inlayHints.proposed.d.ts +2 -11
- package/lib/lsp-protocol.inlayHints.proposed.d.ts.map +1 -1
- package/lib/lsp-protocol.inlayHints.proposed.js +2 -28
- package/lib/lsp-protocol.inlayHints.proposed.js.map +1 -1
- package/lib/lsp-server.d.ts +27 -28
- package/lib/lsp-server.d.ts.map +1 -1
- package/lib/lsp-server.js +868 -926
- package/lib/lsp-server.js.map +1 -1
- package/lib/lsp-server.spec.js +956 -606
- package/lib/lsp-server.spec.js.map +1 -1
- package/lib/organize-imports.d.ts +3 -3
- package/lib/organize-imports.d.ts.map +1 -1
- package/lib/organize-imports.js +5 -32
- package/lib/organize-imports.js.map +1 -1
- package/lib/organize-imports.spec.js +17 -42
- package/lib/organize-imports.spec.js.map +1 -1
- package/lib/protocol-translation.d.ts +5 -10
- package/lib/protocol-translation.d.ts.map +1 -1
- package/lib/protocol-translation.js +39 -168
- package/lib/protocol-translation.js.map +1 -1
- package/lib/quickfix.d.ts +3 -3
- package/lib/quickfix.d.ts.map +1 -1
- package/lib/quickfix.js +7 -35
- package/lib/quickfix.js.map +1 -1
- package/lib/refactor.d.ts +2 -2
- package/lib/refactor.d.ts.map +1 -1
- package/lib/refactor.js +11 -36
- package/lib/refactor.js.map +1 -1
- package/lib/semantic-tokens.d.ts +1 -1
- package/lib/semantic-tokens.d.ts.map +1 -1
- package/lib/semantic-tokens.js +1 -5
- package/lib/semantic-tokens.js.map +1 -1
- package/lib/test-utils.d.ts +11 -5
- package/lib/test-utils.d.ts.map +1 -1
- package/lib/test-utils.js +137 -120
- package/lib/test-utils.js.map +1 -1
- package/lib/ts-protocol.d.ts +8 -20
- package/lib/ts-protocol.d.ts.map +1 -1
- package/lib/ts-protocol.js +4 -31
- package/lib/ts-protocol.js.map +1 -1
- package/lib/tsp-client.d.ts +46 -43
- package/lib/tsp-client.d.ts.map +1 -1
- package/lib/tsp-client.js +31 -52
- package/lib/tsp-client.js.map +1 -1
- package/lib/tsp-client.spec.js +48 -75
- package/lib/tsp-client.spec.js.map +1 -1
- package/lib/tsp-command-types.d.ts +1 -0
- package/lib/tsp-command-types.d.ts.map +1 -1
- package/lib/tsp-command-types.js +4 -8
- package/lib/tsp-command-types.js.map +1 -1
- package/lib/utils/SnippetString.js +1 -4
- package/lib/utils/SnippetString.js.map +1 -1
- package/lib/utils/api.d.ts +1 -0
- package/lib/utils/api.d.ts.map +1 -1
- package/lib/utils/api.js +3 -28
- package/lib/utils/api.js.map +1 -1
- package/lib/utils/configuration.d.ts +2 -2
- package/lib/utils/configuration.d.ts.map +1 -1
- package/lib/utils/configuration.js +1 -2
- package/lib/utils/errorCodes.js +11 -14
- package/lib/utils/errorCodes.js.map +1 -1
- package/lib/utils/fixNames.js +13 -16
- package/lib/utils/fixNames.js.map +1 -1
- package/lib/utils/modules-resolver.js +7 -34
- package/lib/utils/modules-resolver.js.map +1 -1
- package/lib/utils/modules-resolver.spec.d.ts +1 -1
- package/lib/utils/modules-resolver.spec.d.ts.map +1 -1
- package/lib/utils/modules-resolver.spec.js +11 -34
- package/lib/utils/modules-resolver.spec.js.map +1 -1
- package/lib/utils/typeConverters.d.ts +20 -2
- package/lib/utils/typeConverters.d.ts.map +1 -1
- package/lib/utils/typeConverters.js +105 -9
- package/lib/utils/typeConverters.js.map +1 -1
- package/lib/utils/types.js +2 -29
- package/lib/utils/types.js.map +1 -1
- package/lib/utils/versionProvider.d.ts +3 -3
- package/lib/utils/versionProvider.d.ts.map +1 -1
- package/lib/utils/versionProvider.js +52 -60
- package/lib/utils/versionProvider.js.map +1 -1
- package/lib/utils.d.ts.map +1 -1
- package/lib/utils.js +3 -5
- package/lib/utils.js.map +1 -1
- package/package.json +38 -33
package/lib/hover.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import * as lsp from 'vscode-languageserver
|
|
2
|
-
import tsp from 'typescript/lib/protocol';
|
|
3
|
-
export declare function asSignatureHelp(info: tsp.SignatureHelpItems): lsp.SignatureHelp;
|
|
1
|
+
import * as lsp from 'vscode-languageserver';
|
|
2
|
+
import type tsp from 'typescript/lib/protocol.d.js';
|
|
3
|
+
export declare function asSignatureHelp(info: tsp.SignatureHelpItems, context?: lsp.SignatureHelpContext): lsp.SignatureHelp;
|
|
4
|
+
export declare function toTsTriggerReason(context: lsp.SignatureHelpContext): tsp.SignatureHelpTriggerReason;
|
|
4
5
|
//# sourceMappingURL=hover.d.ts.map
|
package/lib/hover.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hover.d.ts","sourceRoot":"","sources":["../src/hover.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"hover.d.ts","sourceRoot":"","sources":["../src/hover.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,GAAG,MAAM,uBAAuB,CAAC;AAC7C,OAAO,KAAK,GAAG,MAAM,8BAA8B,CAAC;AAGpD,wBAAgB,eAAe,CAAC,IAAI,EAAE,GAAG,CAAC,kBAAkB,EAAE,OAAO,CAAC,EAAE,GAAG,CAAC,oBAAoB,GAAG,GAAG,CAAC,aAAa,CAOnH;AA+CD,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,GAAG,CAAC,oBAAoB,GAAG,GAAG,CAAC,0BAA0B,CAkBnG"}
|
package/lib/hover.js
CHANGED
|
@@ -1,24 +1,39 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/*
|
|
3
2
|
* Copyright (C) 2017, 2018 TypeFox and others.
|
|
4
3
|
*
|
|
5
4
|
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
|
|
6
5
|
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
7
6
|
*/
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
/*---------------------------------------------------------------------------------------------
|
|
8
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
9
|
+
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
10
|
+
*--------------------------------------------------------------------------------------------*/
|
|
11
|
+
import * as lsp from 'vscode-languageserver';
|
|
12
|
+
import { asDocumentation, asPlainText } from './protocol-translation.js';
|
|
13
|
+
export function asSignatureHelp(info, context) {
|
|
14
|
+
const signatures = info.items.map(asSignatureInformation);
|
|
12
15
|
return {
|
|
13
|
-
activeSignature: info
|
|
16
|
+
activeSignature: getActiveSignature(info, signatures, context),
|
|
14
17
|
activeParameter: getActiveParameter(info),
|
|
15
|
-
signatures
|
|
18
|
+
signatures,
|
|
16
19
|
};
|
|
17
20
|
}
|
|
18
|
-
|
|
21
|
+
function getActiveSignature(info, signatures, context) {
|
|
22
|
+
// Try matching the previous active signature's label to keep it selected
|
|
23
|
+
if (context?.activeSignatureHelp?.activeSignature !== undefined) {
|
|
24
|
+
const previouslyActiveSignature = context.activeSignatureHelp.signatures[context.activeSignatureHelp.activeSignature];
|
|
25
|
+
if (previouslyActiveSignature && context.isRetrigger) {
|
|
26
|
+
const existingIndex = signatures.findIndex(other => other.label === previouslyActiveSignature.label);
|
|
27
|
+
if (existingIndex !== -1) {
|
|
28
|
+
return existingIndex;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return info.selectedItemIndex;
|
|
33
|
+
}
|
|
19
34
|
function getActiveParameter(info) {
|
|
20
35
|
const activeSignature = info.items[info.selectedItemIndex];
|
|
21
|
-
if (activeSignature
|
|
36
|
+
if (activeSignature?.isVariadic) {
|
|
22
37
|
return Math.min(info.argumentIndex, activeSignature.parameters.length - 1);
|
|
23
38
|
}
|
|
24
39
|
return info.argumentIndex;
|
|
@@ -26,21 +41,42 @@ function getActiveParameter(info) {
|
|
|
26
41
|
function asSignatureInformation(item) {
|
|
27
42
|
const parameters = item.parameters.map(asParameterInformation);
|
|
28
43
|
const signature = {
|
|
29
|
-
label:
|
|
30
|
-
documentation:
|
|
44
|
+
label: asPlainText(item.prefixDisplayParts),
|
|
45
|
+
documentation: asDocumentation({
|
|
31
46
|
documentation: item.documentation,
|
|
32
|
-
tags: item.tags.filter(x => x.name !== 'param')
|
|
47
|
+
tags: item.tags.filter(x => x.name !== 'param'),
|
|
33
48
|
}),
|
|
34
|
-
parameters
|
|
49
|
+
parameters,
|
|
35
50
|
};
|
|
36
|
-
signature.label += parameters.map(parameter => parameter.label).join(
|
|
37
|
-
signature.label +=
|
|
51
|
+
signature.label += parameters.map(parameter => parameter.label).join(asPlainText(item.separatorDisplayParts));
|
|
52
|
+
signature.label += asPlainText(item.suffixDisplayParts);
|
|
38
53
|
return signature;
|
|
39
54
|
}
|
|
40
55
|
function asParameterInformation(parameter) {
|
|
41
56
|
return {
|
|
42
|
-
label:
|
|
43
|
-
documentation:
|
|
57
|
+
label: asPlainText(parameter.displayParts),
|
|
58
|
+
documentation: asDocumentation(parameter),
|
|
44
59
|
};
|
|
45
60
|
}
|
|
61
|
+
export function toTsTriggerReason(context) {
|
|
62
|
+
switch (context.triggerKind) {
|
|
63
|
+
case lsp.SignatureHelpTriggerKind.TriggerCharacter:
|
|
64
|
+
if (context.triggerCharacter) {
|
|
65
|
+
if (context.isRetrigger) {
|
|
66
|
+
return { kind: 'retrigger', triggerCharacter: context.triggerCharacter };
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
return { kind: 'characterTyped', triggerCharacter: context.triggerCharacter };
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
return { kind: 'invoked' };
|
|
74
|
+
}
|
|
75
|
+
case lsp.SignatureHelpTriggerKind.ContentChange:
|
|
76
|
+
return context.isRetrigger ? { kind: 'retrigger' } : { kind: 'invoked' };
|
|
77
|
+
case lsp.SignatureHelpTriggerKind.Invoked:
|
|
78
|
+
default:
|
|
79
|
+
return { kind: 'invoked' };
|
|
80
|
+
}
|
|
81
|
+
}
|
|
46
82
|
//# sourceMappingURL=hover.js.map
|
package/lib/hover.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hover.js","sourceRoot":"","sources":["../src/hover.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"hover.js","sourceRoot":"","sources":["../src/hover.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH;;;gGAGgG;AAEhG,OAAO,KAAK,GAAG,MAAM,uBAAuB,CAAC;AAE7C,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAEzE,MAAM,UAAU,eAAe,CAAC,IAA4B,EAAE,OAAkC;IAC5F,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAC;IAC1D,OAAO;QACH,eAAe,EAAE,kBAAkB,CAAC,IAAI,EAAE,UAAU,EAAE,OAAO,CAAC;QAC9D,eAAe,EAAE,kBAAkB,CAAC,IAAI,CAAC;QACzC,UAAU;KACb,CAAC;AACN,CAAC;AAED,SAAS,kBAAkB,CAAC,IAA4B,EAAE,UAA+C,EAAE,OAAkC;IACzI,yEAAyE;IACzE,IAAI,OAAO,EAAE,mBAAmB,EAAE,eAAe,KAAK,SAAS,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client';
|
|
2
|
-
import * as lsp from 'vscode-languageserver
|
|
1
|
+
import { LspClient } from './lsp-client.js';
|
|
2
|
+
import * as lsp from 'vscode-languageserver';
|
|
3
3
|
/**
|
|
4
4
|
* the logger type
|
|
5
5
|
*/
|
|
@@ -19,9 +19,17 @@ export declare class LspClientLogger implements Logger {
|
|
|
19
19
|
info(...arg: any[]): void;
|
|
20
20
|
log(...arg: any[]): void;
|
|
21
21
|
}
|
|
22
|
+
export declare enum ConsoleLogLevel {
|
|
23
|
+
error = "error",
|
|
24
|
+
warn = "warn",
|
|
25
|
+
info = "warn",
|
|
26
|
+
verbose = "verbose"
|
|
27
|
+
}
|
|
22
28
|
export declare class ConsoleLogger implements Logger {
|
|
23
|
-
private
|
|
24
|
-
constructor(
|
|
29
|
+
private level;
|
|
30
|
+
constructor(level?: lsp.MessageType);
|
|
31
|
+
static toMessageTypeLevel(type?: string): lsp.MessageType;
|
|
32
|
+
private print;
|
|
25
33
|
private toStrings;
|
|
26
34
|
error(...arg: any[]): void;
|
|
27
35
|
warn(...arg: any[]): void;
|
package/lib/logger.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,SAAS,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,GAAG,MAAM,uBAAuB,CAAC;AAE7C;;GAEG;AACH,MAAM,WAAW,MAAM;IACnB,KAAK,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IAC3B,IAAI,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IAC1B,IAAI,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IA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AM;IAAU,OAAO,CAAC,MAAM;gBAA9B,MAAM,EAAE,MAAM,EAAU,MAAM,EAAE,MAAM;IAE1D,KAAK,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI;IAI1B,IAAI,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI;IAIzB,IAAI,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI;IAIzB,GAAG,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI;CAG3B"}
|
package/lib/logger.js
CHANGED
|
@@ -1,37 +1,11 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/*
|
|
3
2
|
* Copyright (C) 2017, 2018 TypeFox and others.
|
|
4
3
|
*
|
|
5
4
|
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
|
|
6
5
|
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
7
6
|
*/
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
11
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
12
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
13
|
-
}
|
|
14
|
-
Object.defineProperty(o, k2, desc);
|
|
15
|
-
}) : (function(o, m, k, k2) {
|
|
16
|
-
if (k2 === undefined) k2 = k;
|
|
17
|
-
o[k2] = m[k];
|
|
18
|
-
}));
|
|
19
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
20
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
21
|
-
}) : function(o, v) {
|
|
22
|
-
o["default"] = v;
|
|
23
|
-
});
|
|
24
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
25
|
-
if (mod && mod.__esModule) return mod;
|
|
26
|
-
var result = {};
|
|
27
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
28
|
-
__setModuleDefault(result, mod);
|
|
29
|
-
return result;
|
|
30
|
-
};
|
|
31
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32
|
-
exports.PrefixingLogger = exports.ConsoleLogger = exports.LspClientLogger = void 0;
|
|
33
|
-
const lsp = __importStar(require("vscode-languageserver/node"));
|
|
34
|
-
class LspClientLogger {
|
|
7
|
+
import * as lsp from 'vscode-languageserver';
|
|
8
|
+
export class LspClientLogger {
|
|
35
9
|
constructor(client, level) {
|
|
36
10
|
this.client = client;
|
|
37
11
|
this.level = level;
|
|
@@ -48,7 +22,7 @@ class LspClientLogger {
|
|
|
48
22
|
}).join(' ');
|
|
49
23
|
this.client.logMessage({
|
|
50
24
|
type: severity,
|
|
51
|
-
message: message
|
|
25
|
+
message: message,
|
|
52
26
|
});
|
|
53
27
|
}
|
|
54
28
|
}
|
|
@@ -65,33 +39,53 @@ class LspClientLogger {
|
|
|
65
39
|
this.sendMessage(lsp.MessageType.Log, arg);
|
|
66
40
|
}
|
|
67
41
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
42
|
+
export var ConsoleLogLevel;
|
|
43
|
+
(function (ConsoleLogLevel) {
|
|
44
|
+
ConsoleLogLevel["error"] = "error";
|
|
45
|
+
ConsoleLogLevel["warn"] = "warn";
|
|
46
|
+
ConsoleLogLevel["info"] = "warn";
|
|
47
|
+
ConsoleLogLevel["verbose"] = "verbose";
|
|
48
|
+
})(ConsoleLogLevel = ConsoleLogLevel || (ConsoleLogLevel = {}));
|
|
49
|
+
export class ConsoleLogger {
|
|
50
|
+
constructor(level = lsp.MessageType.Info) {
|
|
51
|
+
this.level = level;
|
|
52
|
+
}
|
|
53
|
+
static toMessageTypeLevel(type) {
|
|
54
|
+
switch (type) {
|
|
55
|
+
case 'error':
|
|
56
|
+
return lsp.MessageType.Error;
|
|
57
|
+
case 'warn':
|
|
58
|
+
return lsp.MessageType.Warning;
|
|
59
|
+
case 'log':
|
|
60
|
+
return lsp.MessageType.Log;
|
|
61
|
+
case 'info':
|
|
62
|
+
default:
|
|
63
|
+
return lsp.MessageType.Info;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
print(type, level, ...arg) {
|
|
67
|
+
if (this.level >= level) {
|
|
68
|
+
// eslint-disable-next-line no-console
|
|
69
|
+
console[type](...this.toStrings(arg));
|
|
70
|
+
}
|
|
72
71
|
}
|
|
73
72
|
toStrings(...arg) {
|
|
74
73
|
return arg.map(a => JSON.stringify(a, null, 2));
|
|
75
74
|
}
|
|
76
75
|
error(...arg) {
|
|
77
|
-
|
|
76
|
+
this.print('error', lsp.MessageType.Error, arg);
|
|
78
77
|
}
|
|
79
78
|
warn(...arg) {
|
|
80
|
-
|
|
79
|
+
this.print('error', lsp.MessageType.Warning, arg);
|
|
81
80
|
}
|
|
82
81
|
info(...arg) {
|
|
83
|
-
|
|
84
|
-
console.info(...this.toStrings(arg));
|
|
82
|
+
this.print('error', lsp.MessageType.Info, arg);
|
|
85
83
|
}
|
|
86
84
|
log(...arg) {
|
|
87
|
-
|
|
88
|
-
// eslint-disable-next-line no-console
|
|
89
|
-
console.log(...this.toStrings(arg));
|
|
90
|
-
}
|
|
85
|
+
this.print('error', lsp.MessageType.Log, arg);
|
|
91
86
|
}
|
|
92
87
|
}
|
|
93
|
-
|
|
94
|
-
class PrefixingLogger {
|
|
88
|
+
export class PrefixingLogger {
|
|
95
89
|
constructor(logger, prefix) {
|
|
96
90
|
this.logger = logger;
|
|
97
91
|
this.prefix = prefix;
|
|
@@ -109,5 +103,4 @@ class PrefixingLogger {
|
|
|
109
103
|
this.logger.log(this.prefix, ...arg);
|
|
110
104
|
}
|
|
111
105
|
}
|
|
112
|
-
exports.PrefixingLogger = PrefixingLogger;
|
|
113
106
|
//# sourceMappingURL=logger.js.map
|
package/lib/logger.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,GAAG,MAAM,uBAAuB,CAAC;AAY7C,MAAM,OAAO,eAAe;IACxB,YAAsB,MAAiB,EAAY,KAAsB;QAAnD,WAAM,GAAN,MAAM,CAAW;QAAY,UAAK,GAAL,KAAK,CAAiB;IAAI,CAAC;IAEpE,WAAW,CAAC,QAAyB,EAAE,cAAqB;QAClE,IAAI,IAAI,CAAC,KAAK,IAAI,QAAQ,EAAE;YACxB,MAAM,OAAO,GAAG,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE;gBACnC,IAAI,OAAO,CAAC,KAAK,QAAQ,EAAE;oBACvB,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;iBACrC;qBAAM;oBACH,OAAO,CAAC,CAAC;iBACZ;YACL,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YAEb,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC;gBACnB,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,OAAO;aACnB,CAAC,CAAC;SACN;IACL,CAAC;IAED,KAAK,CAAC,GAAG,GAAU;QACf,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,WAAW,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IACjD,CAAC;IAED,IAAI,CAAC,GAAG,GAAU;QACd,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,WAAW,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;IACnD,CAAC;IAED,IAAI,CAAC,GAAG,GAAU;QACd,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,WAAW,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;IAChD,CAAC;IAED,GAAG,CAAC,GAAG,GAAU;QACb,IAAI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|
3
|
-
|
|
4
|
-
|
|
5
|
-
end(): void;
|
|
1
|
+
import * as lsp from 'vscode-languageserver';
|
|
2
|
+
export interface WithProgressOptions {
|
|
3
|
+
message: string;
|
|
4
|
+
reporter: lsp.WorkDoneProgressReporter;
|
|
6
5
|
}
|
|
7
6
|
export interface LspClient {
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
createProgressReporter(token?: lsp.CancellationToken, workDoneProgress?: lsp.WorkDoneProgressReporter): Promise<lsp.WorkDoneProgressReporter>;
|
|
8
|
+
withProgress<R>(options: WithProgressOptions, task: (progress: lsp.WorkDoneProgressReporter) => Promise<R>): Promise<R>;
|
|
10
9
|
publishDiagnostics(args: lsp.PublishDiagnosticsParams): void;
|
|
11
|
-
|
|
10
|
+
showErrorMessage(message: string): void;
|
|
12
11
|
logMessage(args: lsp.LogMessageParams): void;
|
|
13
|
-
applyWorkspaceEdit(args: lsp.ApplyWorkspaceEditParams): Promise<lsp.
|
|
14
|
-
telemetry(args: any): void;
|
|
12
|
+
applyWorkspaceEdit(args: lsp.ApplyWorkspaceEditParams): Promise<lsp.ApplyWorkspaceEditResult>;
|
|
15
13
|
rename(args: lsp.TextDocumentPositionParams): Promise<any>;
|
|
16
14
|
}
|
|
17
15
|
export declare class LspClientImpl implements LspClient {
|
|
18
16
|
protected connection: lsp.Connection;
|
|
19
|
-
private clientCapabilities?;
|
|
20
17
|
constructor(connection: lsp.Connection);
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
publishDiagnostics(
|
|
24
|
-
|
|
18
|
+
createProgressReporter(_?: lsp.CancellationToken, workDoneProgress?: lsp.WorkDoneProgressReporter): Promise<lsp.WorkDoneProgressReporter>;
|
|
19
|
+
withProgress<R = unknown>(options: WithProgressOptions, task: (progress: lsp.WorkDoneProgressReporter) => Promise<R>): Promise<R>;
|
|
20
|
+
publishDiagnostics(params: lsp.PublishDiagnosticsParams): void;
|
|
21
|
+
showErrorMessage(message: string): void;
|
|
25
22
|
logMessage(args: lsp.LogMessageParams): void;
|
|
26
|
-
|
|
27
|
-
applyWorkspaceEdit(args: lsp.ApplyWorkspaceEditParams): Promise<lsp.ApplyWorkspaceEditResponse>;
|
|
23
|
+
applyWorkspaceEdit(params: lsp.ApplyWorkspaceEditParams): Promise<lsp.ApplyWorkspaceEditResult>;
|
|
28
24
|
rename(args: lsp.TextDocumentPositionParams): Promise<any>;
|
|
29
25
|
}
|
|
30
26
|
//# sourceMappingURL=lsp-client.d.ts.map
|
package/lib/lsp-client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lsp-client.d.ts","sourceRoot":"","sources":["../src/lsp-client.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"lsp-client.d.ts","sourceRoot":"","sources":["../src/lsp-client.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,GAAG,MAAM,uBAAuB,CAAC;AAK7C,MAAM,WAAW,mBAAmB;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,GAAG,CAAC,wBAAwB,CAAC;CAC1C;AAED,MAAM,WAAW,SAAS;IACtB,sBAAsB,CAAC,KAAK,CAAC,EAAE,GAAG,CAAC,iBAAiB,EAAE,gBAAgB,CAAC,EAAE,GAAG,CAAC,wBAAwB,GAAG,OAAO,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAC;IAC9I,YAAY,CAAC,CAAC,EAAE,OAAO,EAAE,mBAAmB,EAAE,IAAI,EAAE,CAAC,QAAQ,EAAE,GAAG,CAAC,wBAAwB,KAAK,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IACxH,kBAAkB,CAAC,IAAI,EAAE,GAAG,CAAC,wBAAwB,GAAG,IAAI,CAAC;IAC7D,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACxC,UAAU,CAAC,IAAI,EAAE,GAAG,CAAC,gBAAgB,GAAG,IAAI,CAAC;IAC7C,kBAAkB,CAAC,IAAI,EAAE,GAAG,CAAC,wBAAwB,GAAG,OAAO,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAC;IAC9F,MAAM,CAAC,IAAI,EAAE,GAAG,CAAC,0BAA0B,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;CAC9D;AAKD,qBAAa,aAAc,YAAW,SAAS;IAC/B,SAAS,CAAC,UAAU,EAAE,GAAG,CAAC,UAAU;gBAA1B,UAAU,EAAE,GAAG,CAAC,UAAU;IAE1C,sBAAsB,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,iBAAiB,EAAE,gBAAgB,CAAC,EAAE,GAAG,CAAC,wBAAwB,GAAG,OAAO,CAAC,GAAG,CAAC,wBAAwB,CAAC;IAUzI,YAAY,CAAC,CAAC,GAAG,OAAO,EAAE,OAAO,EAAE,mBAAmB,EAAE,IAAI,EAAE,CAAC,QAAQ,EAAE,GAAG,CAAC,wBAAwB,KAAK,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;IASvI,kBAAkB,CAAC,MAAM,EAAE,GAAG,CAAC,wBAAwB,GAAG,IAAI;IAI9D,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAIvC,UAAU,CAAC,IAAI,EAAE,GAAG,CAAC,gBAAgB,GAAG,IAAI;IAItC,kBAAkB,CAAC,MAAM,EAAE,GAAG,CAAC,wBAAwB,GAAG,OAAO,CAAC,GAAG,CAAC,wBAAwB,CAAC;IAI/F,MAAM,CAAC,IAAI,EAAE,GAAG,CAAC,0BAA0B,GAAG,OAAO,CAAC,GAAG,CAAC;CAGnE"}
|
package/lib/lsp-client.js
CHANGED
|
@@ -1,110 +1,51 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/*
|
|
3
2
|
* Copyright (C) 2017, 2018 TypeFox and others.
|
|
4
3
|
*
|
|
5
4
|
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
|
|
6
5
|
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
7
6
|
*/
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}) : (function(o, m, k, k2) {
|
|
16
|
-
if (k2 === undefined) k2 = k;
|
|
17
|
-
o[k2] = m[k];
|
|
18
|
-
}));
|
|
19
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
20
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
21
|
-
}) : function(o, v) {
|
|
22
|
-
o["default"] = v;
|
|
23
|
-
});
|
|
24
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
25
|
-
if (mod && mod.__esModule) return mod;
|
|
26
|
-
var result = {};
|
|
27
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
28
|
-
__setModuleDefault(result, mod);
|
|
29
|
-
return result;
|
|
30
|
-
};
|
|
31
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
32
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
33
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
34
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
35
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
36
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
37
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
38
|
-
});
|
|
39
|
-
};
|
|
40
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
|
-
exports.LspClientImpl = void 0;
|
|
42
|
-
const lsp = __importStar(require("vscode-languageserver/node"));
|
|
43
|
-
const ts_protocol_1 = require("./ts-protocol");
|
|
44
|
-
class LspClientImpl {
|
|
7
|
+
import * as lsp from 'vscode-languageserver';
|
|
8
|
+
import { MessageType } from 'vscode-languageserver';
|
|
9
|
+
import { attachWorkDone } from 'vscode-languageserver/lib/common/progress.js';
|
|
10
|
+
import { TypeScriptRenameRequest } from './ts-protocol.js';
|
|
11
|
+
// Hack around the LSP library that makes it otherwise impossible to differentiate between Null and Client-initiated reporter.
|
|
12
|
+
const nullProgressReporter = attachWorkDone(undefined, /* params */ undefined);
|
|
13
|
+
export class LspClientImpl {
|
|
45
14
|
constructor(connection) {
|
|
46
15
|
this.connection = connection;
|
|
47
16
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
report: (message) => {
|
|
66
|
-
if (workDoneProgress) {
|
|
67
|
-
workDoneProgress
|
|
68
|
-
.then((progress) => {
|
|
69
|
-
progress.report(message);
|
|
70
|
-
})
|
|
71
|
-
.catch(() => { });
|
|
72
|
-
}
|
|
73
|
-
},
|
|
74
|
-
end: () => {
|
|
75
|
-
if (workDoneProgress) {
|
|
76
|
-
workDoneProgress
|
|
77
|
-
.then((progress) => {
|
|
78
|
-
progress.done();
|
|
79
|
-
})
|
|
80
|
-
.catch(() => { });
|
|
81
|
-
workDoneProgress = undefined;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
};
|
|
17
|
+
async createProgressReporter(_, workDoneProgress) {
|
|
18
|
+
let reporter;
|
|
19
|
+
if (workDoneProgress && workDoneProgress.constructor !== nullProgressReporter.constructor) {
|
|
20
|
+
reporter = workDoneProgress;
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
reporter = workDoneProgress || await this.connection.window.createWorkDoneProgress();
|
|
24
|
+
}
|
|
25
|
+
return reporter;
|
|
26
|
+
}
|
|
27
|
+
async withProgress(options, task) {
|
|
28
|
+
const { message, reporter } = options;
|
|
29
|
+
reporter.begin(message);
|
|
30
|
+
return task(reporter).then(result => {
|
|
31
|
+
reporter.done();
|
|
32
|
+
return result;
|
|
33
|
+
});
|
|
85
34
|
}
|
|
86
|
-
publishDiagnostics(
|
|
87
|
-
this.connection.
|
|
35
|
+
publishDiagnostics(params) {
|
|
36
|
+
this.connection.sendDiagnostics(params);
|
|
88
37
|
}
|
|
89
|
-
|
|
90
|
-
this.connection.sendNotification(lsp.ShowMessageNotification.type,
|
|
38
|
+
showErrorMessage(message) {
|
|
39
|
+
this.connection.sendNotification(lsp.ShowMessageNotification.type, { type: MessageType.Error, message });
|
|
91
40
|
}
|
|
92
41
|
logMessage(args) {
|
|
93
42
|
this.connection.sendNotification(lsp.LogMessageNotification.type, args);
|
|
94
43
|
}
|
|
95
|
-
|
|
96
|
-
this.connection.
|
|
44
|
+
async applyWorkspaceEdit(params) {
|
|
45
|
+
return this.connection.workspace.applyEdit(params);
|
|
97
46
|
}
|
|
98
|
-
|
|
99
|
-
return
|
|
100
|
-
return this.connection.sendRequest(lsp.ApplyWorkspaceEditRequest.type, args);
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
rename(args) {
|
|
104
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
105
|
-
return this.connection.sendRequest(ts_protocol_1.TypeScriptRenameRequest.type, args);
|
|
106
|
-
});
|
|
47
|
+
async rename(args) {
|
|
48
|
+
return this.connection.sendRequest(TypeScriptRenameRequest.type, args);
|
|
107
49
|
}
|
|
108
50
|
}
|
|
109
|
-
exports.LspClientImpl = LspClientImpl;
|
|
110
51
|
//# sourceMappingURL=lsp-client.js.map
|
package/lib/lsp-client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lsp-client.js","sourceRoot":"","sources":["../src/lsp-client.ts"],"names":[],"mappings":"
|
|
1
|
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CAAC;IAC5C,CAAC;IAED,gBAAgB,CAAC,OAAe;QAC5B,IAAI,CAAC,UAAU,CAAC,gBAAgB,CAAC,GAAG,CAAC,uBAAuB,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,WAAW,CAAC,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC;IAC7G,CAAC;IAED,UAAU,CAAC,IAA0B;QACjC,IAAI,CAAC,UAAU,CAAC,gBAAgB,CAAC,GAAG,CAAC,sBAAsB,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAC5E,CAAC;IAED,KAAK,CAAC,kBAAkB,CAAC,MAAoC;QACzD,OAAO,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IACvD,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,IAAoC;QAC7C,OAAO,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,uBAAuB,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAC3E,CAAC;CACJ"}
|
package/lib/lsp-connection.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lsp-connection.d.ts","sourceRoot":"","sources":["../src/lsp-connection.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"lsp-connection.d.ts","sourceRoot":"","sources":["../src/lsp-connection.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,GAAG,MAAM,+BAA+B,CAAC;AAOrD,MAAM,WAAW,cAAc;IAC3B,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,gBAAgB,EAAE,GAAG,CAAC,WAAW,CAAC;CACrC;AAED,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,cAAc,GAAG,GAAG,CAAC,UAAU,CAgD3E"}
|
package/lib/lsp-connection.js
CHANGED
|
@@ -1,51 +1,25 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/*
|
|
3
2
|
* Copyright (C) 2017, 2018 TypeFox and others.
|
|
4
3
|
*
|
|
5
4
|
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
|
|
6
5
|
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
7
6
|
*/
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}) : (function(o, m, k, k2) {
|
|
16
|
-
if (k2 === undefined) k2 = k;
|
|
17
|
-
o[k2] = m[k];
|
|
18
|
-
}));
|
|
19
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
20
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
21
|
-
}) : function(o, v) {
|
|
22
|
-
o["default"] = v;
|
|
23
|
-
});
|
|
24
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
25
|
-
if (mod && mod.__esModule) return mod;
|
|
26
|
-
var result = {};
|
|
27
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
28
|
-
__setModuleDefault(result, mod);
|
|
29
|
-
return result;
|
|
30
|
-
};
|
|
31
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32
|
-
exports.createLspConnection = void 0;
|
|
33
|
-
const lsp = __importStar(require("vscode-languageserver/node"));
|
|
34
|
-
const lspcalls = __importStar(require("./lsp-protocol.calls.proposed"));
|
|
35
|
-
const lspinlayHints = __importStar(require("./lsp-protocol.inlayHints.proposed"));
|
|
36
|
-
const logger_1 = require("./logger");
|
|
37
|
-
const lsp_server_1 = require("./lsp-server");
|
|
38
|
-
const lsp_client_1 = require("./lsp-client");
|
|
39
|
-
function createLspConnection(options) {
|
|
7
|
+
import * as lsp from 'vscode-languageserver/node.js';
|
|
8
|
+
import * as lspcalls from './lsp-protocol.calls.proposed.js';
|
|
9
|
+
import * as lspinlayHints from './lsp-protocol.inlayHints.proposed.js';
|
|
10
|
+
import { LspClientLogger } from './logger.js';
|
|
11
|
+
import { LspServer } from './lsp-server.js';
|
|
12
|
+
import { LspClientImpl } from './lsp-client.js';
|
|
13
|
+
export function createLspConnection(options) {
|
|
40
14
|
const connection = lsp.createConnection(lsp.ProposedFeatures.all);
|
|
41
|
-
const lspClient = new
|
|
42
|
-
const logger = new
|
|
43
|
-
const server = new
|
|
15
|
+
const lspClient = new LspClientImpl(connection);
|
|
16
|
+
const logger = new LspClientLogger(lspClient, options.showMessageLevel);
|
|
17
|
+
const server = new LspServer({
|
|
44
18
|
logger,
|
|
45
19
|
lspClient,
|
|
46
20
|
tsserverPath: options.tsserverPath,
|
|
47
21
|
tsserverLogFile: options.tsserverLogFile,
|
|
48
|
-
tsserverLogVerbosity: options.tsserverLogVerbosity
|
|
22
|
+
tsserverLogVerbosity: options.tsserverLogVerbosity,
|
|
49
23
|
});
|
|
50
24
|
connection.onInitialize(server.initialize.bind(server));
|
|
51
25
|
connection.onDidChangeConfiguration(server.didChangeConfiguration.bind(server));
|
|
@@ -70,12 +44,12 @@ function createLspConnection(options) {
|
|
|
70
44
|
connection.onSignatureHelp(server.signatureHelp.bind(server));
|
|
71
45
|
connection.onWorkspaceSymbol(server.workspaceSymbol.bind(server));
|
|
72
46
|
connection.onFoldingRanges(server.foldingRanges.bind(server));
|
|
47
|
+
connection.languages.inlayHint.on(server.inlayHints.bind(server));
|
|
73
48
|
// proposed `textDocument/calls` request
|
|
74
49
|
connection.onRequest(lspcalls.CallsRequest.type, server.calls.bind(server));
|
|
75
|
-
connection.onRequest(lspinlayHints.type, server.
|
|
50
|
+
connection.onRequest(lspinlayHints.type, server.inlayHintsLegacy.bind(server));
|
|
76
51
|
connection.onRequest(lsp.SemanticTokensRequest.type, server.semanticTokensFull.bind(server));
|
|
77
52
|
connection.onRequest(lsp.SemanticTokensRangeRequest.type, server.semanticTokensRange.bind(server));
|
|
78
53
|
return connection;
|
|
79
54
|
}
|
|
80
|
-
exports.createLspConnection = createLspConnection;
|
|
81
55
|
//# sourceMappingURL=lsp-connection.js.map
|