typescript-language-server 1.1.2 → 2.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.
Files changed (110) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/LICENSE +39 -0
  3. package/README.md +43 -2
  4. package/lib/cli.js +6 -6
  5. package/lib/cli.js.map +1 -1
  6. package/lib/completion.d.ts +1 -2
  7. package/lib/completion.d.ts.map +1 -1
  8. package/lib/completion.js +38 -19
  9. package/lib/completion.js.map +1 -1
  10. package/lib/configuration-manager.d.ts +3 -10
  11. package/lib/configuration-manager.d.ts.map +1 -1
  12. package/lib/configuration-manager.js +24 -4
  13. package/lib/configuration-manager.js.map +1 -1
  14. package/lib/diagnostic-queue.d.ts +1 -1
  15. package/lib/diagnostic-queue.d.ts.map +1 -1
  16. package/lib/features/inlay-hints.js +2 -2
  17. package/lib/features/inlay-hints.js.map +1 -1
  18. package/lib/lsp-connection.d.ts +5 -5
  19. package/lib/lsp-connection.d.ts.map +1 -1
  20. package/lib/lsp-connection.js +2 -3
  21. package/lib/lsp-connection.js.map +1 -1
  22. package/lib/lsp-server.d.ts +7 -10
  23. package/lib/lsp-server.d.ts.map +1 -1
  24. package/lib/lsp-server.js +61 -115
  25. package/lib/lsp-server.js.map +1 -1
  26. package/lib/lsp-server.spec.js +382 -81
  27. package/lib/lsp-server.spec.js.map +1 -1
  28. package/lib/refactor.d.ts +2 -1
  29. package/lib/refactor.d.ts.map +1 -1
  30. package/lib/refactor.js +17 -7
  31. package/lib/refactor.js.map +1 -1
  32. package/lib/test-utils.d.ts +18 -0
  33. package/lib/test-utils.d.ts.map +1 -1
  34. package/lib/test-utils.js +24 -12
  35. package/lib/test-utils.js.map +1 -1
  36. package/lib/ts-protocol.d.ts +30 -8
  37. package/lib/ts-protocol.d.ts.map +1 -1
  38. package/lib/ts-protocol.js +7 -1
  39. package/lib/ts-protocol.js.map +1 -1
  40. package/lib/tsServer/callbackMap.d.ts +17 -0
  41. package/lib/tsServer/callbackMap.d.ts.map +1 -0
  42. package/lib/tsServer/callbackMap.js +47 -0
  43. package/lib/tsServer/callbackMap.js.map +1 -0
  44. package/lib/tsServer/cancellation.d.ts +22 -0
  45. package/lib/tsServer/cancellation.d.ts.map +1 -0
  46. package/lib/tsServer/cancellation.js +51 -0
  47. package/lib/tsServer/cancellation.js.map +1 -0
  48. package/lib/tsServer/logDirectoryProvider.d.ts +13 -0
  49. package/lib/tsServer/logDirectoryProvider.d.ts.map +1 -0
  50. package/lib/tsServer/logDirectoryProvider.js +49 -0
  51. package/lib/tsServer/logDirectoryProvider.js.map +1 -0
  52. package/lib/tsServer/requestQueue.d.ts +34 -0
  53. package/lib/tsServer/requestQueue.d.ts.map +1 -0
  54. package/lib/tsServer/requestQueue.js +74 -0
  55. package/lib/tsServer/requestQueue.js.map +1 -0
  56. package/lib/tsServer/requests.d.ts +68 -0
  57. package/lib/tsServer/requests.d.ts.map +1 -0
  58. package/lib/tsServer/requests.js +28 -0
  59. package/lib/tsServer/requests.js.map +1 -0
  60. package/lib/tsServer/server.d.ts +95 -0
  61. package/lib/tsServer/server.d.ts.map +1 -0
  62. package/lib/tsServer/server.js +209 -0
  63. package/lib/tsServer/server.js.map +1 -0
  64. package/lib/tsServer/serverError.d.ts +18 -0
  65. package/lib/tsServer/serverError.d.ts.map +1 -0
  66. package/lib/tsServer/serverError.js +53 -0
  67. package/lib/tsServer/serverError.js.map +1 -0
  68. package/lib/tsServer/serverProcess.d.ts +7 -0
  69. package/lib/tsServer/serverProcess.d.ts.map +1 -0
  70. package/lib/tsServer/serverProcess.js +238 -0
  71. package/lib/tsServer/serverProcess.js.map +1 -0
  72. package/lib/tsServer/spawner.d.ts +19 -0
  73. package/lib/tsServer/spawner.d.ts.map +1 -0
  74. package/lib/tsServer/spawner.js +130 -0
  75. package/lib/tsServer/spawner.js.map +1 -0
  76. package/lib/tsServer/tracer.d.ts +26 -0
  77. package/lib/tsServer/tracer.d.ts.map +1 -0
  78. package/lib/tsServer/tracer.js +80 -0
  79. package/lib/tsServer/tracer.js.map +1 -0
  80. package/lib/{utils → tsServer}/versionProvider.d.ts +8 -8
  81. package/lib/tsServer/versionProvider.d.ts.map +1 -0
  82. package/lib/{utils → tsServer}/versionProvider.js +28 -22
  83. package/lib/tsServer/versionProvider.js.map +1 -0
  84. package/lib/tsp-client.d.ts +25 -55
  85. package/lib/tsp-client.d.ts.map +1 -1
  86. package/lib/tsp-client.js +186 -140
  87. package/lib/tsp-client.js.map +1 -1
  88. package/lib/tsp-client.spec.js +23 -8
  89. package/lib/tsp-client.spec.js.map +1 -1
  90. package/lib/utils/api.d.ts +1 -0
  91. package/lib/utils/api.d.ts.map +1 -1
  92. package/lib/utils/api.js +1 -0
  93. package/lib/utils/api.js.map +1 -1
  94. package/lib/utils/configuration.d.ts +17 -8
  95. package/lib/utils/configuration.d.ts.map +1 -1
  96. package/lib/utils/configuration.js +43 -1
  97. package/lib/utils/configuration.js.map +1 -1
  98. package/lib/utils/logger.d.ts +65 -0
  99. package/lib/utils/logger.d.ts.map +1 -0
  100. package/lib/utils/logger.js +189 -0
  101. package/lib/utils/logger.js.map +1 -0
  102. package/lib/utils/modules-resolver.spec.js +1 -1
  103. package/lib/utils/modules-resolver.spec.js.map +1 -1
  104. package/package.json +12 -12
  105. package/lib/logger.d.ts +0 -48
  106. package/lib/logger.d.ts.map +0 -1
  107. package/lib/logger.js +0 -106
  108. package/lib/logger.js.map +0 -1
  109. package/lib/utils/versionProvider.d.ts.map +0 -1
  110. package/lib/utils/versionProvider.js.map +0 -1
@@ -1,9 +1,9 @@
1
- import * as lsp from 'vscode-languageserver/node.js';
2
- export interface IServerOptions {
1
+ import lsp from 'vscode-languageserver/node.js';
2
+ import type { TsServerLogLevel } from './utils/configuration.js';
3
+ export interface LspConnectionOptions {
3
4
  tsserverPath: string;
4
- tsserverLogFile?: string;
5
- tsserverLogVerbosity?: string;
5
+ tsserverLogVerbosity: TsServerLogLevel;
6
6
  showMessageLevel: lsp.MessageType;
7
7
  }
8
- export declare function createLspConnection(options: IServerOptions): lsp.Connection;
8
+ export declare function createLspConnection(options: LspConnectionOptions): lsp.Connection;
9
9
  //# sourceMappingURL=lsp-connection.d.ts.map
@@ -1 +1 @@
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"}
1
+ {"version":3,"file":"lsp-connection.d.ts","sourceRoot":"","sources":["../src/lsp-connection.ts"],"names":[],"mappings":"AAOA,OAAO,GAAG,MAAM,+BAA+B,CAAC;AAMhD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAEjE,MAAM,WAAW,oBAAoB;IACjC,YAAY,EAAE,MAAM,CAAC;IACrB,oBAAoB,EAAE,gBAAgB,CAAC;IACvC,gBAAgB,EAAE,GAAG,CAAC,WAAW,CAAC;CACrC;AAED,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,oBAAoB,GAAG,GAAG,CAAC,UAAU,CA+CjF"}
@@ -4,10 +4,10 @@
4
4
  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
5
5
  * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
6
6
  */
7
- import * as lsp from 'vscode-languageserver/node.js';
7
+ import lsp from 'vscode-languageserver/node.js';
8
8
  import * as lspcalls from './lsp-protocol.calls.proposed.js';
9
9
  import * as lspinlayHints from './lsp-protocol.inlayHints.proposed.js';
10
- import { LspClientLogger } from './logger.js';
10
+ import { LspClientLogger } from './utils/logger.js';
11
11
  import { LspServer } from './lsp-server.js';
12
12
  import { LspClientImpl } from './lsp-client.js';
13
13
  export function createLspConnection(options) {
@@ -18,7 +18,6 @@ export function createLspConnection(options) {
18
18
  logger,
19
19
  lspClient,
20
20
  tsserverPath: options.tsserverPath,
21
- tsserverLogFile: options.tsserverLogFile,
22
21
  tsserverLogVerbosity: options.tsserverLogVerbosity,
23
22
  });
24
23
  connection.onInitialize(server.initialize.bind(server));
@@ -1 +1 @@
1
- {"version":3,"file":"lsp-connection.js","sourceRoot":"","sources":["../src/lsp-connection.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,GAAG,MAAM,+BAA+B,CAAC;AACrD,OAAO,KAAK,QAAQ,MAAM,kCAAkC,CAAC;AAC7D,OAAO,KAAK,aAAa,MAAM,uCAAuC,CAAC;AACvE,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAShD,MAAM,UAAU,mBAAmB,CAAC,OAAuB;IACvD,MAAM,UAAU,GAAG,GAAG,CAAC,gBAAgB,CAAC,GAAG,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC;IAClE,MAAM,SAAS,GAAG,IAAI,aAAa,CAAC,UAAU,CAAC,CAAC;IAChD,MAAM,MAAM,GAAG,IAAI,eAAe,CAAC,SAAS,EAAE,OAAO,CAAC,gBAAgB,CAAC,CAAC;IACxE,MAAM,MAAM,GAAc,IAAI,SAAS,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,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AE,MAAM,CAAC,kBAAkB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;IAC7F,UAAU,CAAC,SAAS,CAAC,GAAG,CAAC,0BAA0B,CAAC,IAAI,EAAE,MAAM,CAAC,mBAAmB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;IAEnG,OAAO,UAAU,CAAC;AACtB,CAAC"}
@@ -3,12 +3,11 @@ import * as lspcalls from './lsp-protocol.calls.proposed.js';
3
3
  import * as lspinlayHints from './lsp-protocol.inlayHints.proposed.js';
4
4
  import tsp from 'typescript/lib/protocol.d.js';
5
5
  import { LspDocument } from './document.js';
6
- import { TypeScriptInitializeParams, TypeScriptInitializeResult } from './ts-protocol.js';
7
- import { IServerOptions } from './utils/configuration.js';
6
+ import { TypeScriptInitializeParams } from './ts-protocol.js';
7
+ import { TypeScriptServiceConfiguration } from './utils/configuration.js';
8
8
  export declare class LspServer {
9
9
  private options;
10
10
  private _tspClient;
11
- private _loadingIndicator;
12
11
  private initializeParams;
13
12
  private diagnosticQueue?;
14
13
  private configurationManager;
@@ -17,15 +16,13 @@ export declare class LspServer {
17
16
  private typeScriptAutoFixProvider;
18
17
  private features;
19
18
  private readonly documents;
20
- constructor(options: IServerOptions);
19
+ constructor(options: TypeScriptServiceConfiguration);
21
20
  closeAll(): void;
22
21
  shutdown(): void;
23
22
  private get tspClient();
24
- private get loadingIndicator();
25
23
  private findTypescriptVersion;
26
- initialize(params: TypeScriptInitializeParams): Promise<TypeScriptInitializeResult>;
27
- protected getLogFile(logVerbosity: string | undefined): string | undefined;
28
- protected doGetLogFile(): string | undefined;
24
+ initialize(params: TypeScriptInitializeParams): Promise<lsp.InitializeResult>;
25
+ private getLogDirectoryPath;
29
26
  didChangeConfiguration(params: lsp.DidChangeConfigurationParams): void;
30
27
  protected diagnosticsTokenSource: lsp.CancellationTokenSource | undefined;
31
28
  protected interuptDiagnostics<R>(f: () => R): R;
@@ -58,8 +55,8 @@ export declare class LspServer {
58
55
  signatureHelp(params: lsp.SignatureHelpParams): Promise<lsp.SignatureHelp | undefined>;
59
56
  protected getSignatureHelp(file: string, params: lsp.SignatureHelpParams): Promise<tsp.SignatureHelpResponse | undefined>;
60
57
  codeAction(params: lsp.CodeActionParams): Promise<lsp.CodeAction[]>;
61
- protected getCodeFixes(args: tsp.CodeFixRequestArgs): Promise<tsp.GetCodeFixesResponse | undefined>;
62
- protected getRefactors(args: tsp.GetApplicableRefactorsRequestArgs): Promise<tsp.GetApplicableRefactorsResponse | undefined>;
58
+ protected getCodeFixes(fileRangeArgs: tsp.FileRangeRequestArgs, context: lsp.CodeActionContext): Promise<tsp.GetCodeFixesResponse | undefined>;
59
+ protected getRefactors(fileRangeArgs: tsp.FileRangeRequestArgs, context: lsp.CodeActionContext): Promise<tsp.GetApplicableRefactorsResponse | undefined>;
63
60
  protected getOrganizeImports(args: tsp.OrganizeImportsRequestArgs): Promise<tsp.OrganizeImportsResponse | undefined>;
64
61
  executeCommand(arg: lsp.ExecuteCommandParams, token?: lsp.CancellationToken, workDoneProgress?: lsp.WorkDoneProgressReporter): Promise<any>;
65
62
  protected applyFileCodeEdits(edits: ReadonlyArray<tsp.FileCodeEdits>): Promise<boolean>;
@@ -1 +1 @@
1
- {"version":3,"file":"lsp-server.d.ts","sourceRoot":"","sources":["../src/lsp-server.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,GAAG,MAAM,uBAAuB,CAAC;AAC7C,OAAO,KAAK,QAAQ,MAAM,kCAAkC,CAAC;AAC7D,OAAO,KAAK,aAAa,MAAM,uCAAuC,CAAC;AAEvE,OAAO,GAAG,MAAM,8BAA8B,CAAC;AAO/C,OAAO,EAAgB,WAAW,EAAE,MAAM,eAAe,CAAC;AAO1D,OAAO,EAAE,0BAA0B,EAAmC,0BAA0B,EAAqB,MAAM,kBAAkB,CAAC;AAG9I,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AA+C1D,qBAAa,SAAS;IAaN,OAAO,CAAC,OAAO;IA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O,CAAC,GAAG,CAAC,cAAc,CAAC;IAkBvF,iBAAiB,CAAC,GAAG,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAI,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC;CAkBhI"}
package/lib/lsp-server.js CHANGED
@@ -7,12 +7,11 @@
7
7
  import * as path from 'node:path';
8
8
  import fs from 'fs-extra';
9
9
  import debounce from 'p-debounce';
10
- import { temporaryFile } from 'tempy';
11
10
  import * as lsp from 'vscode-languageserver';
12
11
  import * as lspcalls from './lsp-protocol.calls.proposed.js';
13
12
  import * as lspsemanticTokens from './semantic-tokens.js';
14
13
  import API from './utils/api.js';
15
- import { PrefixingLogger } from './logger.js';
14
+ import { LogLevel, PrefixingLogger } from './utils/logger.js';
16
15
  import { TspClient } from './tsp-client.js';
17
16
  import { DiagnosticEventQueue } from './diagnostic-queue.js';
18
17
  import { toDocumentHighlight, asTagsDocumentation, uriToPath, toSymbolKind, toLocation, pathToUri, toTextEdit, asPlainText, normalizePath } from './protocol-translation.js';
@@ -25,49 +24,19 @@ import { provideRefactors } from './refactor.js';
25
24
  import { provideOrganizeImports } from './organize-imports.js';
26
25
  import { collectDocumentSymbols, collectSymbolInformation } from './document-symbol.js';
27
26
  import { computeCallers, computeCallees } from './calls.js';
28
- import { TypeScriptVersionProvider } from './utils/versionProvider.js';
29
27
  import { TypeScriptAutoFixProvider } from './features/fix-all.js';
30
28
  import { TypeScriptInlayHintsProvider } from './features/inlay-hints.js';
31
29
  import { SourceDefinitionCommand } from './features/source-definition.js';
30
+ import { LogDirectoryProvider } from './tsServer/logDirectoryProvider.js';
31
+ import { Trace } from './tsServer/tracer.js';
32
+ import { TypeScriptVersionProvider } from './tsServer/versionProvider.js';
32
33
  import { Position, Range } from './utils/typeConverters.js';
33
34
  import { CodeActionKind } from './utils/types.js';
34
35
  import { ConfigurationManager } from './configuration-manager.js';
35
- class ServerInitializingIndicator {
36
- constructor(lspClient) {
37
- this.lspClient = lspClient;
38
- }
39
- reset() {
40
- if (this._loadingProjectName) {
41
- this._loadingProjectName = undefined;
42
- if (this._progressReporter) {
43
- this._progressReporter.done();
44
- this._progressReporter = undefined;
45
- }
46
- }
47
- }
48
- async startedLoadingProject(projectName) {
49
- // TS projects are loaded sequentially. Cancel existing task because it should always be resolved before
50
- // the incoming project loading task is.
51
- this.reset();
52
- this._loadingProjectName = projectName;
53
- this._progressReporter = await this.lspClient.createProgressReporter();
54
- this._progressReporter.begin('Initializing JS/TS language features…');
55
- }
56
- finishedLoadingProject(projectName) {
57
- if (this._loadingProjectName === projectName) {
58
- this._loadingProjectName = undefined;
59
- if (this._progressReporter) {
60
- this._progressReporter.done();
61
- this._progressReporter = undefined;
62
- }
63
- }
64
- }
65
- }
66
36
  export class LspServer {
67
37
  constructor(options) {
68
38
  this.options = options;
69
39
  this._tspClient = null;
70
- this._loadingIndicator = null;
71
40
  this.initializeParams = null;
72
41
  this.typeScriptAutoFixProvider = null;
73
42
  this.features = {};
@@ -89,10 +58,6 @@ export class LspServer {
89
58
  this._tspClient.shutdown();
90
59
  this._tspClient = null;
91
60
  }
92
- if (this._loadingIndicator) {
93
- this._loadingIndicator.reset();
94
- this._loadingIndicator = null;
95
- }
96
61
  }
97
62
  get tspClient() {
98
63
  if (!this._tspClient) {
@@ -100,12 +65,6 @@ export class LspServer {
100
65
  }
101
66
  return this._tspClient;
102
67
  }
103
- get loadingIndicator() {
104
- if (!this._loadingIndicator) {
105
- throw new Error('Loading indicator not created. Did you forget to send the "initialize" request?');
106
- }
107
- return this._loadingIndicator;
108
- }
109
68
  findTypescriptVersion() {
110
69
  const typescriptVersionProvider = new TypeScriptVersionProvider(this.options, this.logger);
111
70
  // User-provided tsserver path.
@@ -114,7 +73,7 @@ export class LspServer {
114
73
  if (userSettingVersion.isValid) {
115
74
  return userSettingVersion;
116
75
  }
117
- this.logger.warn(`Typescript specified through --tsserver-path ignored due to invalid path "${userSettingVersion.path}"`);
76
+ this.logger.logIgnoringVerbosity(LogLevel.Warning, `Typescript specified through --tsserver-path ignored due to invalid path "${userSettingVersion.path}"`);
118
77
  }
119
78
  // Workspace version.
120
79
  if (this.workspaceRoot) {
@@ -137,15 +96,12 @@ export class LspServer {
137
96
  }
138
97
  this.initializeParams = params;
139
98
  const clientCapabilities = this.initializeParams.capabilities;
140
- this._loadingIndicator = new ServerInitializingIndicator(this.options.lspClient);
141
99
  this.workspaceRoot = this.initializeParams.rootUri ? uriToPath(this.initializeParams.rootUri) : this.initializeParams.rootPath || undefined;
142
100
  const userInitializationOptions = this.initializeParams.initializationOptions || {};
143
- const { disableAutomaticTypingAcquisition, hostInfo, maxTsServerMemory, npmLocation, locale } = userInitializationOptions;
144
- const { logVerbosity, plugins } = {
145
- logVerbosity: userInitializationOptions.logVerbosity || this.options.tsserverLogVerbosity,
101
+ const { disableAutomaticTypingAcquisition, hostInfo, maxTsServerMemory, npmLocation, locale, tsserver } = userInitializationOptions;
102
+ const { plugins } = {
146
103
  plugins: userInitializationOptions.plugins || [],
147
104
  };
148
- const logFile = this.getLogFile(logVerbosity);
149
105
  const globalPlugins = [];
150
106
  const pluginProbeLocations = [];
151
107
  for (const plugin of plugins) {
@@ -154,7 +110,7 @@ export class LspServer {
154
110
  }
155
111
  const typescriptVersion = this.findTypescriptVersion();
156
112
  if (typescriptVersion) {
157
- this.logger.info(`Using Typescript version (${typescriptVersion.source}) ${typescriptVersion.versionString} from path "${typescriptVersion.tsServerPath}"`);
113
+ this.logger.logIgnoringVerbosity(LogLevel.Info, `Using Typescript version (${typescriptVersion.source}) ${typescriptVersion.versionString} from path "${typescriptVersion.tsServerPath}"`);
158
114
  }
159
115
  else {
160
116
  throw Error('Could not find a valid TypeScript installation. Please ensure that the "typescript" dependency is installed in the workspace or that a valid --tsserver-path is specified. Exiting.');
@@ -162,19 +118,23 @@ export class LspServer {
162
118
  this.configurationManager.mergeTsPreferences(userInitializationOptions.preferences || {});
163
119
  // Setup supported features.
164
120
  const { textDocument } = clientCapabilities;
165
- this.features.definitionLinkSupport = textDocument?.definition?.linkSupport && typescriptVersion.version?.gte(API.v270);
166
- const completionCapabilities = textDocument?.completion;
167
- if (completionCapabilities?.completionItem) {
168
- if (this.configurationManager.tsPreferences.useLabelDetailsInCompletionEntries
169
- && completionCapabilities.completionItem.labelDetailsSupport
170
- && typescriptVersion.version?.gte(API.v470)) {
171
- this.features.completionLabelDetails = true;
172
- }
173
- if (completionCapabilities.completionItem.snippetSupport) {
174
- this.features.completionSnippets = true;
175
- }
176
- if (textDocument?.publishDiagnostics?.tagSupport) {
177
- this.features.diagnosticsTagSupport = true;
121
+ if (textDocument) {
122
+ const completionCapabilities = textDocument.completion;
123
+ this.features.codeActionDisabledSupport = textDocument.codeAction?.disabledSupport;
124
+ this.features.definitionLinkSupport = textDocument.definition?.linkSupport && typescriptVersion.version?.gte(API.v270);
125
+ this.features.completionInsertReplaceSupport = completionCapabilities?.completionItem?.insertReplaceSupport;
126
+ if (completionCapabilities?.completionItem) {
127
+ if (this.configurationManager.tsPreferences.useLabelDetailsInCompletionEntries
128
+ && completionCapabilities.completionItem.labelDetailsSupport
129
+ && typescriptVersion.version?.gte(API.v470)) {
130
+ this.features.completionLabelDetails = true;
131
+ }
132
+ if (completionCapabilities.completionItem.snippetSupport) {
133
+ this.features.completionSnippets = true;
134
+ }
135
+ if (textDocument.publishDiagnostics?.tagSupport) {
136
+ this.features.diagnosticsTagSupport = true;
137
+ }
178
138
  }
179
139
  }
180
140
  this.configurationManager.mergeTsPreferences({
@@ -182,10 +142,11 @@ export class LspServer {
182
142
  });
183
143
  this.diagnosticQueue = new DiagnosticEventQueue(diagnostics => this.options.lspClient.publishDiagnostics(diagnostics), this.documents, this.features, this.logger);
184
144
  this._tspClient = new TspClient({
185
- apiVersion: typescriptVersion.version || API.defaultVersion,
186
- tsserverPath: typescriptVersion.tsServerPath,
187
- logFile,
188
- logVerbosity,
145
+ lspClient: this.options.lspClient,
146
+ trace: Trace.fromString(tsserver?.trace || 'off'),
147
+ typescriptVersion,
148
+ logDirectoryProvider: new LogDirectoryProvider(this.getLogDirectoryPath(userInitializationOptions)),
149
+ logVerbosity: this.options.tsserverLogVerbosity,
189
150
  disableAutomaticTypingAcquisition,
190
151
  maxTsServerMemory,
191
152
  npmLocation,
@@ -213,7 +174,7 @@ export class LspServer {
213
174
  });
214
175
  this.typeScriptAutoFixProvider = new TypeScriptAutoFixProvider(this.tspClient);
215
176
  await Promise.all([
216
- this.configurationManager.setAndConfigureTspClient(this._tspClient, hostInfo),
177
+ this.configurationManager.setAndConfigureTspClient(this.workspaceRoot, this._tspClient, hostInfo),
217
178
  this.tspClient.request("compilerOptionsForInferredProjects" /* CommandTypes.CompilerOptionsForInferredProjects */, {
218
179
  options: {
219
180
  module: "CommonJS" /* tsp.ModuleKind.CommonJS */,
@@ -225,7 +186,6 @@ export class LspServer {
225
186
  },
226
187
  }),
227
188
  ]);
228
- const logFileUri = logFile && pathToUri(logFile, undefined);
229
189
  const initializeResult = {
230
190
  capabilities: {
231
191
  textDocumentSync: lsp.TextDocumentSyncKind.Incremental,
@@ -299,32 +259,17 @@ export class LspServer {
299
259
  range: true,
300
260
  },
301
261
  },
302
- logFileUri,
303
262
  };
304
263
  initializeResult.capabilities.callsProvider = true;
305
264
  this.logger.log('onInitialize result', initializeResult);
306
265
  return initializeResult;
307
266
  }
308
- getLogFile(logVerbosity) {
309
- if (logVerbosity === undefined || logVerbosity === 'off') {
310
- return undefined;
311
- }
312
- const logFile = this.doGetLogFile();
313
- if (logFile) {
314
- fs.ensureFileSync(logFile);
315
- return logFile;
316
- }
317
- return temporaryFile({ name: 'tsserver.log' });
318
- }
319
- doGetLogFile() {
320
- if (process.env.TSSERVER_LOG_FILE) {
321
- return process.env.TSSERVER_LOG_FILE;
322
- }
323
- if (this.options.tsserverLogFile) {
324
- return this.options.tsserverLogFile;
267
+ getLogDirectoryPath(initializationOptions) {
268
+ if (initializationOptions.tsserver?.logDirectory) {
269
+ return initializationOptions.tsserver.logDirectory;
325
270
  }
326
271
  if (this.workspaceRoot) {
327
- return path.join(this.workspaceRoot, '.log/tsserver.log');
272
+ return path.join(this.workspaceRoot, '.log');
328
273
  }
329
274
  return undefined;
330
275
  }
@@ -352,7 +297,7 @@ export class LspServer {
352
297
  this.diagnosticsTokenSource = geterrTokenSource;
353
298
  const { files } = this.documents;
354
299
  try {
355
- return await this.tspClient.request("geterr" /* CommandTypes.Geterr */, { delay: 0, files }, this.diagnosticsTokenSource.token);
300
+ return await this.tspClient.requestGeterr({ delay: 0, files }, this.diagnosticsTokenSource.token);
356
301
  }
357
302
  finally {
358
303
  if (this.diagnosticsTokenSource === geterrTokenSource) {
@@ -577,6 +522,7 @@ export class LspServer {
577
522
  if (!document) {
578
523
  throw new Error('The document should be opened for completion, file: ' + file);
579
524
  }
525
+ const completionOptions = this.configurationManager.workspaceConfiguration.completions || {};
580
526
  try {
581
527
  const result = await this.interuptDiagnostics(() => this.tspClient.request("completionInfo" /* CommandTypes.CompletionInfo */, {
582
528
  file,
@@ -586,18 +532,22 @@ export class LspServer {
586
532
  triggerKind: params.context?.triggerKind,
587
533
  }));
588
534
  const { body } = result;
535
+ if (!body) {
536
+ return lsp.CompletionList.create();
537
+ }
538
+ const { entries, isIncomplete, optionalReplacementSpan } = body;
589
539
  const completions = [];
590
- for (const entry of body?.entries ?? []) {
540
+ for (const entry of entries || []) {
591
541
  if (entry.kind === 'warning') {
592
542
  continue;
593
543
  }
594
- const completion = asCompletionItem(entry, file, params.position, document, this.features);
544
+ const completion = asCompletionItem(entry, optionalReplacementSpan, file, params.position, document, completionOptions, this.features);
595
545
  if (!completion) {
596
546
  continue;
597
547
  }
598
548
  completions.push(completion);
599
549
  }
600
- return lsp.CompletionList.create(completions, body?.isIncomplete);
550
+ return lsp.CompletionList.create(completions, isIncomplete);
601
551
  }
602
552
  catch (error) {
603
553
  if (error.message === 'No content available.') {
@@ -780,15 +730,14 @@ export class LspServer {
780
730
  if (!file) {
781
731
  return [];
782
732
  }
783
- const args = Range.toFileRangeRequestArgs(file, params.range);
733
+ const fileRangeArgs = Range.toFileRangeRequestArgs(file, params.range);
784
734
  const actions = [];
785
735
  const kinds = params.context.only?.map(kind => new CodeActionKind(kind));
786
736
  if (!kinds || kinds.some(kind => kind.contains(CodeActionKind.QuickFix))) {
787
- const errorCodes = params.context.diagnostics.map(diagnostic => Number(diagnostic.code));
788
- actions.push(...provideQuickFix(await this.getCodeFixes({ ...args, errorCodes }), this.documents));
737
+ actions.push(...provideQuickFix(await this.getCodeFixes(fileRangeArgs, params.context), this.documents));
789
738
  }
790
739
  if (!kinds || kinds.some(kind => kind.contains(CodeActionKind.Refactor))) {
791
- actions.push(...provideRefactors(await this.getRefactors(args), args));
740
+ actions.push(...provideRefactors(await this.getRefactors(fileRangeArgs, params.context), fileRangeArgs, this.features));
792
741
  }
793
742
  // organize import is provided by tsserver for any line, so we only get it if explicitly requested
794
743
  if (kinds?.some(kind => kind.contains(CodeActionKind.SourceOrganizeImportsTs))) {
@@ -798,7 +747,7 @@ export class LspServer {
798
747
  // assume no severity is an error
799
748
  d => (d.severity ?? 0) <= 2);
800
749
  const response = await this.getOrganizeImports({
801
- scope: { type: 'file', args },
750
+ scope: { type: 'file', args: fileRangeArgs },
802
751
  skipDestructiveCodeActions,
803
752
  });
804
753
  actions.push(...provideOrganizeImports(response, this.documents));
@@ -816,7 +765,12 @@ export class LspServer {
816
765
  }
817
766
  return actions;
818
767
  }
819
- async getCodeFixes(args) {
768
+ async getCodeFixes(fileRangeArgs, context) {
769
+ const errorCodes = context.diagnostics.map(diagnostic => Number(diagnostic.code));
770
+ const args = {
771
+ ...fileRangeArgs,
772
+ errorCodes,
773
+ };
820
774
  try {
821
775
  return await this.tspClient.request("getCodeFixes" /* CommandTypes.GetCodeFixes */, args);
822
776
  }
@@ -824,7 +778,12 @@ export class LspServer {
824
778
  return undefined;
825
779
  }
826
780
  }
827
- async getRefactors(args) {
781
+ async getRefactors(fileRangeArgs, context) {
782
+ const args = {
783
+ ...fileRangeArgs,
784
+ triggerReason: context.triggerKind === lsp.CodeActionTriggerKind.Invoked ? 'invoked' : undefined,
785
+ kind: context.only?.length === 1 ? context.only[0] : undefined,
786
+ };
828
787
  try {
829
788
  return await this.tspClient.request("getApplicableRefactors" /* CommandTypes.GetApplicableRefactors */, args);
830
789
  }
@@ -1065,22 +1024,9 @@ export class LspServer {
1065
1024
  }
1066
1025
  }
1067
1026
  async onTsEvent(event) {
1068
- if (event.event === "semanticDiag" /* EventTypes.SementicDiag */ ||
1069
- event.event === "syntaxDiag" /* EventTypes.SyntaxDiag */ ||
1070
- event.event === "suggestionDiag" /* EventTypes.SuggestionDiag */) {
1027
+ if (event.event === "semanticDiag" /* EventTypes.SementicDiag */ || event.event === "syntaxDiag" /* EventTypes.SyntaxDiag */ || event.event === "suggestionDiag" /* EventTypes.SuggestionDiag */) {
1071
1028
  this.diagnosticQueue?.updateDiagnostics(event.event, event);
1072
1029
  }
1073
- else if (event.event === "projectLoadingStart" /* EventTypes.ProjectLoadingStart */) {
1074
- await this.loadingIndicator.startedLoadingProject(event.body.projectName);
1075
- }
1076
- else if (event.event === "projectLoadingFinish" /* EventTypes.ProjectLoadingFinish */) {
1077
- this.loadingIndicator.finishedLoadingProject(event.body.projectName);
1078
- }
1079
- else {
1080
- this.logger.log('Ignored event', {
1081
- event: event.event,
1082
- });
1083
- }
1084
1030
  }
1085
1031
  async calls(params) {
1086
1032
  let callsResult = { calls: [] };