typescript-language-server 0.6.3 → 0.7.1
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 +76 -0
- package/README.md +216 -31
- package/lib/cli.js +4 -9
- package/lib/cli.js.map +1 -1
- package/lib/commands.d.ts +4 -1
- package/lib/commands.d.ts.map +1 -1
- package/lib/commands.js +5 -2
- package/lib/commands.js.map +1 -1
- package/lib/completion.d.ts.map +1 -1
- package/lib/completion.js +55 -29
- package/lib/completion.js.map +1 -1
- package/lib/file-lsp-server.spec.js +22 -0
- package/lib/file-lsp-server.spec.js.map +1 -1
- package/lib/lsp-connection.d.ts.map +1 -1
- package/lib/lsp-connection.js +1 -0
- package/lib/lsp-connection.js.map +1 -1
- package/lib/lsp-protocol.calls.proposed.d.ts.map +1 -1
- package/lib/lsp-protocol.calls.proposed.js.map +1 -1
- package/lib/lsp-protocol.inlayHints.proposed.d.ts +9 -0
- package/lib/lsp-protocol.inlayHints.proposed.d.ts.map +1 -1
- package/lib/lsp-server.d.ts +8 -2
- package/lib/lsp-server.d.ts.map +1 -1
- package/lib/lsp-server.js +144 -62
- package/lib/lsp-server.js.map +1 -1
- package/lib/lsp-server.spec.js +218 -8
- package/lib/lsp-server.spec.js.map +1 -1
- package/lib/organize-imports.d.ts +2 -1
- package/lib/organize-imports.d.ts.map +1 -1
- package/lib/organize-imports.js +7 -5
- package/lib/organize-imports.js.map +1 -1
- package/lib/organize-imports.spec.js +14 -7
- package/lib/organize-imports.spec.js.map +1 -1
- package/lib/protocol-translation.d.ts +7 -3
- package/lib/protocol-translation.d.ts.map +1 -1
- package/lib/protocol-translation.js +21 -10
- package/lib/protocol-translation.js.map +1 -1
- package/lib/test-utils.js +1 -1
- package/lib/test-utils.js.map +1 -1
- package/lib/ts-protocol.d.ts +11 -1
- package/lib/ts-protocol.d.ts.map +1 -1
- package/lib/ts-protocol.js.map +1 -1
- package/lib/tsp-client.d.ts +1 -0
- package/lib/tsp-client.d.ts.map +1 -1
- package/lib/tsp-client.js +20 -11
- package/lib/tsp-client.js.map +1 -1
- package/lib/tsp-command-types.d.ts +12 -0
- package/lib/tsp-command-types.d.ts.map +1 -1
- package/lib/tsp-command-types.js +21 -1
- package/lib/tsp-command-types.js.map +1 -1
- package/lib/utils/api.d.ts +45 -0
- package/lib/utils/api.d.ts.map +1 -0
- package/lib/utils/api.js +95 -0
- package/lib/utils/api.js.map +1 -0
- package/package.json +5 -4
package/lib/completion.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"completion.js","sourceRoot":"","sources":["../src/completion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;;;;;;;;;;;AAEH,gEAAkD;AAGlD,
|
|
1
|
+
{"version":3,"file":"completion.js","sourceRoot":"","sources":["../src/completion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;;;;;;;;;;;AAEH,gEAAkD;AAGlD,2DAAuE;AACvE,iEAA0G;AAC1G,yCAAsC;AAMtC,SAAgB,gBAAgB,CAAC,KAA0B,EAAE,IAAY,EAAE,QAAsB,EAAE,QAAqB;IACpH,MAAM,IAAI,GAAqB;QAC3B,KAAK,EAAE,KAAK,CAAC,IAAI;QACjB,IAAI,EAAE,oBAAoB,CAAC,KAAK,CAAC,IAAI,CAAC;QACtC,QAAQ,EAAE,KAAK,CAAC,QAAQ;QACxB,gBAAgB,EAAE,kBAAkB,CAAC,KAAK,CAAC,IAAI,CAAC;QAChD,SAAS,EAAE,KAAK,CAAC,aAAa;QAC9B,IAAI,EAAE;YACF,IAAI;YACJ,IAAI,EAAE,QAAQ,CAAC,IAAI,GAAG,CAAC;YACvB,MAAM,EAAE,QAAQ,CAAC,SAAS,GAAG,CAAC;YAC9B,UAAU,EAAE;gBACR,KAAK,CAAC,MAAM,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;oBACzB,IAAI,EAAE,KAAK,CAAC,IAAI;oBAChB,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,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,KAAK,QAAQ,CAAC;iBACnE,CAAC,CAAC,CAAC;SACP,CAAC;KACL;AACL,CAAC;AAED,SAAS,QAAQ,CAAC,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,EAAE,gBAAgB,EAA8B;IACnG,MAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,MAAM,MAAM,GAAG,aAAa,IAAI,gBAAgB,CAAC;IACjD,IAAI,MAAM,EAAE;QACR,MAAM,CAAC,IAAI,CAAC,qBAAqB,IAAA,kCAAW,EAAC,MAAM,CAAC,GAAG,CAAC,CAAC;KAC5D;IACD,MAAM,MAAM,GAAG,IAAA,kCAAW,EAAC,YAAY,CAAC,CAAC;IACzC,IAAI,MAAM,EAAE;QACR,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;KACvB;IACD,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC7B,CAAC"}
|
|
@@ -49,4 +49,26 @@ describe('documentHighlight', () => {
|
|
|
49
49
|
assert.equal(2, result.length, JSON.stringify(result, undefined, 2));
|
|
50
50
|
})).timeout(10000);
|
|
51
51
|
});
|
|
52
|
+
describe('completions', () => {
|
|
53
|
+
it('receives completion that auto-imports from another module', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
54
|
+
const doc = {
|
|
55
|
+
uri: (0, test_utils_1.uri)('completion.ts'),
|
|
56
|
+
languageId: 'typescript',
|
|
57
|
+
version: 1,
|
|
58
|
+
text: (0, test_utils_1.readContents)((0, test_utils_1.filePath)('completion.ts'))
|
|
59
|
+
};
|
|
60
|
+
server.didOpenTextDocument({ textDocument: doc });
|
|
61
|
+
const proposals = yield server.completion({
|
|
62
|
+
textDocument: doc,
|
|
63
|
+
position: (0, test_utils_1.positionAfter)(doc, 'doStuff')
|
|
64
|
+
});
|
|
65
|
+
assert.isNotNull(proposals);
|
|
66
|
+
const completion = proposals.items.find(item => item.label === 'doStuff');
|
|
67
|
+
assert.isDefined(completion);
|
|
68
|
+
const resolvedCompletion = yield server.completionResolve(completion);
|
|
69
|
+
assert.isDefined(resolvedCompletion.additionalTextEdits);
|
|
70
|
+
assert.isUndefined(resolvedCompletion.command);
|
|
71
|
+
server.didCloseTextDocument({ textDocument: doc });
|
|
72
|
+
})).timeout(10000);
|
|
73
|
+
});
|
|
52
74
|
//# sourceMappingURL=file-lsp-server.spec.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-lsp-server.spec.js","sourceRoot":"","sources":["../src/file-lsp-server.spec.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;;;AAEH,gDAAwB;AAExB,
|
|
1
|
+
{"version":3,"file":"file-lsp-server.spec.js","sourceRoot":"","sources":["../src/file-lsp-server.spec.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;;;AAEH,gDAAwB;AAExB,6CAAsG;AAEtG,MAAM,MAAM,GAAG,cAAI,CAAC,MAAM,CAAC;AAE3B,IAAI,MAAiB,CAAC;AAEtB,MAAM,CAAC,GAAS,EAAE;IACd,MAAM,GAAG,MAAM,IAAA,yBAAY,EAAC;QACxB,OAAO,EAAE,IAAA,gBAAG,GAAE;QACd,kBAAkB,EAAE,GAAG,EAAE,GAAG,CAAC;KAChC,CAAC,CAAC;AACP,CAAC,CAAA,CAAC,CAAC;AACH,UAAU,CAAC,GAAG,EAAE;IACZ,MAAM,CAAC,QAAQ,EAAE,CAAC;AACtB,CAAC,CAAC,CAAC;AAEH,QAAQ,CAAC,mBAAmB,EAAE,GAAG,EAAE;IAC/B,EAAE,CAAC,aAAa,EAAE,GAAS,EAAE;QACzB,MAAM,GAAG,GAAG;YACR,GAAG,EAAE,IAAA,gBAAG,EAAC,YAAY,CAAC;YACtB,UAAU,EAAE,YAAY;YACxB,OAAO,EAAE,CAAC;YACV,IAAI,EAAE,IAAA,yBAAY,EAAC,IAAA,qBAAQ,EAAC,YAAY,CAAC,CAAC;SAC7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BAAkB,GAAG,MAAM,MAAM,CAAC,iBAAiB,CAAC,UAAW,CAAC,CAAC;QACvE,MAAM,CAAC,SAAS,CAAC,kBAAkB,CAAC,mBAAmB,CAAC,CAAC;QACzD,MAAM,CAAC,WAAW,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC;QAC/C,MAAM,CAAC,oBAAoB,CAAC,EAAE,YAAY,EAAE,GAAG,EAAE,CAAC,CAAC;IACvD,CAAC,CAAA,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AACtB,CAAC,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lsp-connection.d.ts","sourceRoot":"","sources":["../src/lsp-connection.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,GAAG,MAAM,4BAA4B,CAAC;AAQlD,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,
|
|
1
|
+
{"version":3,"file":"lsp-connection.d.ts","sourceRoot":"","sources":["../src/lsp-connection.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,GAAG,MAAM,4BAA4B,CAAC;AAQlD,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,CA4C3E"}
|
package/lib/lsp-connection.js
CHANGED
|
@@ -44,6 +44,7 @@ function createLspConnection(options) {
|
|
|
44
44
|
tsserverLogVerbosity: options.tsserverLogVerbosity
|
|
45
45
|
});
|
|
46
46
|
connection.onInitialize(server.initialize.bind(server));
|
|
47
|
+
connection.onDidChangeConfiguration(server.didChangeConfiguration.bind(server));
|
|
47
48
|
connection.onDidOpenTextDocument(server.didOpenTextDocument.bind(server));
|
|
48
49
|
connection.onDidSaveTextDocument(server.didSaveTextDocument.bind(server));
|
|
49
50
|
connection.onDidCloseTextDocument(server.didCloseTextDocument.bind(server));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lsp-connection.js","sourceRoot":"","sources":["../src/lsp-connection.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;;;;;;;;;;;AAEH,gEAAkD;AAClD,wEAA0D;AAC1D,kFAAoE;AAEpE,qCAA2C;AAC3C,6CAAyC;AACzC,6CAA6C;AAS7C,SAAgB,mBAAmB,CAAC,OAAuB;IACvD,MAAM,UAAU,GAAG,GAAG,CAAC,gBAAgB,CAAC,GAAG,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC;IAClE,MAAM,SAAS,GAAG,IAAI,0BAAa,CAAC,UAAU,CAAC,CAAC;IAChD,MAAM,MAAM,GAAG,IAAI,wBAAe,CAAC,SAAS,EAAE,OAAO,CAAC,gBAAgB,CAAC,CAAC;IACxE,MAAM,MAAM,GAAc,IAAI,sBAAS,CAAC;QACpC,MAAM;QACN,SAAS;QACT,YAAY,EAAE,OAAO,CAAC,YAAY;QAClC,eAAe,EAAE,OAAO,CAAC,eAAe;QACxC,oBAAoB,EAAE,OAAO,CAAC,oBAAoB;KACrD,CAAC,CAAC;IAEH,UAAU,CAAC,YAAY,CAAC,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"lsp-connection.js","sourceRoot":"","sources":["../src/lsp-connection.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;;;;;;;;;;;AAEH,gEAAkD;AAClD,w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AAM,EAAE,cAAc,GAAG,gBAAgB,CAI5E;CACJ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lsp-protocol.calls.proposed.js","sourceRoot":"","sources":["../src/lsp-protocol.calls.proposed.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;AAIb,gEAAkD;AA4BlD;;;;GAIG;AACH,IAAiB,YAAY,CAG5B;AAHD,WAAiB,YAAY;IACZ,iBAAI,GAAG,IAAI,GAAG,CAAC,WAAW,CAAgE,oBAAoB,CAAC,CAAC;AAEjI,CAAC,EAHgB,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QAG5B;AAaD;;GAEG;AACH,IAAY,aASX;AATD,WAAY,aAAa;IACrB;;OAEG;IACH,sCAAqB,CAAA;IACrB;;OAEG;IACH,sCAAqB,CAAA;AACzB,CAAC,EATW,aAAa,GAAb,qBAAa,KAAb,qBAAa,QASxB;
|
|
1
|
+
{"version":3,"file":"lsp-protocol.calls.proposed.js","sourceRoot":"","sources":["../src/lsp-protocol.calls.proposed.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;AAIb,gEAAkD;AA4BlD;;;;GAIG;AACH,IAAiB,YAAY,CAG5B;AAHD,WAAiB,YAAY;IACZ,iBAAI,GAAG,IAAI,GAAG,CAAC,WAAW,CAAgE,oBAAoB,CAAC,CAAC;AAEjI,CAAC,EAHgB,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QAG5B;AAaD;;GAEG;AACH,IAAY,aASX;AATD,WAAY,aAAa;IACrB;;OAEG;IACH,sCAAqB,CAAA;IACrB;;OAEG;IACH,sCAAqB,CAAA;AACzB,CAAC,EATW,aAAa,GAAb,qBAAa,KAAb,qBAAa,QASxB;AA6DD,IAAiB,gBAAgB,CAMhC;AAND,WAAiB,gBAAgB;IAC7B,SAAgB,MAAM,CAAC,GAAW,EAAE,MAAsB;QACtD,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,cAAc,EAAE,GAAG,MAAM,CAAC;QAC7D,MAAM,QAAQ,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC;QAChC,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,cAAc,EAAE,CAAC;IAC5D,CAAC;IAJe,uBAAM,SAIrB,CAAA;AACL,CAAC,EANgB,gBAAgB,GAAhB,wBAAgB,KAAhB,wBAAgB,QAMhC"}
|
|
@@ -23,5 +23,14 @@ export declare type InlayHintsResult = {
|
|
|
23
23
|
};
|
|
24
24
|
export declare const type: lsp.RequestType<InlayHintsParams, InlayHintsResult, lsp.TextDocumentRegistrationOptions>;
|
|
25
25
|
export declare type HandlerSignature = RequestHandler<InlayHintsParams, InlayHintsResult | null, void>;
|
|
26
|
+
export interface InlayHintsOptions {
|
|
27
|
+
includeInlayParameterNameHints?: 'none' | 'literals' | 'all';
|
|
28
|
+
includeInlayParameterNameHintsWhenArgumentMatchesName?: boolean;
|
|
29
|
+
includeInlayFunctionParameterTypeHints?: boolean;
|
|
30
|
+
includeInlayVariableTypeHints?: boolean;
|
|
31
|
+
includeInlayPropertyDeclarationTypeHints?: boolean;
|
|
32
|
+
includeInlayFunctionLikeReturnTypeHints?: boolean;
|
|
33
|
+
includeInlayEnumMemberValueHints?: boolean;
|
|
34
|
+
}
|
|
26
35
|
export {};
|
|
27
36
|
//# sourceMappingURL=lsp-protocol.inlayHints.proposed.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lsp-protocol.inlayHints.proposed.d.ts","sourceRoot":"","sources":["../src/lsp-protocol.inlayHints.proposed.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,4BAA4B,CAAC;AAClD,OAAO,GAAG,MAAM,yBAAyB,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,gBAA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;CAC7B,CAAC;AAEF,oBAAY,gBAAgB,GAAG;IAC3B,UAAU,EAAE,SAAS,EAAE,CAAC;CAC3B,CAAC;AAEF,eAAO,MAAM,IAAI,0FAAwH,CAAC;AAE1I,oBAAY,gBAAgB,GAAG,cAAc,CAAC,gBAAgB,EAAE,gBAAgB,GAAG,IAAI,EAAE,IAAI,CAAC,CAAC;AAE/F,MAAM,WAAW,iBAAiB;IAC9B,8BAA8B,CAAC,EAAE,MAAM,GAAG,UAAU,GAAG,KAAK,CAAC;IAC7D,qDAAqD,CAAC,EAAE,OAAO,CAAC;IAChE,sCAAsC,CAAC,EAAE,OAAO,CAAC;IACjD,6BAA6B,CAAC,EAAE,OAAO,CAAC;IACxC,wCAAwC,CAAC,EAAE,OAAO,CAAC;IACnD,uCAAuC,CAAC,EAAE,OAAO,CAAC;IAClD,gCAAgC,CAAC,EAAE,OAAO,CAAC;CAC9C"}
|
package/lib/lsp-server.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import tsp from 'typescript/lib/protocol';
|
|
|
5
5
|
import { Logger } from './logger';
|
|
6
6
|
import { LspClient } from './lsp-client';
|
|
7
7
|
import { LspDocument } from './document';
|
|
8
|
-
import { TypeScriptInitializeParams, TypeScriptInitializeResult } from './ts-protocol';
|
|
8
|
+
import { TypeScriptInitializeParams, TypeScriptInitializeResult, TypeScriptWorkspaceSettingsLanguageSettings } from './ts-protocol';
|
|
9
9
|
export interface IServerOptions {
|
|
10
10
|
logger: Logger;
|
|
11
11
|
tsserverPath?: string;
|
|
@@ -20,13 +20,18 @@ export declare class LspServer {
|
|
|
20
20
|
private tspClient;
|
|
21
21
|
private diagnosticQueue?;
|
|
22
22
|
private logger;
|
|
23
|
+
private workspaceConfiguration;
|
|
24
|
+
private workspaceRoot;
|
|
23
25
|
private readonly documents;
|
|
24
26
|
constructor(options: IServerOptions);
|
|
25
27
|
closeAll(): void;
|
|
26
28
|
protected findTsserverPath(): string;
|
|
29
|
+
private getTypeScriptVersion;
|
|
27
30
|
initialize(params: TypeScriptInitializeParams): Promise<TypeScriptInitializeResult>;
|
|
28
31
|
protected getLogFile(logVerbosity: string | undefined): string | undefined;
|
|
29
32
|
protected doGetLogFile(): string | undefined;
|
|
33
|
+
didChangeConfiguration(params: lsp.DidChangeConfigurationParams): void;
|
|
34
|
+
getWorkspacePreferencesForDocument(file: string): TypeScriptWorkspaceSettingsLanguageSettings;
|
|
30
35
|
protected diagnosticsTokenSource: lsp.CancellationTokenSource | undefined;
|
|
31
36
|
protected interuptDiagnostics<R>(f: () => R): R;
|
|
32
37
|
readonly requestDiagnostics: () => Promise<tsp.RequestCompletedEvent>;
|
|
@@ -55,6 +60,7 @@ export declare class LspServer {
|
|
|
55
60
|
references(params: lsp.TextDocumentPositionParams): Promise<lsp.Location[]>;
|
|
56
61
|
documentFormatting(params: lsp.DocumentFormattingParams): Promise<lsp.TextEdit[]>;
|
|
57
62
|
documentRangeFormatting(params: lsp.DocumentRangeFormattingParams): Promise<lsp.TextEdit[]>;
|
|
63
|
+
private getFormattingOptions;
|
|
58
64
|
signatureHelp(params: lsp.TextDocumentPositionParams): Promise<lsp.SignatureHelp | undefined>;
|
|
59
65
|
protected getSignatureHelp(file: string, position: lsp.Position): Promise<tsp.SignatureHelpResponse | undefined>;
|
|
60
66
|
codeAction(params: lsp.CodeActionParams): Promise<lsp.CodeAction[]>;
|
|
@@ -66,7 +72,6 @@ export declare class LspServer {
|
|
|
66
72
|
protected applyRenameFile(sourceUri: string, targetUri: string): Promise<void>;
|
|
67
73
|
protected getEditsForFileRename(sourceUri: string, targetUri: string): Promise<ReadonlyArray<tsp.FileCodeEdits>>;
|
|
68
74
|
documentHighlight(arg: lsp.TextDocumentPositionParams): Promise<lsp.DocumentHighlight[]>;
|
|
69
|
-
private rootPath;
|
|
70
75
|
private lastFileOrDummy;
|
|
71
76
|
workspaceSymbol(params: lsp.WorkspaceSymbolParams): Promise<lsp.SymbolInformation[]>;
|
|
72
77
|
/**
|
|
@@ -78,5 +83,6 @@ export declare class LspServer {
|
|
|
78
83
|
protected onTsEvent(event: protocol.Event): void;
|
|
79
84
|
calls(params: lspcalls.CallsParams): Promise<lspcalls.CallsResult>;
|
|
80
85
|
inlayHints(params: lspinlayHints.InlayHintsParams): Promise<lspinlayHints.InlayHintsResult>;
|
|
86
|
+
private getInlayHintsOptions;
|
|
81
87
|
}
|
|
82
88
|
//# sourceMappingURL=lsp-server.d.ts.map
|
package/lib/lsp-server.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lsp-server.d.ts","sourceRoot":"","sources":["../src/lsp-server.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,GAAG,MAAM,4BAA4B,CAAC;AAClD,OAAO,KAAK,QAAQ,MAAM,+BAA+B,CAAC;AAC1D,OAAO,KAAK,aAAa,MAAM,oCAAoC,CAAC;AACpE,OAAO,GAAG,MAAM,yBAAyB,CAAC;AAO1C,OAAO,EAAE,MAAM,EAAmB,MAAM,UAAU,CAAC;AAEnD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AASzC,OAAO,EAAgB,WAAW,EAAE,MAAM,YAAY,CAAC;AAOvD,OAAO,EAAE,0BAA0B,EAAmC,0BAA0B,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"lsp-server.d.ts","sourceRoot":"","sources":["../src/lsp-server.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,GAAG,MAAM,4BAA4B,CAAC;AAClD,OAAO,KAAK,QAAQ,MAAM,+BAA+B,CAAC;AAC1D,OAAO,KAAK,aAAa,MAAM,oCAAoC,CAAC;AACpE,OAAO,GAAG,MAAM,yBAAyB,CAAC;AAO1C,OAAO,EAAE,MAAM,EAAmB,MAAM,UAAU,CAAC;AAEnD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AASzC,OAAO,EAAgB,WAAW,EAAE,MAAM,YAAY,CAAC;AAOvD,OAAO,EAAE,0BAA0B,EAAmC,0BAA0B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AAS,CAAC,SAAS,CAAC,KAAK,EAAE,QAAQ,CAAC,KAAK,GAAG,IAAI;IAY1C,KAAK,CAAC,MAAM,EAAE,QAAQ,CAAC,WAAW,GAAG,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC;IAgBlE,UAAU,CAAC,MAAM,EAAE,aAAa,CAAC,gBAAgB,GAAG,OAAO,CAAC,aAAa,CAAC,gBAAgB,CAAC;IAqDjG,OAAO,CAAC,oBAAoB;CAQ/B"}
|
package/lib/lsp-server.js
CHANGED
|
@@ -61,12 +61,14 @@ const refactor_1 = require("./refactor");
|
|
|
61
61
|
const organize_imports_1 = require("./organize-imports");
|
|
62
62
|
const document_symbol_1 = require("./document-symbol");
|
|
63
63
|
const calls_1 = require("./calls");
|
|
64
|
+
const api_1 = __importDefault(require("./utils/api"));
|
|
64
65
|
class LspServer {
|
|
65
66
|
constructor(options) {
|
|
66
67
|
this.options = options;
|
|
67
68
|
this.documents = new document_1.LspDocuments();
|
|
68
69
|
this.requestDiagnostics = (0, p_debounce_1.default)(() => this.doRequestDiagnostics(), 200);
|
|
69
70
|
this.logger = new logger_1.PrefixingLogger(options.logger, '[lspserver]');
|
|
71
|
+
this.workspaceConfiguration = {};
|
|
70
72
|
}
|
|
71
73
|
closeAll() {
|
|
72
74
|
for (const file of [...this.documents.files]) {
|
|
@@ -78,15 +80,17 @@ class LspServer {
|
|
|
78
80
|
return this.options.tsserverPath;
|
|
79
81
|
}
|
|
80
82
|
const tsServerPath = path.join('typescript', 'lib', 'tsserver.js');
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
83
|
+
if (this.workspaceRoot) {
|
|
84
|
+
// 1) look into .yarn/sdks of workspace root
|
|
85
|
+
const sdk = (0, modules_resolver_1.findPathToYarnSdk)(this.workspaceRoot, tsServerPath);
|
|
86
|
+
if (sdk) {
|
|
87
|
+
return sdk;
|
|
88
|
+
}
|
|
89
|
+
// 2) look into node_modules of workspace root
|
|
90
|
+
const executable = (0, modules_resolver_1.findPathToModule)(this.workspaceRoot, tsServerPath);
|
|
91
|
+
if (executable) {
|
|
92
|
+
return executable;
|
|
93
|
+
}
|
|
90
94
|
}
|
|
91
95
|
// 3) use globally installed tsserver
|
|
92
96
|
if (commandExists.sync((0, utils_1.getTsserverExecutable)())) {
|
|
@@ -99,18 +103,52 @@ class LspServer {
|
|
|
99
103
|
}
|
|
100
104
|
return bundled;
|
|
101
105
|
}
|
|
106
|
+
getTypeScriptVersion(serverPath) {
|
|
107
|
+
if (!fs.existsSync(serverPath)) {
|
|
108
|
+
return undefined;
|
|
109
|
+
}
|
|
110
|
+
const p = serverPath.split(path.sep);
|
|
111
|
+
if (p.length <= 2) {
|
|
112
|
+
return undefined;
|
|
113
|
+
}
|
|
114
|
+
const p2 = p.slice(0, -2);
|
|
115
|
+
const modulePath = p2.join(path.sep);
|
|
116
|
+
let fileName = path.join(modulePath, 'package.json');
|
|
117
|
+
if (!fs.existsSync(fileName)) {
|
|
118
|
+
// Special case for ts dev versions
|
|
119
|
+
if (path.basename(modulePath) === 'built') {
|
|
120
|
+
fileName = path.join(modulePath, '..', 'package.json');
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
if (!fs.existsSync(fileName)) {
|
|
124
|
+
return undefined;
|
|
125
|
+
}
|
|
126
|
+
const contents = fs.readFileSync(fileName).toString();
|
|
127
|
+
let desc = null;
|
|
128
|
+
try {
|
|
129
|
+
desc = JSON.parse(contents);
|
|
130
|
+
}
|
|
131
|
+
catch (err) {
|
|
132
|
+
return undefined;
|
|
133
|
+
}
|
|
134
|
+
if (!desc || !desc.version) {
|
|
135
|
+
return undefined;
|
|
136
|
+
}
|
|
137
|
+
return desc.version ? api_1.default.fromVersionString(desc.version) : undefined;
|
|
138
|
+
}
|
|
102
139
|
initialize(params) {
|
|
103
140
|
var _a;
|
|
104
141
|
return __awaiter(this, void 0, void 0, function* () {
|
|
105
142
|
this.logger.log('initialize', params);
|
|
106
143
|
this.initializeParams = params;
|
|
144
|
+
this.workspaceRoot = this.initializeParams.rootUri ? (0, protocol_translation_1.uriToPath)(this.initializeParams.rootUri) : this.initializeParams.rootPath || undefined;
|
|
107
145
|
this.diagnosticQueue = new diagnostic_queue_1.DiagnosticEventQueue(diagnostics => this.options.lspClient.publishDiagnostics(diagnostics), this.documents, (_a = this.initializeParams.capabilities.textDocument) === null || _a === void 0 ? void 0 : _a.publishDiagnostics, this.logger);
|
|
108
146
|
const userInitializationOptions = this.initializeParams.initializationOptions || {};
|
|
109
|
-
const { hostInfo, maxTsServerMemory } = userInitializationOptions;
|
|
147
|
+
const { disableAutomaticTypingAcquisition, hostInfo, maxTsServerMemory } = userInitializationOptions;
|
|
110
148
|
const { logVerbosity, plugins, preferences } = {
|
|
111
149
|
logVerbosity: userInitializationOptions.logVerbosity || this.options.tsserverLogVerbosity,
|
|
112
150
|
plugins: userInitializationOptions.plugins || [],
|
|
113
|
-
preferences: Object.assign({ includeCompletionsForModuleExports: true, includeCompletionsWithInsertText: true }, userInitializationOptions.preferences)
|
|
151
|
+
preferences: Object.assign({ allowIncompleteCompletions: true, allowRenameOfImportPath: true, allowTextChangesInNewFiles: true, displayPartsForJSDoc: true, generateReturnInDocTemplate: true, includeAutomaticOptionalChainCompletions: true, includeCompletionsForImportStatements: true, includeCompletionsForModuleExports: true, includeCompletionsWithInsertText: true, includeCompletionsWithSnippetText: true }, userInitializationOptions.preferences)
|
|
114
152
|
};
|
|
115
153
|
const logFile = this.getLogFile(logVerbosity);
|
|
116
154
|
const globalPlugins = [];
|
|
@@ -120,10 +158,13 @@ class LspServer {
|
|
|
120
158
|
pluginProbeLocations.push(plugin.location);
|
|
121
159
|
}
|
|
122
160
|
const tsserverPath = this.findTsserverPath();
|
|
161
|
+
const typescriptVersion = this.getTypeScriptVersion(tsserverPath);
|
|
162
|
+
this.logger.info(`Using Typescript version ${typescriptVersion === null || typescriptVersion === void 0 ? void 0 : typescriptVersion.displayName} from path: ${tsserverPath}`);
|
|
123
163
|
this.tspClient = new tsp_client_1.TspClient({
|
|
124
164
|
tsserverPath,
|
|
125
165
|
logFile,
|
|
126
166
|
logVerbosity,
|
|
167
|
+
disableAutomaticTypingAcquisition,
|
|
127
168
|
maxTsServerMemory,
|
|
128
169
|
globalPlugins,
|
|
129
170
|
pluginProbeLocations,
|
|
@@ -131,7 +172,10 @@ class LspServer {
|
|
|
131
172
|
onEvent: this.onTsEvent.bind(this)
|
|
132
173
|
});
|
|
133
174
|
this.tspClient.start();
|
|
134
|
-
this.tspClient.request("configure" /* Configure */, Object.assign(Object.assign({}, hostInfo ? { hostInfo } : {}), {
|
|
175
|
+
this.tspClient.request("configure" /* Configure */, Object.assign(Object.assign({}, hostInfo ? { hostInfo } : {}), { formatOptions: {
|
|
176
|
+
// We can use \n here since the editor should normalize later on to its line endings.
|
|
177
|
+
newLineCharacter: '\n'
|
|
178
|
+
}, preferences }));
|
|
135
179
|
this.tspClient.request("compilerOptionsForInferredProjects" /* CompilerOptionsForInferredProjects */, {
|
|
136
180
|
options: {
|
|
137
181
|
module: "CommonJS" /* CommonJS */,
|
|
@@ -150,7 +194,9 @@ class LspServer {
|
|
|
150
194
|
triggerCharacters: ['.', '"', '\'', '/', '@', '<'],
|
|
151
195
|
resolveProvider: true
|
|
152
196
|
},
|
|
153
|
-
codeActionProvider:
|
|
197
|
+
codeActionProvider: {
|
|
198
|
+
codeActionKinds: [commands_1.CodeActions.SourceOrganizeImportsTsLs]
|
|
199
|
+
},
|
|
154
200
|
definitionProvider: true,
|
|
155
201
|
documentFormattingProvider: true,
|
|
156
202
|
documentRangeFormattingProvider: true,
|
|
@@ -201,14 +247,23 @@ class LspServer {
|
|
|
201
247
|
if (this.options.tsserverLogFile) {
|
|
202
248
|
return this.options.tsserverLogFile;
|
|
203
249
|
}
|
|
204
|
-
if (this.
|
|
205
|
-
return path.join(
|
|
206
|
-
}
|
|
207
|
-
if (this.initializeParams.rootPath) {
|
|
208
|
-
return path.join(this.initializeParams.rootPath, '.log/tsserver.log');
|
|
250
|
+
if (this.workspaceRoot) {
|
|
251
|
+
return path.join(this.workspaceRoot, '.log/tsserver.log');
|
|
209
252
|
}
|
|
210
253
|
return undefined;
|
|
211
254
|
}
|
|
255
|
+
didChangeConfiguration(params) {
|
|
256
|
+
this.workspaceConfiguration = params.settings || {};
|
|
257
|
+
}
|
|
258
|
+
getWorkspacePreferencesForDocument(file) {
|
|
259
|
+
var _a;
|
|
260
|
+
const doc = this.documents.get(file);
|
|
261
|
+
if (!doc) {
|
|
262
|
+
return {};
|
|
263
|
+
}
|
|
264
|
+
const preferencesKey = doc.languageId.startsWith('typescript') ? 'typescript' : 'javascript';
|
|
265
|
+
return (_a = this.workspaceConfiguration[preferencesKey]) !== null && _a !== void 0 ? _a : {};
|
|
266
|
+
}
|
|
212
267
|
interuptDiagnostics(f) {
|
|
213
268
|
if (!this.diagnosticsTokenSource) {
|
|
214
269
|
return f();
|
|
@@ -250,7 +305,7 @@ class LspServer {
|
|
|
250
305
|
file,
|
|
251
306
|
fileContent: params.textDocument.text,
|
|
252
307
|
scriptKindName: this.getScriptKindName(params.textDocument.languageId),
|
|
253
|
-
projectRootPath: this.
|
|
308
|
+
projectRootPath: this.workspaceRoot
|
|
254
309
|
});
|
|
255
310
|
this.requestDiagnostics();
|
|
256
311
|
}
|
|
@@ -478,9 +533,10 @@ class LspServer {
|
|
|
478
533
|
return { contents: [] };
|
|
479
534
|
}
|
|
480
535
|
const range = (0, protocol_translation_1.asRange)(result.body);
|
|
481
|
-
const contents = [
|
|
482
|
-
|
|
483
|
-
|
|
536
|
+
const contents = [];
|
|
537
|
+
if (result.body.displayString) {
|
|
538
|
+
contents.push({ language: 'typescript', value: result.body.displayString });
|
|
539
|
+
}
|
|
484
540
|
const tags = (0, protocol_translation_1.asTagsDocumentation)(result.body.tags);
|
|
485
541
|
const documentation = (0, protocol_translation_1.asPlainText)(result.body.documentation);
|
|
486
542
|
contents.push(documentation + (tags ? '\n\n' + tags : ''));
|
|
@@ -564,23 +620,10 @@ class LspServer {
|
|
|
564
620
|
if (!file) {
|
|
565
621
|
return [];
|
|
566
622
|
}
|
|
567
|
-
|
|
568
|
-
// translate
|
|
569
|
-
if (opts.convertTabsToSpaces === undefined) {
|
|
570
|
-
opts.convertTabsToSpaces = params.options.insertSpaces;
|
|
571
|
-
}
|
|
572
|
-
if (opts.indentSize === undefined) {
|
|
573
|
-
opts.indentSize = params.options.tabSize;
|
|
574
|
-
}
|
|
575
|
-
try {
|
|
576
|
-
opts = JSON.parse(fs.readFileSync(this.rootPath() + '/tsfmt.json', 'utf-8'));
|
|
577
|
-
}
|
|
578
|
-
catch (err) {
|
|
579
|
-
this.logger.log(`No formatting options found ${err}`);
|
|
580
|
-
}
|
|
623
|
+
const formatOptions = this.getFormattingOptions(file, params.options);
|
|
581
624
|
// options are not yet supported in tsserver, but we can send a configure request first
|
|
582
625
|
yield this.tspClient.request("configure" /* Configure */, {
|
|
583
|
-
formatOptions
|
|
626
|
+
formatOptions
|
|
584
627
|
});
|
|
585
628
|
const response = yield this.tspClient.request("format" /* Format */, {
|
|
586
629
|
file,
|
|
@@ -588,7 +631,7 @@ class LspServer {
|
|
|
588
631
|
offset: 1,
|
|
589
632
|
endLine: Number.MAX_SAFE_INTEGER,
|
|
590
633
|
endOffset: Number.MAX_SAFE_INTEGER,
|
|
591
|
-
options:
|
|
634
|
+
options: formatOptions
|
|
592
635
|
});
|
|
593
636
|
if (response.body) {
|
|
594
637
|
return response.body.map(e => (0, protocol_translation_1.toTextEdit)(e));
|
|
@@ -603,23 +646,10 @@ class LspServer {
|
|
|
603
646
|
if (!file) {
|
|
604
647
|
return [];
|
|
605
648
|
}
|
|
606
|
-
|
|
607
|
-
// translate
|
|
608
|
-
if (opts.convertTabsToSpaces === undefined) {
|
|
609
|
-
opts.convertTabsToSpaces = params.options.insertSpaces;
|
|
610
|
-
}
|
|
611
|
-
if (opts.indentSize === undefined) {
|
|
612
|
-
opts.indentSize = params.options.tabSize;
|
|
613
|
-
}
|
|
614
|
-
try {
|
|
615
|
-
opts = JSON.parse(fs.readFileSync(this.rootPath() + '/tsfmt.json', 'utf-8'));
|
|
616
|
-
}
|
|
617
|
-
catch (err) {
|
|
618
|
-
this.logger.log(`No formatting options found ${err}`);
|
|
619
|
-
}
|
|
649
|
+
const formatOptions = this.getFormattingOptions(file, params.options);
|
|
620
650
|
// options are not yet supported in tsserver, but we can send a configure request first
|
|
621
651
|
yield this.tspClient.request("configure" /* Configure */, {
|
|
622
|
-
formatOptions
|
|
652
|
+
formatOptions
|
|
623
653
|
});
|
|
624
654
|
const response = yield this.tspClient.request("format" /* Format */, {
|
|
625
655
|
file,
|
|
@@ -627,7 +657,7 @@ class LspServer {
|
|
|
627
657
|
offset: params.range.start.character + 1,
|
|
628
658
|
endLine: params.range.end.line + 1,
|
|
629
659
|
endOffset: params.range.end.character + 1,
|
|
630
|
-
options:
|
|
660
|
+
options: formatOptions
|
|
631
661
|
});
|
|
632
662
|
if (response.body) {
|
|
633
663
|
return response.body.map(e => (0, protocol_translation_1.toTextEdit)(e));
|
|
@@ -635,6 +665,26 @@ class LspServer {
|
|
|
635
665
|
return [];
|
|
636
666
|
});
|
|
637
667
|
}
|
|
668
|
+
getFormattingOptions(file, requestOptions) {
|
|
669
|
+
const workspacePreference = this.getWorkspacePreferencesForDocument(file);
|
|
670
|
+
let opts = Object.assign(Object.assign({}, (workspacePreference === null || workspacePreference === void 0 ? void 0 : workspacePreference.format) || {}), requestOptions);
|
|
671
|
+
// translate
|
|
672
|
+
if (opts.convertTabsToSpaces === undefined) {
|
|
673
|
+
opts.convertTabsToSpaces = requestOptions.insertSpaces;
|
|
674
|
+
}
|
|
675
|
+
if (opts.indentSize === undefined) {
|
|
676
|
+
opts.indentSize = requestOptions.tabSize;
|
|
677
|
+
}
|
|
678
|
+
if (this.workspaceRoot) {
|
|
679
|
+
try {
|
|
680
|
+
opts = JSON.parse(fs.readFileSync(this.workspaceRoot + '/tsfmt.json', 'utf-8'));
|
|
681
|
+
}
|
|
682
|
+
catch (err) {
|
|
683
|
+
this.logger.log(`No formatting options found ${err}`);
|
|
684
|
+
}
|
|
685
|
+
}
|
|
686
|
+
return opts;
|
|
687
|
+
}
|
|
638
688
|
signatureHelp(params) {
|
|
639
689
|
return __awaiter(this, void 0, void 0, function* () {
|
|
640
690
|
const file = (0, protocol_translation_1.uriToPath)(params.textDocument.uri);
|
|
@@ -664,6 +714,7 @@ class LspServer {
|
|
|
664
714
|
});
|
|
665
715
|
}
|
|
666
716
|
codeAction(params) {
|
|
717
|
+
var _a;
|
|
667
718
|
return __awaiter(this, void 0, void 0, function* () {
|
|
668
719
|
const file = (0, protocol_translation_1.uriToPath)(params.textDocument.uri);
|
|
669
720
|
this.logger.log('codeAction', params, file);
|
|
@@ -680,8 +731,17 @@ class LspServer {
|
|
|
680
731
|
actions.push(...(0, refactor_1.provideRefactors)(yield this.getRefactors(args), args));
|
|
681
732
|
}
|
|
682
733
|
// organize import is provided by tsserver for any line, so we only get it if explicitly requested
|
|
683
|
-
if (params.context.only
|
|
684
|
-
|
|
734
|
+
if ((_a = params.context.only) === null || _a === void 0 ? void 0 : _a.includes(commands_1.CodeActions.SourceOrganizeImportsTsLs)) {
|
|
735
|
+
// see this issue for more context about how this argument is used
|
|
736
|
+
// https://github.com/microsoft/TypeScript/issues/43051
|
|
737
|
+
const skipDestructiveCodeActions = params.context.diagnostics.some(
|
|
738
|
+
// assume no severity is an error
|
|
739
|
+
d => { var _a; return ((_a = d.severity) !== null && _a !== void 0 ? _a : 0) <= 2; });
|
|
740
|
+
const response = yield this.getOrganizeImports({
|
|
741
|
+
scope: { type: 'file', args },
|
|
742
|
+
skipDestructiveCodeActions
|
|
743
|
+
});
|
|
744
|
+
actions.push(...(0, organize_imports_1.provideOrganizeImports)(response, this.documents));
|
|
685
745
|
}
|
|
686
746
|
return actions;
|
|
687
747
|
});
|
|
@@ -760,11 +820,13 @@ class LspServer {
|
|
|
760
820
|
}
|
|
761
821
|
else if (arg.command === commands_1.Commands.ORGANIZE_IMPORTS && arg.arguments) {
|
|
762
822
|
const file = arg.arguments[0];
|
|
823
|
+
const additionalArguments = arg.arguments[1] || {};
|
|
763
824
|
const { body } = yield this.tspClient.request("organizeImports" /* OrganizeImports */, {
|
|
764
825
|
scope: {
|
|
765
826
|
type: 'file',
|
|
766
827
|
args: { file }
|
|
767
|
-
}
|
|
828
|
+
},
|
|
829
|
+
skipDestructiveCodeActions: additionalArguments.skipDestructiveCodeActions
|
|
768
830
|
});
|
|
769
831
|
yield this.applyFileCodeEdits(body);
|
|
770
832
|
}
|
|
@@ -772,6 +834,19 @@ class LspServer {
|
|
|
772
834
|
const { sourceUri, targetUri } = arg.arguments[0];
|
|
773
835
|
this.applyRenameFile(sourceUri, targetUri);
|
|
774
836
|
}
|
|
837
|
+
else if (arg.command === commands_1.Commands.APPLY_COMPLETION_CODE_ACTION && arg.arguments) {
|
|
838
|
+
const [_, codeActions] = arg.arguments;
|
|
839
|
+
for (const codeAction of codeActions) {
|
|
840
|
+
yield this.applyFileCodeEdits(codeAction.changes);
|
|
841
|
+
if (codeAction.commands && codeAction.commands.length) {
|
|
842
|
+
for (const command of codeAction.commands) {
|
|
843
|
+
yield this.tspClient.request("applyCodeActionCommand" /* ApplyCodeActionCommand */, { command });
|
|
844
|
+
}
|
|
845
|
+
}
|
|
846
|
+
// Execute only the first code action.
|
|
847
|
+
break;
|
|
848
|
+
}
|
|
849
|
+
}
|
|
775
850
|
else {
|
|
776
851
|
this.logger.error(`Unknown command ${arg.command}.`);
|
|
777
852
|
}
|
|
@@ -843,7 +918,7 @@ class LspServer {
|
|
|
843
918
|
for (const item of response.body) {
|
|
844
919
|
// tsp returns item.file with POSIX path delimiters, whereas file is platform specific.
|
|
845
920
|
// Converting to a URI and back to a path ensures consistency.
|
|
846
|
-
if ((0, protocol_translation_1.
|
|
921
|
+
if ((0, protocol_translation_1.normalizePath)(item.file) === file) {
|
|
847
922
|
const highlights = (0, protocol_translation_1.toDocumentHighlight)(item);
|
|
848
923
|
result.push(...highlights);
|
|
849
924
|
}
|
|
@@ -851,11 +926,8 @@ class LspServer {
|
|
|
851
926
|
return result;
|
|
852
927
|
});
|
|
853
928
|
}
|
|
854
|
-
rootPath() {
|
|
855
|
-
return this.initializeParams.rootUri ? (0, protocol_translation_1.uriToPath)(this.initializeParams.rootUri) : this.initializeParams.rootPath;
|
|
856
|
-
}
|
|
857
929
|
lastFileOrDummy() {
|
|
858
|
-
return this.documents.files[0] || this.
|
|
930
|
+
return this.documents.files[0] || this.workspaceRoot;
|
|
859
931
|
}
|
|
860
932
|
workspaceSymbol(params) {
|
|
861
933
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -976,6 +1048,10 @@ class LspServer {
|
|
|
976
1048
|
if (!file) {
|
|
977
1049
|
return { inlayHints: [] };
|
|
978
1050
|
}
|
|
1051
|
+
const inlayHintsOptions = this.getInlayHintsOptions(file);
|
|
1052
|
+
this.tspClient.request("configure" /* Configure */, {
|
|
1053
|
+
preferences: inlayHintsOptions
|
|
1054
|
+
});
|
|
979
1055
|
const doc = this.documents.get(file);
|
|
980
1056
|
if (!doc) {
|
|
981
1057
|
return { inlayHints: [] };
|
|
@@ -1011,6 +1087,12 @@ class LspServer {
|
|
|
1011
1087
|
}
|
|
1012
1088
|
});
|
|
1013
1089
|
}
|
|
1090
|
+
getInlayHintsOptions(file) {
|
|
1091
|
+
var _a, _b;
|
|
1092
|
+
const workspacePreference = this.getWorkspacePreferencesForDocument(file);
|
|
1093
|
+
const userPreferences = ((_a = this.initializeParams.initializationOptions) === null || _a === void 0 ? void 0 : _a.preferences) || {};
|
|
1094
|
+
return Object.assign(Object.assign({}, userPreferences), (_b = workspacePreference.inlayHints) !== null && _b !== void 0 ? _b : {});
|
|
1095
|
+
}
|
|
1014
1096
|
}
|
|
1015
1097
|
exports.LspServer = LspServer;
|
|
1016
1098
|
//# sourceMappingURL=lsp-server.js.map
|