typescript-language-server 0.6.1 → 0.6.5

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 (67) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/README.md +245 -19
  3. package/lib/calls.js +9 -9
  4. package/lib/calls.js.map +1 -1
  5. package/lib/cli.js +3 -9
  6. package/lib/cli.js.map +1 -1
  7. package/lib/commands.d.ts +1 -1
  8. package/lib/commands.d.ts.map +1 -1
  9. package/lib/commands.js +1 -1
  10. package/lib/commands.js.map +1 -1
  11. package/lib/completion.d.ts.map +1 -1
  12. package/lib/completion.js +43 -31
  13. package/lib/completion.js.map +1 -1
  14. package/lib/diagnostic-queue.d.ts +4 -4
  15. package/lib/diagnostic-queue.d.ts.map +1 -1
  16. package/lib/diagnostic-queue.js +3 -3
  17. package/lib/diagnostic-queue.js.map +1 -1
  18. package/lib/document-symbol.js +8 -8
  19. package/lib/document-symbol.js.map +1 -1
  20. package/lib/file-lsp-server.spec.js +27 -5
  21. package/lib/file-lsp-server.spec.js.map +1 -1
  22. package/lib/hover.js +6 -6
  23. package/lib/hover.js.map +1 -1
  24. package/lib/lsp-connection.d.ts.map +1 -1
  25. package/lib/lsp-connection.js +3 -0
  26. package/lib/lsp-connection.js.map +1 -1
  27. package/lib/lsp-protocol.calls.proposed.d.ts.map +1 -1
  28. package/lib/lsp-protocol.calls.proposed.js.map +1 -1
  29. package/lib/lsp-protocol.inlayHints.proposed.d.ts +36 -0
  30. package/lib/lsp-protocol.inlayHints.proposed.d.ts.map +1 -0
  31. package/lib/lsp-protocol.inlayHints.proposed.js +25 -0
  32. package/lib/lsp-protocol.inlayHints.proposed.js.map +1 -0
  33. package/lib/lsp-server.d.ts +8 -1
  34. package/lib/lsp-server.d.ts.map +1 -1
  35. package/lib/lsp-server.js +169 -98
  36. package/lib/lsp-server.js.map +1 -1
  37. package/lib/lsp-server.spec.js +234 -74
  38. package/lib/lsp-server.spec.js.map +1 -1
  39. package/lib/modules-resolver.spec.js +1 -1
  40. package/lib/modules-resolver.spec.js.map +1 -1
  41. package/lib/organize-imports.d.ts.map +1 -1
  42. package/lib/organize-imports.js +2 -1
  43. package/lib/organize-imports.js.map +1 -1
  44. package/lib/organize-imports.spec.js +6 -4
  45. package/lib/organize-imports.spec.js.map +1 -1
  46. package/lib/protocol-translation.d.ts +14 -1
  47. package/lib/protocol-translation.d.ts.map +1 -1
  48. package/lib/protocol-translation.js +28 -5
  49. package/lib/protocol-translation.js.map +1 -1
  50. package/lib/quickfix.js +1 -1
  51. package/lib/quickfix.js.map +1 -1
  52. package/lib/test-utils.d.ts.map +1 -1
  53. package/lib/test-utils.js +5 -4
  54. package/lib/test-utils.js.map +1 -1
  55. package/lib/ts-protocol.d.ts +11 -1
  56. package/lib/ts-protocol.d.ts.map +1 -1
  57. package/lib/ts-protocol.js.map +1 -1
  58. package/lib/tsp-client.d.ts +2 -1
  59. package/lib/tsp-client.d.ts.map +1 -1
  60. package/lib/tsp-client.js +19 -7
  61. package/lib/tsp-client.js.map +1 -1
  62. package/lib/tsp-client.spec.js +60 -32
  63. package/lib/tsp-client.spec.js.map +1 -1
  64. package/lib/tsp-command-types.d.ts +2 -3
  65. package/lib/tsp-command-types.d.ts.map +1 -1
  66. package/lib/tsp-command-types.js.map +1 -1
  67. package/package.json +6 -6
package/CHANGELOG.md CHANGED
@@ -1,6 +1,33 @@
1
1
  # Changelog
2
2
  All notable changes to this project will be documented in this file.
3
3
 
4
+ ## [0.6.5] - 2021-11-03
5
+
6
+ - fix: normalize client and tsserver paths (#275)
7
+ This should ensure consistent behavior regradless of the platform. Previously some functionality could be malfunctioning on Windows depending on the LSP client used due to using non-normalized file paths.
8
+ - Handle the `APPLY_COMPLETION_CODE_ACTION` command internally (#270)
9
+ This means that the clients that have implemented a custom handling for the `_typescript.applyCompletionCodeAction` command can remove that code.
10
+ Without removing the custom handling everything should work as before but some edge cases might work better when custom handling is removed.
11
+ - fix: ignore empty code blocks in content returned from `textDocument/hover` (#276)
12
+ - fix: remove unsupported --node-ipc and --socket options (#278)
13
+
14
+ ## [0.6.4] - 2021-10-12
15
+
16
+ - Fix broken logging (#267)
17
+ - Add support for `workspace/didChangeConfiguration` and setting formatting options per language (#268)
18
+ - Add option to set inlayHints preferences by language (#266)
19
+
20
+ ## [0.6.3] - 2021-10-27
21
+
22
+ - Implement experimental inlay hints (#259) ([documentation](https://github.com/typescript-language-server/typescript-language-server#typescriptinlayhints-experimental-supported-from-typescript-v442))
23
+ - Send diagnostics even to clients that don't signal support (#261) (reverts #229)
24
+
25
+ ## [0.6.2] - 2021-08-16
26
+
27
+ - Mark completion items as deprecated if JSDoc says so (#227)
28
+ - Add a `maxTsServerMemory` option (#252)
29
+ - (chore) Add Windows and Mac CI runner (#248)
30
+
4
31
  ## [0.6.1] - 2021-08-16
5
32
 
6
33
  - Fix Windows path regression introduced in #220 (#249)
package/README.md CHANGED
@@ -2,6 +2,7 @@
2
2
  [![Discord](https://img.shields.io/discord/873659987413573634)](https://discord.gg/AC7Vs6hwFa)
3
3
 
4
4
  # TypeScript Language Server
5
+
5
6
  [Language Server Protocol](https://github.com/Microsoft/language-server-protocol) implementation for TypeScript wrapping `tsserver`.
6
7
 
7
8
  [![https://nodei.co/npm/typescript-language-server.png?downloads=true&downloadRank=true&stars=true](https://nodei.co/npm/typescript-language-server.png?downloads=true&downloadRank=true&stars=true)](https://www.npmjs.com/package/typescript-language-server)
@@ -10,6 +11,143 @@ Based on concepts and ideas from https://github.com/prabirshrestha/typescript-la
10
11
 
11
12
  Maintained by a [community of contributors](https://github.com/typescript-language-server/typescript-language-server/graphs/contributors) like you
12
13
 
14
+ # Installing
15
+
16
+ ```sh
17
+ npm install -g typescript-language-server
18
+ ```
19
+
20
+ # Running the language server
21
+
22
+ ```
23
+ typescript-language-server --stdio
24
+ ```
25
+
26
+ ## CLI Options
27
+
28
+ ```
29
+ Usage: typescript-language-server [options]
30
+
31
+
32
+ Options:
33
+
34
+ -V, --version output the version number
35
+ --stdio use stdio (the only supported and required option)
36
+ --log-level <log-level> A number indicating the log level (4 = log, 3 = info, 2 = warn, 1 = error). Defaults to `2`.
37
+ --tsserver-log-file <tsServerLogFile> Specify a tsserver log file. example: --tsserver-log-file=ts-logs.txt
38
+ --tsserver-log-verbosity <verbosity> Specify tsserver log verbosity (off, terse, normal, verbose). Defaults to `normal`. example: --tsserver-log-verbosity=verbose
39
+ --tsserver-path <path> Specify path to tsserver. example: --tsserver-path=tsserver
40
+ -h, --help output usage information
41
+ ```
42
+
43
+ ## initializationOptions
44
+
45
+ The language server accepts various settings through the `initializationOptions` object passed through the `initialize` request. Refer to your LSP client's documentation on how to set these. Here is the list of supported options:
46
+
47
+ | Setting | Type | Description |
48
+ |:------------------|:---------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
49
+ | hostInfo | string | Information about the host, for example `"Emacs 24.4"` or `"Sublime Text v3075"`. **Default**: `undefined` |
50
+ | logVerbosity | string | The verbosity level of the information printed in the log by `tsserver`. Accepts values: `"off"`, `"terse"`, `"normal"`, `"requesttime"`, `"verbose"`. **Default**: `undefined` (`"off"`). |
51
+ | maxTsServerMemory | number | The maximum size of the V8's old memory section in megabytes (for example `4096` means 4GB). The default value is dynamically configured by Node so can differ per system. Increase for very big projects that exceed allowed memory usage. **Default**: `undefined` |
52
+ | plugins | object[] | An array of `{ name: string, location: string }` objects for registering a Typescript plugins. **Default**: [] |
53
+ | preferences | object | Preferences passed to the Typescript (`tsserver`) process. See below for more info. |
54
+
55
+ The `preferences` object is an object specifying preferences for the internal `tsserver` process. Those options depend on the version of Typescript used but at the time of writing Typescript v4.4.3 contains these options:
56
+
57
+ ```ts
58
+ interface UserPreferences {
59
+ disableSuggestions: boolean;
60
+ quotePreference: "auto" | "double" | "single";
61
+ /**
62
+ * If enabled, TypeScript will search through all external modules' exports and add them to the completions list.
63
+ * This affects lone identifier completions but not completions on the right hand side of `obj.`.
64
+ */
65
+ includeCompletionsForModuleExports: boolean;
66
+ /**
67
+ * Enables auto-import-style completions on partially-typed import statements. E.g., allows
68
+ * `import write|` to be completed to `import { writeFile } from "fs"`.
69
+ */
70
+ includeCompletionsForImportStatements: boolean;
71
+ /**
72
+ * Allows completions to be formatted with snippet text, indicated by `CompletionItem["isSnippet"]`.
73
+ */
74
+ includeCompletionsWithSnippetText: boolean;
75
+ /**
76
+ * If enabled, the completion list will include completions with invalid identifier names.
77
+ * For those entries, The `insertText` and `replacementSpan` properties will be set to change from `.x` property access to `["x"]`.
78
+ */
79
+ includeCompletionsWithInsertText: boolean;
80
+ /**
81
+ * Unless this option is `false`, or `includeCompletionsWithInsertText` is not enabled,
82
+ * member completion lists triggered with `.` will include entries on potentially-null and potentially-undefined
83
+ * values, with insertion text to replace preceding `.` tokens with `?.`.
84
+ */
85
+ includeAutomaticOptionalChainCompletions: boolean;
86
+ allowIncompleteCompletions: boolean;
87
+ importModuleSpecifierPreference: "shortest" | "project-relative" | "relative" | "non-relative";
88
+ /** Determines whether we import `foo/index.ts` as "foo", "foo/index", or "foo/index.js" */
89
+ importModuleSpecifierEnding: "auto" | "minimal" | "index" | "js";
90
+ allowTextChangesInNewFiles: boolean;
91
+ lazyConfiguredProjectsFromExternalProject: boolean;
92
+ providePrefixAndSuffixTextForRename: boolean;
93
+ provideRefactorNotApplicableReason: boolean;
94
+ allowRenameOfImportPath: boolean;
95
+ includePackageJsonAutoImports: "auto" | "on" | "off";
96
+ displayPartsForJSDoc: boolean;
97
+ generateReturnInDocTemplate: boolean;
98
+ }
99
+ ```
100
+
101
+ From the `preferences` options listed above, this server explicilty sets the following options (all other options use their default values):
102
+
103
+ ```js
104
+ {
105
+ includeCompletionsForModuleExports: true,
106
+ includeCompletionsWithInsertText: true,
107
+ }
108
+ ```
109
+
110
+ ## workspace/didChangeConfiguration
111
+
112
+ Some of the preferences can be controlled through the `workspace/didChangeConfiguration` notification. Below is a list of supported options that can be passed. Note that the settings are specified separately for the typescript and javascript files so `[language]` can be either `javascript` or `typescript`.
113
+
114
+ ```ts
115
+ // Formatting preferences
116
+ [language].format.baseIndentSize: number;
117
+ [language].format.convertTabsToSpaces: boolean;
118
+ [language].format.indentSize: number;
119
+ [language].format.indentStyle: 'None' | 'Block' | 'Smart';
120
+ [language].format.insertSpaceAfterCommaDelimiter: boolean;
121
+ [language].format.insertSpaceAfterConstructor: boolean;
122
+ [language].format.insertSpaceAfterFunctionKeywordForAnonymousFunctions: boolean;
123
+ [language].format.insertSpaceAfterKeywordsInControlFlowStatements: boolean;
124
+ [language].format.insertSpaceAfterOpeningAndBeforeClosingEmptyBraces: boolean;
125
+ [language].format.insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces: boolean;
126
+ [language].format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces: boolean;
127
+ [language].format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets: boolean;
128
+ [language].format.insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: boolean;
129
+ [language].format.insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces: boolean;
130
+ [language].format.insertSpaceAfterSemicolonInForStatements: boolean;
131
+ [language].format.insertSpaceAfterTypeAssertion: boolean;
132
+ [language].format.insertSpaceBeforeAndAfterBinaryOperators: boolean;
133
+ [language].format.insertSpaceBeforeFunctionParenthesis: boolean;
134
+ [language].format.insertSpaceBeforeTypeAnnotation: boolean;
135
+ [language].format.newLineCharacter: string;
136
+ [language].format.placeOpenBraceOnNewLineForControlBlocks: boolean;
137
+ [language].format.placeOpenBraceOnNewLineForFunctions: boolean;
138
+ [language].format.semicolons: 'ignore' | 'insert' | 'remove';
139
+ [language].format.tabSize: number;
140
+ [language].format.trimTrailingWhitespace: boolean;
141
+ // Inlay Hints preferences
142
+ [language].inlayHints.includeInlayEnumMemberValueHints: boolean;
143
+ [language].inlayHints.includeInlayFunctionLikeReturnTypeHints: boolean;
144
+ [language].inlayHints.includeInlayFunctionParameterTypeHints: boolean;
145
+ [language].inlayHints.includeInlayParameterNameHints: 'none' | 'literals' | 'all';
146
+ [language].inlayHints.includeInlayParameterNameHintsWhenArgumentMatchesName: boolean;
147
+ [language].inlayHints.includeInlayPropertyDeclarationTypeHints: boolean;
148
+ [language].inlayHints.includeInlayVariableTypeHints: boolean;
149
+ ```
150
+
13
151
  # Supported Protocol features
14
152
 
15
153
  - [x] textDocument/didChange (incremental)
@@ -30,36 +168,124 @@ Maintained by a [community of contributors](https://github.com/typescript-langua
30
168
  - [x] textDocument/references
31
169
  - [x] textDocument/signatureHelp
32
170
  - [x] workspace/symbol
171
+ - [x] workspace/didChangeConfiguration
33
172
 
34
- # Installing
173
+ ## `typescript/inlayHints` (experimental, supported from Typescript v4.4.2)
35
174
 
36
- ```sh
37
- npm install -g typescript-language-server
38
- ```
175
+ ```ts
176
+ type Request = {
177
+ textDocument: TextDocumentIdentifier,
178
+ range?: Range,
179
+ }
39
180
 
40
- # Running the language server
181
+ type Response = {
182
+ inlayHints: InlayHint[];
183
+ }
41
184
 
42
- ```
43
- typescript-language-server --stdio
185
+ type InlayHint = {
186
+ text: string;
187
+ position: lsp.Position;
188
+ kind: 'Type' | 'Parameter' | 'Enum';
189
+ whitespaceBefore?: boolean;
190
+ whitespaceAfter?: boolean;
191
+ };
44
192
  ```
45
193
 
46
- ## Options
194
+ For the request to return any results, some or all of the following options need to be enabled through `preferences`:
47
195
 
196
+ ```ts
197
+ // Not officially part of UserPreferences yet but you can send them along with the UserPreferences just fine:
198
+ export interface InlayHintsOptions extends UserPreferences {
199
+ includeInlayParameterNameHints: 'none' | 'literals' | 'all';
200
+ includeInlayParameterNameHintsWhenArgumentMatchesName: boolean;
201
+ includeInlayFunctionParameterTypeHints: boolean;
202
+ includeInlayVariableTypeHints: boolean;
203
+ includeInlayPropertyDeclarationTypeHints: boolean;
204
+ includeInlayFunctionLikeReturnTypeHints: boolean;
205
+ includeInlayEnumMemberValueHints: boolean;
206
+ }
48
207
  ```
49
- Usage: typescript-language-server [options]
50
208
 
209
+ ## `textDocument/calls` (experimental)
51
210
 
52
- Options:
211
+ ```ts
212
+ type Request = {
213
+ /**
214
+ * The text document.
215
+ */
216
+ textDocument: TextDocumentIdentifier;
217
+ /**
218
+ * The position inside the text document.
219
+ */
220
+ position: Position;
221
+ /**
222
+ * Outgoing direction for callees.
223
+ * The default is incoming for callers.
224
+ */
225
+ direction?: CallDirection;
226
+ }
53
227
 
54
- -V, --version output the version number
55
- --stdio use stdio
56
- --node-ipc use node-ipc
57
- --log-level <log-level> A number indicating the log level (4 = log, 3 = info, 2 = warn, 1 = error). Defaults to `2`.
58
- --socket <port> use socket. example: --socket=5000
59
- --tsserver-log-file <tsServerLogFile> Specify a tsserver log file. example: --tsserver-log-file=ts-logs.txt
60
- --tsserver-log-verbosity <verbosity> Specify tsserver log verbosity (off, terse, normal, verbose). Defaults to `normal`. example: --tsserver-log-verbosity=verbose
61
- --tsserver-path <path> Specify path to tsserver. example: --tsserver-path=tsserver
62
- -h, --help output usage information
228
+ export enum CallDirection {
229
+ /**
230
+ * Incoming calls aka. callers
231
+ */
232
+ Incoming = 'incoming',
233
+ /**
234
+ * Outgoing calls aka. callees
235
+ */
236
+ Outgoing = 'outgoing',
237
+ }
238
+
239
+ type Result = {
240
+ /**
241
+ * The symbol of a definition for which the request was made.
242
+ *
243
+ * If no definition is found at a given text document position, the symbol is undefined.
244
+ */
245
+ symbol?: DefinitionSymbol;
246
+ /**
247
+ * List of calls.
248
+ */
249
+ calls: Call[];
250
+ }
251
+
252
+ interface Call {
253
+ /**
254
+ * Actual location of a call to a definition.
255
+ */
256
+ location: Location;
257
+ /**
258
+ * Symbol refered to by this call. For outgoing calls this is a callee,
259
+ * otherwise a caller.
260
+ */
261
+ symbol: DefinitionSymbol;
262
+ }
263
+
264
+ interface DefinitionSymbol {
265
+ /**
266
+ * The name of this symbol.
267
+ */
268
+ name: string;
269
+ /**
270
+ * More detail for this symbol, e.g the signature of a function.
271
+ */
272
+ detail?: string;
273
+ /**
274
+ * The kind of this symbol.
275
+ */
276
+ kind: SymbolKind;
277
+ /**
278
+ * The range enclosing this symbol not including leading/trailing whitespace but everything else
279
+ * like comments. This information is typically used to determine if the the clients cursor is
280
+ * inside the symbol to reveal in the symbol in the UI.
281
+ */
282
+ location: Location;
283
+ /**
284
+ * The range that should be selected and revealed when this symbol is being picked, e.g the name of a function.
285
+ * Must be contained by the the `range`.
286
+ */
287
+ selectionRange: Range;
288
+ }
63
289
  ```
64
290
 
65
291
  # Development
package/lib/calls.js CHANGED
@@ -50,7 +50,7 @@ function computeCallers(tspClient, args) {
50
50
  if (!symbol) {
51
51
  continue;
52
52
  }
53
- const location = protocol_translation_1.toLocation(callerReference, undefined);
53
+ const location = (0, protocol_translation_1.toLocation)(callerReference, undefined);
54
54
  calls.push({
55
55
  location,
56
56
  symbol
@@ -83,7 +83,7 @@ function computeCallees(tspClient, args, documentProvider) {
83
83
  if (!definitionSymbol) {
84
84
  continue;
85
85
  }
86
- const location = protocol_translation_1.toLocation(reference, undefined);
86
+ const location = (0, protocol_translation_1.toLocation)(reference, undefined);
87
87
  calls.push({
88
88
  location,
89
89
  symbol: definitionSymbol
@@ -132,7 +132,7 @@ function findOutgoingCalls(tspClient, contextSymbol, documentProvider) {
132
132
  }
133
133
  });
134
134
  const calls = [];
135
- const file = protocol_translation_1.uriToPath(contextSymbol.location.uri);
135
+ const file = (0, protocol_translation_1.uriToPath)(contextSymbol.location.uri);
136
136
  const document = documentProvider(file);
137
137
  if (!document) {
138
138
  return calls;
@@ -149,7 +149,7 @@ function findOutgoingCalls(tspClient, contextSymbol, documentProvider) {
149
149
  }
150
150
  function getDefinition(tspClient, args) {
151
151
  return __awaiter(this, void 0, void 0, function* () {
152
- const file = protocol_translation_1.uriToPath(args.textDocument.uri);
152
+ const file = (0, protocol_translation_1.uriToPath)(args.textDocument.uri);
153
153
  if (!file) {
154
154
  return undefined;
155
155
  }
@@ -174,13 +174,13 @@ function findEnclosingSymbol(tspClient, args) {
174
174
  if (!symbol) {
175
175
  return undefined;
176
176
  }
177
- const uri = protocol_translation_1.pathToUri(file, undefined);
177
+ const uri = (0, protocol_translation_1.pathToUri)(file, undefined);
178
178
  return lspcalls.DefinitionSymbol.create(uri, symbol);
179
179
  });
180
180
  }
181
181
  function findEnclosingSymbolInTree(parent, range) {
182
182
  return __awaiter(this, void 0, void 0, function* () {
183
- const inSpan = (span) => !!protocol_translation_1.Range.intersection(protocol_translation_1.asRange(span), range);
183
+ const inSpan = (span) => !!protocol_translation_1.Range.intersection((0, protocol_translation_1.asRange)(span), range);
184
184
  const inTree = (tree) => tree.spans.some(span => inSpan(span));
185
185
  let candidate = inTree(parent) ? parent : undefined;
186
186
  outer: while (candidate) {
@@ -197,17 +197,17 @@ function findEnclosingSymbolInTree(parent, range) {
197
197
  return undefined;
198
198
  }
199
199
  const span = candidate.spans.find(span => inSpan(span));
200
- const spanRange = protocol_translation_1.asRange(span);
200
+ const spanRange = (0, protocol_translation_1.asRange)(span);
201
201
  let selectionRange = spanRange;
202
202
  if (candidate.nameSpan) {
203
- const nameRange = protocol_translation_1.asRange(candidate.nameSpan);
203
+ const nameRange = (0, protocol_translation_1.asRange)(candidate.nameSpan);
204
204
  if (protocol_translation_1.Range.intersection(spanRange, nameRange)) {
205
205
  selectionRange = nameRange;
206
206
  }
207
207
  }
208
208
  return {
209
209
  name: candidate.text,
210
- kind: protocol_translation_1.toSymbolKind(candidate.kind),
210
+ kind: (0, protocol_translation_1.toSymbolKind)(candidate.kind),
211
211
  range: spanRange,
212
212
  selectionRange: selectionRange
213
213
  };
package/lib/calls.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"calls.js","sourceRoot":"","sources":["../src/calls.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,gEAAkD;AAClD,wEAA0D;AAG1D,iEAAwG;AAGxG,SAAsB,cAAc,CAAC,SAAoB,EAAE,IAAoC;;QAC3F,MAAM,UAAU,GAAG,EAAE,KAAK,EAAE,EAAE,EAAE,CA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YAC5D,IAAI;YACJ,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI;YACrB,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM;SAC5B,CAAC,CAAC;QACH,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE;YACd,OAAO,EAAE,CAAC;SACb;QACD,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC;IAC5B,CAAC;CAAA"}
package/lib/cli.js CHANGED
@@ -33,20 +33,14 @@ const lsp = __importStar(require("vscode-languageserver/node"));
33
33
  const program = new commander_1.Command('typescript-language-server')
34
34
  // eslint-disable-next-line @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires
35
35
  .version(require('../package.json').version)
36
- .option('--stdio', 'use stdio')
37
- .option('--node-ipc', 'use node-ipc')
36
+ .requiredOption('--stdio', 'use stdio')
38
37
  .option('--log-level <logLevel>', 'A number indicating the log level (4 = log, 3 = info, 2 = warn, 1 = error). Defaults to `2`.')
39
- .option('--socket <port>', 'use socket. example: --socket=5000')
40
38
  .option('--tsserver-log-file <tsserverLogFile>', 'Specify a tsserver log file. example: --tsserver-log-file ts-logs.txt')
41
39
  .option('--tsserver-log-verbosity <tsserverLogVerbosity>', 'Specify a tsserver log verbosity (terse, normal, verbose). Defaults to `normal`.' +
42
40
  ' example: --tsserver-log-verbosity verbose')
43
- .option('--tsserver-path <path>', `Specify path to tsserver. example: --tsserver-path=${utils_1.getTsserverExecutable()}`)
41
+ .option('--tsserver-path <path>', `Specify path to tsserver. example: --tsserver-path=${(0, utils_1.getTsserverExecutable)()}`)
44
42
  .parse(process.argv);
45
43
  const options = program.opts();
46
- if (!(options.stdio || options.socket || options.nodeIpc)) {
47
- console.error('Connection type required (stdio, node-ipc, socket). Refer to --help for more details.');
48
- process.exit(1);
49
- }
50
44
  if (options.tsserverLogFile && !options.tsserverLogVerbosity) {
51
45
  options.tsserverLogVerbosity = 'normal';
52
46
  }
@@ -58,7 +52,7 @@ if (options.logLevel) {
58
52
  logLevel = lsp.MessageType.Warning;
59
53
  }
60
54
  }
61
- lsp_connection_1.createLspConnection({
55
+ (0, lsp_connection_1.createLspConnection)({
62
56
  tsserverPath: options.tsserverPath,
63
57
  tsserverLogFile: options.tsserverLogFile,
64
58
  tsserverLogVerbosity: options.tsserverLogVerbosity,
package/lib/cli.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;AACA;;;;;GAKG;;;;;;;;;;;;;;;;;;;;;AAEH,yCAAoC;AACpC,mCAAgD;AAChD,qDAAuD;AACvD,gEAAkD;AAElD,MAAM,OAAO,GAAG,IAAI,mBAAO,CAAC,4BAA4B,CAAC;IACrD,qGAAqG;KACpG,OAAO,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC,OAAO,CAAC;KAC3C,MAAM,CAAC,SAAS,EAAE,WAAW,CAAC;KAC9B,MAAM,CAAC,YAAY,EAAE,cAAc,CAAC;KACpC,MAAM,CAAC,wBAAwB,EAAE,8FAA8F,CAAC;KAChI,MAAM,CAAC,iBAAiB,EAAE,oCAAoC,CAAC;KAC/D,MAAM,CAAC,uCAAuC,EAAE,uEAAuE,CAAC;KACxH,MAAM,CAAC,iDAAiD,EAAE,kFAAkF;IAC3I,4CAA4C,CAAC;KAC9C,MAAM,CAAC,wBAAwB,EAAE,sDAAsD,6BAAqB,EAAE,EAAE,CAAC;KACjH,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AAEzB,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;AAE/B,IAAI,CAAC,CAAC,OAAO,CAAC,KAAK,IAAI,OAAO,CAAC,MAAM,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE;IACvD,OAAO,CAAC,KAAK,CAAC,uFAAuF,CAAC,CAAC;IACvG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;CACnB;AAED,IAAI,OAAO,CAAC,eAAe,IAAI,CAAC,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B,GAAE,EAAE,CAAC;KACjH,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AAEzB,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;AAE/B,IAAI,OAAO,CAAC,eAAe,IAAI,CAAC,OAAO,CAAC,oBAAoB,EAAE;IAC1D,OAAO,CAAC,oBAAoB,GAAG,QAAQ,CAAC;CAC3C;AAED,IAAI,QAAQ,GAAG,GAAG,CAAC,WAAW,CAAC,OAAO,CAAC;AACvC,IAAI,OAAO,CAAC,QAAQ,EAAE;IAClB,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;IAC1C,IAAI,QAAQ,IAAI,CAAC,QAAQ,GAAG,CAAC,IAAI,QAAQ,GAAG,CAAC,CAAC,EAAE;QAC5C,OAAO,CAAC,KAAK,CAAC,wBAAwB,QAAQ,kCAAkC,CAAC,CAAC;QAClF,QAAQ,GAAG,GAAG,CAAC,WAAW,CAAC,OAAO,CAAC;KACtC;CACJ;AAED,IAAA,oCAAmB,EAAC;IAChB,YAAY,EAAE,OAAO,CAAC,YAAsB;IAC5C,eAAe,EAAE,OAAO,CAAC,eAAyB;IAClD,oBAAoB,EAAE,OAAO,CAAC,oBAA8B;IAC5D,gBAAgB,EAAE,QAA2B;CAChD,CAAC,CAAC,MAAM,EAAE,CAAC"}
package/lib/commands.d.ts CHANGED
@@ -4,8 +4,8 @@ export declare const Commands: {
4
4
  APPLY_REFACTORING: string;
5
5
  ORGANIZE_IMPORTS: string;
6
6
  APPLY_RENAME_FILE: string;
7
- /** Commands below should be implemented by the client */
8
7
  APPLY_COMPLETION_CODE_ACTION: string;
8
+ /** Commands below should be implemented by the client */
9
9
  SELECT_REFACTORING: string;
10
10
  };
11
11
  //# sourceMappingURL=commands.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../src/commands.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,QAAQ;;;;;;IAMjB,yDAAyD;;;CAG5D,CAAC"}
1
+ {"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../src/commands.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,QAAQ;;;;;;;IAOjB,yDAAyD;;CAE5D,CAAC"}
package/lib/commands.js CHANGED
@@ -13,8 +13,8 @@ exports.Commands = {
13
13
  APPLY_REFACTORING: '_typescript.applyRefactoring',
14
14
  ORGANIZE_IMPORTS: '_typescript.organizeImports',
15
15
  APPLY_RENAME_FILE: '_typescript.applyRenameFile',
16
- /** Commands below should be implemented by the client */
17
16
  APPLY_COMPLETION_CODE_ACTION: '_typescript.applyCompletionCodeAction',
17
+ /** Commands below should be implemented by the client */
18
18
  SELECT_REFACTORING: '_typescript.selectRefactoring'
19
19
  };
20
20
  //# sourceMappingURL=commands.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"commands.js","sourceRoot":"","sources":["../src/commands.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,QAAQ,GAAG;IACpB,oBAAoB,EAAE,gCAAgC;IACtD,iBAAiB,EAAE,6BAA6B;IAChD,iBAAiB,EAAE,8BAA8B;IACjD,gBAAgB,EAAE,6BAA6B;IAC/C,iBAAiB,EAAE,6BAA6B;IAChD,yDAAyD;IACzD,4BAA4B,EAAE,uCAAuC;IACrE,kBAAkB,EAAE,+BAA+B;CACtD,CAAC"}
1
+ {"version":3,"file":"commands.js","sourceRoot":"","sources":["../src/commands.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,QAAQ,GAAG;IACpB,oBAAoB,EAAE,gCAAgC;IACtD,iBAAiB,EAAE,6BAA6B;IAChD,iBAAiB,EAAE,8BAA8B;IACjD,gBAAgB,EAAE,6BAA6B;IAC/C,iBAAiB,EAAE,6BAA6B;IAChD,4BAA4B,EAAE,uCAAuC;IACrE,yDAAyD;IACzD,kBAAkB,EAAE,+BAA+B;CACtD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"completion.d.ts","sourceRoot":"","sources":["../src/completion.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,GAAG,MAAM,4BAA4B,CAAC;AAClD,OAAO,KAAK,GAAG,MAAM,yBAAyB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAKzC,UAAU,gBAAiB,SAAQ,GAAG,CAAC,cAAc;IACjD,IAAI,EAAE,GAAG,CAAC,4BAA4B,CAAC;CAC1C;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,GAAG,CAAC,eAAe,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,CAAC,QAAQ,EAAE,QAAQ,EAAE,WAAW,GAAG,gBAAgB,CAoD1I;AA6ED,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,GAAG,CAAC,cAAc,EAAE,OAAO,EAAE,GAAG,CAAC,sBAAsB,GAAG,GAAG,CAAC,cAAc,CAK1H"}
1
+ {"version":3,"file":"completion.d.ts","sourceRoot":"","sources":["../src/completion.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,GAAG,MAAM,4BAA4B,CAAC;AAClD,OAAO,KAAK,GAAG,MAAM,yBAAyB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAKzC,UAAU,gBAAiB,SAAQ,GAAG,CAAC,cAAc;IACjD,IAAI,EAAE,GAAG,CAAC,4BAA4B,CAAC;CAC1C;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,GAAG,CAAC,eAAe,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,CAAC,QAAQ,EAAE,QAAQ,EAAE,WAAW,GAAG,gBAAgB,CA2D1I;AA6ED,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,GAAG,CAAC,cAAc,EAAE,OAAO,EAAE,GAAG,CAAC,sBAAsB,GAAG,GAAG,CAAC,cAAc,CAS1H"}
package/lib/completion.js CHANGED
@@ -59,7 +59,7 @@ function asCompletionItem(entry, file, position, document) {
59
59
  item.insertTextFormat = lsp.InsertTextFormat.Snippet;
60
60
  }
61
61
  let insertText = entry.insertText;
62
- let replacementRange = entry.replacementSpan && protocol_translation_1.asRange(entry.replacementSpan);
62
+ let replacementRange = entry.replacementSpan && (0, protocol_translation_1.asRange)(entry.replacementSpan);
63
63
  // Make sure we only replace a single line at most
64
64
  if (replacementRange && replacementRange.start.line !== replacementRange.end.line) {
65
65
  replacementRange = lsp.Range.create(replacementRange.start, document.getLineEnd(replacementRange.start.line));
@@ -67,14 +67,20 @@ function asCompletionItem(entry, file, position, document) {
67
67
  if (insertText && replacementRange && insertText[0] === '[') { // o.x -> o['x']
68
68
  item.filterText = '.' + item.label;
69
69
  }
70
- if (entry.kindModifiers && entry.kindModifiers.match(/\boptional\b/)) {
71
- if (!insertText) {
72
- insertText = item.label;
70
+ if (entry.kindModifiers) {
71
+ const kindModifiers = new Set(entry.kindModifiers.split(/,|\s+/g));
72
+ if (kindModifiers.has('optional')) {
73
+ if (!insertText) {
74
+ insertText = item.label;
75
+ }
76
+ if (!item.filterText) {
77
+ item.filterText = item.label;
78
+ }
79
+ item.label += '?';
73
80
  }
74
- if (!item.filterText) {
75
- item.filterText = item.label;
81
+ if (kindModifiers.has('deprecated')) {
82
+ item.tags = [lsp.CompletionItemTag.Deprecated];
76
83
  }
77
- item.label += '?';
78
84
  }
79
85
  if (insertText && replacementRange) {
80
86
  item.textEdit = lsp.TextEdit.replace(replacementRange, insertText);
@@ -157,64 +163,70 @@ function asCommitCharacters(kind) {
157
163
  return commitCharacters.length === 0 ? undefined : commitCharacters;
158
164
  }
159
165
  function asResolvedCompletionItem(item, details) {
166
+ var _a;
160
167
  item.detail = asDetail(details);
161
- item.documentation = protocol_translation_1.asDocumentation(details);
162
- Object.assign(item, asCodeActions(details, item.data.file));
168
+ item.documentation = (0, protocol_translation_1.asDocumentation)(details);
169
+ if ((_a = details.codeActions) === null || _a === void 0 ? void 0 : _a.length) {
170
+ const filepath = (0, protocol_translation_1.normalizePath)(item.data.file);
171
+ item.additionalTextEdits = asAdditionalTextEdits(details.codeActions, filepath);
172
+ item.command = asCommand(details.codeActions, item.data.file);
173
+ }
163
174
  return item;
164
175
  }
165
176
  exports.asResolvedCompletionItem = asResolvedCompletionItem;
166
- function asCodeActions(details, filepath) {
167
- if (!details.codeActions || !details.codeActions.length) {
168
- return {};
169
- }
177
+ function asAdditionalTextEdits(codeActions, filepath) {
170
178
  // Try to extract out the additionalTextEdits for the current file.
171
- // Also check if we still have to apply other workspace edits and commands
172
- // using a vscode command
173
179
  const additionalTextEdits = [];
174
- let hasRemainingCommandsOrEdits = false;
175
- for (const tsAction of details.codeActions) {
176
- if (tsAction.commands) {
177
- hasRemainingCommandsOrEdits = true;
178
- }
180
+ for (const tsAction of codeActions) {
179
181
  // Apply all edits in the current file using `additionalTextEdits`
180
182
  if (tsAction.changes) {
181
183
  for (const change of tsAction.changes) {
182
184
  if (change.fileName === filepath) {
183
185
  for (const textChange of change.textChanges) {
184
- additionalTextEdits.push(protocol_translation_1.toTextEdit(textChange));
186
+ additionalTextEdits.push((0, protocol_translation_1.toTextEdit)(textChange));
185
187
  }
186
188
  }
187
- else {
189
+ }
190
+ }
191
+ }
192
+ return additionalTextEdits.length ? additionalTextEdits : undefined;
193
+ }
194
+ function asCommand(codeActions, filepath) {
195
+ let hasRemainingCommandsOrEdits = false;
196
+ for (const tsAction of codeActions) {
197
+ if (tsAction.commands) {
198
+ hasRemainingCommandsOrEdits = true;
199
+ break;
200
+ }
201
+ if (tsAction.changes) {
202
+ for (const change of tsAction.changes) {
203
+ if (change.fileName !== filepath) {
188
204
  hasRemainingCommandsOrEdits = true;
205
+ break;
189
206
  }
190
207
  }
191
208
  }
192
209
  }
193
- let command = undefined;
194
210
  if (hasRemainingCommandsOrEdits) {
195
211
  // Create command that applies all edits not in the current file.
196
- command = {
212
+ return {
197
213
  title: '',
198
214
  command: commands_1.Commands.APPLY_COMPLETION_CODE_ACTION,
199
- arguments: [filepath, details.codeActions.map(codeAction => ({
215
+ arguments: [filepath, codeActions.map(codeAction => ({
200
216
  commands: codeAction.commands,
201
217
  description: codeAction.description,
202
218
  changes: codeAction.changes.filter(x => x.fileName !== filepath)
203
219
  }))]
204
220
  };
205
221
  }
206
- return {
207
- command,
208
- additionalTextEdits: additionalTextEdits.length ? additionalTextEdits : undefined
209
- };
210
222
  }
211
223
  function asDetail({ displayParts, sourceDisplay, source: deprecatedSource }) {
212
224
  const result = [];
213
225
  const source = sourceDisplay || deprecatedSource;
214
226
  if (source) {
215
- result.push(`Auto import from '${protocol_translation_1.asPlainText(source)}'`);
227
+ result.push(`Auto import from '${(0, protocol_translation_1.asPlainText)(source)}'`);
216
228
  }
217
- const detail = protocol_translation_1.asPlainText(displayParts);
229
+ const detail = (0, protocol_translation_1.asPlainText)(displayParts);
218
230
  if (detail) {
219
231
  result.push(detail);
220
232
  }