typescript-language-server 0.6.4 → 0.8.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 (94) hide show
  1. package/CHANGELOG.md +94 -0
  2. package/README.md +105 -32
  3. package/lib/cli.js +5 -11
  4. package/lib/cli.js.map +1 -1
  5. package/lib/commands.d.ts +4 -1
  6. package/lib/commands.d.ts.map +1 -1
  7. package/lib/commands.js +5 -2
  8. package/lib/commands.js.map +1 -1
  9. package/lib/completion.d.ts +4 -1
  10. package/lib/completion.d.ts.map +1 -1
  11. package/lib/completion.js +192 -34
  12. package/lib/completion.js.map +1 -1
  13. package/lib/diagnostic-queue.d.ts +3 -0
  14. package/lib/diagnostic-queue.d.ts.map +1 -1
  15. package/lib/diagnostic-queue.js +14 -3
  16. package/lib/diagnostic-queue.js.map +1 -1
  17. package/lib/file-lsp-server.spec.js +22 -0
  18. package/lib/file-lsp-server.spec.js.map +1 -1
  19. package/lib/logger.d.ts.map +1 -1
  20. package/lib/logger.js +1 -0
  21. package/lib/logger.js.map +1 -1
  22. package/lib/lsp-connection.d.ts.map +1 -1
  23. package/lib/lsp-connection.js +2 -0
  24. package/lib/lsp-connection.js.map +1 -1
  25. package/lib/lsp-server.d.ts +7 -12
  26. package/lib/lsp-server.d.ts.map +1 -1
  27. package/lib/lsp-server.js +192 -56
  28. package/lib/lsp-server.js.map +1 -1
  29. package/lib/lsp-server.spec.js +213 -10
  30. package/lib/lsp-server.spec.js.map +1 -1
  31. package/lib/organize-imports.d.ts +2 -1
  32. package/lib/organize-imports.d.ts.map +1 -1
  33. package/lib/organize-imports.js +7 -5
  34. package/lib/organize-imports.js.map +1 -1
  35. package/lib/organize-imports.spec.js +14 -7
  36. package/lib/organize-imports.spec.js.map +1 -1
  37. package/lib/protocol-translation.d.ts +7 -3
  38. package/lib/protocol-translation.d.ts.map +1 -1
  39. package/lib/protocol-translation.js +26 -18
  40. package/lib/protocol-translation.js.map +1 -1
  41. package/lib/semantic-tokens.d.ts +9 -0
  42. package/lib/semantic-tokens.d.ts.map +1 -0
  43. package/lib/semantic-tokens.js +47 -0
  44. package/lib/semantic-tokens.js.map +1 -0
  45. package/lib/test-utils.d.ts.map +1 -1
  46. package/lib/test-utils.js +5 -3
  47. package/lib/test-utils.js.map +1 -1
  48. package/lib/ts-protocol.d.ts +19 -0
  49. package/lib/ts-protocol.d.ts.map +1 -1
  50. package/lib/ts-protocol.js +10 -1
  51. package/lib/ts-protocol.js.map +1 -1
  52. package/lib/tsp-client.d.ts +7 -1
  53. package/lib/tsp-client.d.ts.map +1 -1
  54. package/lib/tsp-client.js +30 -14
  55. package/lib/tsp-client.js.map +1 -1
  56. package/lib/tsp-client.spec.js +74 -82
  57. package/lib/tsp-client.spec.js.map +1 -1
  58. package/lib/tsp-command-types.d.ts +14 -1
  59. package/lib/tsp-command-types.d.ts.map +1 -1
  60. package/lib/tsp-command-types.js +21 -1
  61. package/lib/tsp-command-types.js.map +1 -1
  62. package/lib/utils/SnippetString.d.ts +12 -0
  63. package/lib/utils/SnippetString.d.ts.map +1 -0
  64. package/lib/utils/SnippetString.js +69 -0
  65. package/lib/utils/SnippetString.js.map +1 -0
  66. package/lib/utils/api.d.ts +45 -0
  67. package/lib/utils/api.d.ts.map +1 -0
  68. package/lib/utils/api.js +95 -0
  69. package/lib/utils/api.js.map +1 -0
  70. package/lib/utils/configuration.d.ts +10 -0
  71. package/lib/utils/configuration.d.ts.map +1 -0
  72. package/lib/utils/configuration.js +3 -0
  73. package/lib/utils/configuration.js.map +1 -0
  74. package/lib/utils/typeConverters.d.ts +11 -0
  75. package/lib/utils/typeConverters.d.ts.map +1 -0
  76. package/lib/utils/typeConverters.js +22 -0
  77. package/lib/utils/typeConverters.js.map +1 -0
  78. package/lib/utils/versionProvider.d.ts +29 -0
  79. package/lib/utils/versionProvider.d.ts.map +1 -0
  80. package/lib/utils/versionProvider.js +148 -0
  81. package/lib/utils/versionProvider.js.map +1 -0
  82. package/lib/utils.d.ts +0 -1
  83. package/lib/utils.d.ts.map +1 -1
  84. package/lib/utils.js +1 -8
  85. package/lib/utils.js.map +1 -1
  86. package/package.json +34 -20
  87. package/lib/modules-resolver.d.ts +0 -3
  88. package/lib/modules-resolver.d.ts.map +0 -1
  89. package/lib/modules-resolver.js +0 -54
  90. package/lib/modules-resolver.js.map +0 -1
  91. package/lib/modules-resolver.spec.d.ts +0 -2
  92. package/lib/modules-resolver.spec.d.ts.map +0 -1
  93. package/lib/modules-resolver.spec.js +0 -37
  94. package/lib/modules-resolver.spec.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,6 +1,100 @@
1
1
  # Changelog
2
2
  All notable changes to this project will be documented in this file.
3
3
 
4
+ ## [0.8.0] - 2021-11-21
5
+
6
+ - **feat**: implement semantic tokens support (#290)
7
+
8
+ - **feat**: add support for snippet completions for methods/functions (#303)
9
+
10
+ - **feat**: ability to ignore diagnostics by code (#272)
11
+ Adds new `diagnostics.ignoredCodes` workspace setting to ignore specific diagnostics.
12
+
13
+ - **feat**: add `npmLocation` option to specify NPM location (#293)
14
+
15
+ - **fix**: don't announce support for codeActionKinds (#289)
16
+
17
+ - **fix**: mark import completions as snippets (#291)
18
+
19
+ - **fix**: specify minimum node version to be v12 (#301)
20
+
21
+ - **fix**: ensure that the `tsserver` subprocess uses forked node instance (#292)
22
+ Potentially **BREAKING**. The lookup of `tsserver` was refactored to never use `spawn` logic but instead always `fork` the current node instance. See more info in the PR.
23
+
24
+ - **fix**: exit the server if tsserver process crashes (#305)
25
+
26
+ - **fix**: respect "includeDeclaration" for references request (#306)
27
+
28
+ ## [0.7.1] - 2021-11-10
29
+
30
+ - fix: add missing `semver` dependency (#288)
31
+
32
+ ## [0.7.0] - 2021-11-09
33
+
34
+ ### Breaking
35
+
36
+ Changes to default options sent to tsserver could affect behavior (hopefully for the better). Read changes below for more details.
37
+
38
+ ### Changes
39
+
40
+ - **feat**: include import specifier for import completions (#281)
41
+ For completions that import from another package, the completions will include a "detail" field with the name of the module.
42
+
43
+ Also aligned some other logic with the typescript language services used in VSCode:
44
+ * annotate the completions with the local name of the import when completing a path in import foo from '...'
45
+ * update completion "sortText" regardless if the completion "isRecommended"
46
+
47
+ - **feat**: allow skip destructive actions on running OrganizeImports (#228)
48
+ Add support for the new skipDestructiveCodeActions argument to TypeScript's organize imports feature - [1] to support [2].
49
+
50
+ Support is added in two places:
51
+ * Automatically inferring the proper value based on diagnostics for the file when returning code actions.
52
+ * Supporting sending it when manually executing the organize imports action.
53
+
54
+ Also added documentation to the readme about the supported commands that can be manually executed.
55
+
56
+ [1] https://github.com/microsoft/TypeScript/issues/43051
57
+ [2] https://github.com/apexskier/nova-typescript/issues/273
58
+
59
+ - **feat**: support running server on files without root workspace (#286)
60
+ The tsserver seems to be good at inferring the project configuration when opening single files without a workspace so don't crash on missing `rootPath`.
61
+
62
+ - **feat**: add `disableAutomaticTypingAcquisition` option to disable automatic type acquisition (#285)
63
+ - **feat**: update default tsserver options (#284)
64
+ Set the following additional options by default:
65
+ ```
66
+ allowRenameOfImportPath: true,
67
+ displayPartsForJSDoc: true,
68
+ generateReturnInDocTemplate: true,
69
+ includeAutomaticOptionalChainCompletions: true,
70
+ includeCompletionsForImportStatements: true,
71
+ includeCompletionsWithSnippetText: true,
72
+ ```
73
+ This aligns more with the default options of the typescript language services in VSCode.
74
+ - **feat**: announce support for "source.organizeImports.ts-ls" action (#283)
75
+ Announcing support for that code action allows editors that support
76
+ running code actions on save to automatically run the code action if
77
+ the user has configured the editor with settings like
78
+
79
+ ```js
80
+ "codeActionsOnSave": {
81
+ "source.organizeImports": true,
82
+ // or
83
+ "source.organizeImports.ts-ls": true,
84
+ },
85
+ ```
86
+ - **chore**: change default log level from "warn" to "info" (#287)
87
+
88
+ ## [0.6.5] - 2021-11-03
89
+
90
+ - fix: normalize client and tsserver paths (#275)
91
+ 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.
92
+ - Handle the `APPLY_COMPLETION_CODE_ACTION` command internally (#270)
93
+ This means that the clients that have implemented a custom handling for the `_typescript.applyCompletionCodeAction` command can remove that code.
94
+ Without removing the custom handling everything should work as before but some edge cases might work better when custom handling is removed.
95
+ - fix: ignore empty code blocks in content returned from `textDocument/hover` (#276)
96
+ - fix: remove unsupported --node-ipc and --socket options (#278)
97
+
4
98
  ## [0.6.4] - 2021-10-12
5
99
 
6
100
  - Fix broken logging (#267)
package/README.md CHANGED
@@ -11,13 +11,13 @@ Based on concepts and ideas from https://github.com/prabirshrestha/typescript-la
11
11
 
12
12
  Maintained by a [community of contributors](https://github.com/typescript-language-server/typescript-language-server/graphs/contributors) like you
13
13
 
14
- # Installing
14
+ ## Installing
15
15
 
16
16
  ```sh
17
17
  npm install -g typescript-language-server
18
18
  ```
19
19
 
20
- # Running the language server
20
+ ## Running the language server
21
21
 
22
22
  ```
23
23
  typescript-language-server --stdio
@@ -32,16 +32,16 @@ typescript-language-server --stdio
32
32
  Options:
33
33
 
34
34
  -V, --version output the version number
35
- --stdio use stdio
36
- --node-ipc use node-ipc
37
- --log-level <log-level> A number indicating the log level (4 = log, 3 = info, 2 = warn, 1 = error). Defaults to `2`.
38
- --socket <port> use socket. example: --socket=5000
35
+ --stdio use stdio (required option)
36
+ --log-level <log-level> A number indicating the log level (4 = log, 3 = info, 2 = warn, 1 = error). Defaults to `3`.
39
37
  --tsserver-log-file <tsServerLogFile> Specify a tsserver log file. example: --tsserver-log-file=ts-logs.txt
40
38
  --tsserver-log-verbosity <verbosity> Specify tsserver log verbosity (off, terse, normal, verbose). Defaults to `normal`. example: --tsserver-log-verbosity=verbose
41
- --tsserver-path <path> Specify path to tsserver. example: --tsserver-path=tsserver
39
+ --tsserver-path <path> Specify path to tsserver directory. example: --tsserver-path=/Users/me/typescript/lib/
42
40
  -h, --help output usage information
43
41
  ```
44
42
 
43
+ > Note: The path passed to `--tsserver-path` should ideally be a path to the `/.../typescript/lib/` directory and not to the shell script `/.../node_modules/.bin/tsserver` or `tsserver`. Though for backward-compatibility reasons, the server will try to do the right thing even when passed a path to the shell script.
44
+
45
45
  ## initializationOptions
46
46
 
47
47
  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:
@@ -49,8 +49,10 @@ The language server accepts various settings through the `initializationOptions`
49
49
  | Setting | Type | Description |
50
50
  |:------------------|:---------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
51
51
  | hostInfo | string | Information about the host, for example `"Emacs 24.4"` or `"Sublime Text v3075"`. **Default**: `undefined` |
52
+ | disableAutomaticTypingAcquisition | boolean | Disables tsserver from automatically fetching missing type definitions (`@types` packages) for external modules. |
52
53
  | logVerbosity | string | The verbosity level of the information printed in the log by `tsserver`. Accepts values: `"off"`, `"terse"`, `"normal"`, `"requesttime"`, `"verbose"`. **Default**: `undefined` (`"off"`). |
53
54
  | 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` |
55
+ | npmLocation | string | Specifies the path to the NPM executable used for Automatic Type Acquisition. |
54
56
  | plugins | object[] | An array of `{ name: string, location: string }` objects for registering a Typescript plugins. **Default**: [] |
55
57
  | preferences | object | Preferences passed to the Typescript (`tsserver`) process. See below for more info. |
56
58
 
@@ -85,6 +87,10 @@ interface UserPreferences {
85
87
  * values, with insertion text to replace preceding `.` tokens with `?.`.
86
88
  */
87
89
  includeAutomaticOptionalChainCompletions: boolean;
90
+ /**
91
+ * Allows import module names to be resolved in the initial completions request.
92
+ * @default false
93
+ */
88
94
  allowIncompleteCompletions: boolean;
89
95
  importModuleSpecifierPreference: "shortest" | "project-relative" | "relative" | "non-relative";
90
96
  /** Determines whether we import `foo/index.ts` as "foo", "foo/index", or "foo/index.js" */
@@ -104,8 +110,16 @@ From the `preferences` options listed above, this server explicilty sets the fol
104
110
 
105
111
  ```js
106
112
  {
107
- includeCompletionsForModuleExports: true,
108
- includeCompletionsWithInsertText: true,
113
+ allowIncompleteCompletions: true,
114
+ allowRenameOfImportPath: true,
115
+ allowTextChangesInNewFiles: true,
116
+ displayPartsForJSDoc: true,
117
+ generateReturnInDocTemplate: true,
118
+ includeAutomaticOptionalChainCompletions: true,
119
+ includeCompletionsForImportStatements: true,
120
+ includeCompletionsForModuleExports: true,
121
+ includeCompletionsWithInsertText: true,
122
+ includeCompletionsWithSnippetText: true,
109
123
  }
110
124
  ```
111
125
 
@@ -148,31 +162,64 @@ Some of the preferences can be controlled through the `workspace/didChangeConfig
148
162
  [language].inlayHints.includeInlayParameterNameHintsWhenArgumentMatchesName: boolean;
149
163
  [language].inlayHints.includeInlayPropertyDeclarationTypeHints: boolean;
150
164
  [language].inlayHints.includeInlayVariableTypeHints: boolean;
165
+ /**
166
+ * Complete functions with their parameter signature.
167
+ * @default false
168
+ */
169
+ completions.completeFunctionCalls: boolean;
170
+ // Diagnostics code to be omitted when reporting diagnostics.
171
+ // See https://github.com/microsoft/TypeScript/blob/master/src/compiler/diagnosticMessages.json for a full list of valid codes.
172
+ diagnostics.ignoredCodes: number[];
173
+
151
174
  ```
152
175
 
153
- # Supported Protocol features
176
+ ## Code actions on save
154
177
 
155
- - [x] textDocument/didChange (incremental)
156
- - [x] textDocument/didClose
157
- - [x] textDocument/didOpen
158
- - [x] textDocument/didSave
178
+ Server announces support for the `source.organizeImports.ts-ls` code action which allows editors that support running code actions on save to automatically organize imports on saving. The user can enable it with a setting similar to (can vary per-editor):
159
179
 
160
- - [x] textDocument/codeAction
161
- - [x] textDocument/completion (incl. completion/resolve)
162
- - [x] textDocument/definition
163
- - [x] textDocument/documentHighlight
164
- - [x] textDocument/documentSymbol
165
- - [x] textDocument/executeCommand
166
- - [x] textDocument/formatting
167
- - [x] textDocument/rangeFormatting
168
- - [x] textDocument/hover
169
- - [x] textDocument/rename
170
- - [x] textDocument/references
171
- - [x] textDocument/signatureHelp
172
- - [x] workspace/symbol
173
- - [x] workspace/didChangeConfiguration
180
+ ```js
181
+ "codeActionsOnSave": {
182
+ "source.organizeImports": true,
183
+ // or
184
+ "source.organizeImports.ts-ls": true,
185
+ }
186
+ ```
187
+
188
+ ## Workspace commands (`workspace/executeCommand`)
189
+
190
+ See [LSP specification](https://microsoft.github.io/language-server-protocol/specifications/specification-3-17/#workspace_executeCommand).
174
191
 
175
- ## `typescript/inlayHints` (experimental, supported from Typescript v4.4.2)
192
+ Most of the time, you'll execute commands with arguments retrieved from another request like `textDocument/codeAction`. There are some use cases for calling them manually.
193
+
194
+ Supported commands:
195
+
196
+ `lsp` refers to the language server protocol, `tsp` refers to the typescript server protocol.
197
+
198
+ * `_typescript.applyWorkspaceEdit`
199
+ ```ts
200
+ type Arguments = [lsp.WorkspaceEdit]
201
+ ```
202
+ * `_typescript.applyCodeAction`
203
+ ```ts
204
+ type Arguments = [tsp.CodeAction]
205
+ ```
206
+ * `_typescript.applyRefactoring`
207
+ ```ts
208
+ type Arguments = [tsp.GetEditsForRefactorRequestArgs]
209
+ ```
210
+ * `_typescript.organizeImports`
211
+ ```ts
212
+ // The "skipDestructiveCodeActions" argument is supported from Typescript 4.4+
213
+ type Arguments = [string] | [string, { skipDestructiveCodeActions?: boolean }]
214
+ ```
215
+ * `_typescript.applyRenameFile`
216
+ ```ts
217
+ type Arguments = [{ sourceUri: string; targetUri: string; }]
218
+ ```
219
+
220
+ ## Inlay hints (`typescript/inlayHints`) (experimental)
221
+
222
+ Supports experimental inline hints.
176
223
 
177
224
  ```ts
178
225
  type Request = {
@@ -208,7 +255,9 @@ export interface InlayHintsOptions extends UserPreferences {
208
255
  }
209
256
  ```
210
257
 
211
- ## `textDocument/calls` (experimental)
258
+ ## Callers and callees (`textDocument/calls`) (experimental)
259
+
260
+ Supports showing callers and calles for a given symbol. If the editor has support for appropriate UI, it can generate a tree of callers and calles for a document.
212
261
 
213
262
  ```ts
214
263
  type Request = {
@@ -290,7 +339,31 @@ interface DefinitionSymbol {
290
339
  }
291
340
  ```
292
341
 
293
- # Development
342
+ ## Supported Protocol features
343
+
344
+ - [x] textDocument/didChange (incremental)
345
+ - [x] textDocument/didClose
346
+ - [x] textDocument/didOpen
347
+ - [x] textDocument/didSave
348
+ - [x] textDocument/codeAction
349
+ - [x] textDocument/completion (incl. completion/resolve)
350
+ - [x] textDocument/definition
351
+ - [x] textDocument/documentHighlight
352
+ - [x] textDocument/documentSymbol
353
+ - [x] textDocument/executeCommand
354
+ - [x] textDocument/formatting
355
+ - [x] textDocument/rangeFormatting
356
+ - [x] textDocument/hover
357
+ - [x] textDocument/rename
358
+ - [x] textDocument/references
359
+ - [x] textDocument/signatureHelp
360
+ - [x] textDocument/calls (experimental)
361
+ - [x] typescript/inlayHints (experimental, supported from Typescript v4.4.2)
362
+ - [x] workspace/symbol
363
+ - [x] workspace/didChangeConfiguration
364
+ - [x] workspace/executeCommand
365
+
366
+ ## Development
294
367
 
295
368
  ### Build
296
369
 
@@ -298,7 +371,7 @@ interface DefinitionSymbol {
298
371
  yarn
299
372
  ```
300
373
 
301
- ## Test
374
+ ### Test
302
375
 
303
376
  ```sh
304
377
  yarn test
package/lib/cli.js CHANGED
@@ -27,35 +27,29 @@ var __importStar = (this && this.__importStar) || function (mod) {
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
29
  const commander_1 = require("commander");
30
- const utils_1 = require("./utils");
31
30
  const lsp_connection_1 = require("./lsp-connection");
32
31
  const lsp = __importStar(require("vscode-languageserver/node"));
32
+ const DEFAULT_LOG_LEVEL = lsp.MessageType.Info;
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=${(0, utils_1.getTsserverExecutable)()}`)
41
+ .option('--tsserver-path <path>', 'Specify path to tsserver directory. example: --tsserver-path=/Users/me/typescript/lib/')
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
  }
53
- let logLevel = lsp.MessageType.Warning;
47
+ let logLevel = DEFAULT_LOG_LEVEL;
54
48
  if (options.logLevel) {
55
49
  logLevel = parseInt(options.logLevel, 10);
56
50
  if (logLevel && (logLevel < 1 || logLevel > 4)) {
57
51
  console.error(`Invalid '--log-level ${logLevel}'. Falling back to 'info' level.`);
58
- logLevel = lsp.MessageType.Warning;
52
+ logLevel = DEFAULT_LOG_LEVEL;
59
53
  }
60
54
  }
61
55
  (0, lsp_connection_1.createLspConnection)({
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,OAA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,CAAC,EAAE;QAC5C,OAAO,CAAC,KAAK,CAAC,wBAAwB,QAAQ,kCAAkC,CAAC,CAAC;QAClF,QAAQ,GAAG,iBAAiB,CAAC;KAChC;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,11 @@ 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
+ export declare const CodeActions: {
12
+ SourceOrganizeImportsTsLs: string;
13
+ };
11
14
  //# 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;AAEF,eAAO,MAAM,WAAW;;CAEvB,CAAC"}
package/lib/commands.js CHANGED
@@ -6,15 +6,18 @@
6
6
  * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
7
7
  */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.Commands = void 0;
9
+ exports.CodeActions = exports.Commands = void 0;
10
10
  exports.Commands = {
11
11
  APPLY_WORKSPACE_EDIT: '_typescript.applyWorkspaceEdit',
12
12
  APPLY_CODE_ACTION: '_typescript.applyCodeAction',
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
+ exports.CodeActions = {
21
+ SourceOrganizeImportsTsLs: 'source.organizeImports.ts-ls'
22
+ };
20
23
  //# 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;AAEW,QAAA,WAAW,GAAG;IACvB,yBAAyB,EAAE,8BAA8B;CAC5D,CAAC"}
@@ -1,10 +1,13 @@
1
1
  import * as lsp from 'vscode-languageserver/node';
2
2
  import type tsp from 'typescript/lib/protocol';
3
3
  import { LspDocument } from './document';
4
+ import { TspClient } from './tsp-client';
5
+ import { CompletionOptions } from './ts-protocol';
4
6
  interface TSCompletionItem extends lsp.CompletionItem {
5
7
  data: tsp.CompletionDetailsRequestArgs;
6
8
  }
7
9
  export declare function asCompletionItem(entry: tsp.CompletionEntry, file: string, position: lsp.Position, document: LspDocument): TSCompletionItem;
8
- export declare function asResolvedCompletionItem(item: lsp.CompletionItem, details: tsp.CompletionEntryDetails): lsp.CompletionItem;
10
+ export declare function asResolvedCompletionItem(item: lsp.CompletionItem, details: tsp.CompletionEntryDetails, client: TspClient, options: CompletionOptions): Promise<lsp.CompletionItem>;
11
+ export declare function isValidFunctionCompletionContext(filepath: string, position: lsp.Position, client: TspClient): Promise<boolean>;
9
12
  export {};
10
13
  //# sourceMappingURL=completion.d.ts.map
@@ -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,CA2D1I;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,MAA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