typescript-language-server 4.0.0 → 4.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/README.md +73 -406
- package/lib/cli.mjs +23496 -1
- package/lib/cli.mjs.map +1 -1
- package/package.json +10 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
All notable changes to this project will be documented in this file.
|
|
3
3
|
|
|
4
|
+
## [4.1.0](https://github.com/typescript-language-server/typescript-language-server/compare/v4.0.0...v4.1.0) (2023-11-08)
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
### Features
|
|
8
|
+
|
|
9
|
+
* support code lens for references and implementations ([#785](https://github.com/typescript-language-server/typescript-language-server/issues/785)) ([ae058c2](https://github.com/typescript-language-server/typescript-language-server/commit/ae058c22a4900913e9516c0e3c0c46bbd741760c))
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Refactors
|
|
13
|
+
|
|
14
|
+
* port ITypeScriptServiceClient ([#782](https://github.com/typescript-language-server/typescript-language-server/issues/782)) ([ab22e52](https://github.com/typescript-language-server/typescript-language-server/commit/ab22e521615a455026625bad179298087149ccb4))
|
|
15
|
+
* remove deprecated CLI options ([#790](https://github.com/typescript-language-server/typescript-language-server/issues/790)) ([cadf374](https://github.com/typescript-language-server/typescript-language-server/commit/cadf3748a8e0de7655260ddeb1ffb30888723aaf))
|
|
16
|
+
|
|
4
17
|
## [4.0.0](https://github.com/typescript-language-server/typescript-language-server/compare/v3.3.2...v4.0.0) (2023-10-20)
|
|
5
18
|
|
|
6
19
|
|
package/README.md
CHANGED
|
@@ -1,35 +1,34 @@
|
|
|
1
|
-
[![
|
|
2
|
-
[![
|
|
1
|
+
[![Discord][discord-src]][discord-href]
|
|
2
|
+
[![npm version][npm-version-src]][npm-version-href]
|
|
3
|
+
[![npm downloads][npm-downloads-src]][npm-downloads-href]
|
|
3
4
|
|
|
4
5
|
# TypeScript Language Server
|
|
5
6
|
|
|
6
7
|
[Language Server Protocol](https://github.com/Microsoft/language-server-protocol) implementation for TypeScript wrapping `tsserver`.
|
|
7
8
|
|
|
8
|
-
|
|
9
|
+
Based on concepts and ideas from https://github.com/prabirshrestha/typescript-language-server and originally maintained by [TypeFox](https://typefox.io).
|
|
9
10
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
Maintained by a [community of contributors](https://github.com/typescript-language-server/typescript-language-server/graphs/contributors) like you
|
|
11
|
+
Maintained by a [community of contributors](https://github.com/typescript-language-server/typescript-language-server/graphs/contributors) like you.
|
|
13
12
|
|
|
14
13
|
<!-- MarkdownTOC -->
|
|
15
14
|
|
|
16
15
|
- [Installing](#installing)
|
|
17
16
|
- [Running the language server](#running-the-language-server)
|
|
18
17
|
- [CLI Options](#cli-options)
|
|
19
|
-
- [
|
|
20
|
-
- [
|
|
21
|
-
- [Code actions on save](#code-actions-on-save)
|
|
22
|
-
- [Workspace commands \(`workspace/executeCommand`\)](#workspace-commands-workspaceexecutecommand)
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
- [
|
|
31
|
-
- [
|
|
32
|
-
- [
|
|
18
|
+
- [Configuration](#configuration)
|
|
19
|
+
- [Features](#features)
|
|
20
|
+
- [Code actions on save](#code-actions-on-save)
|
|
21
|
+
- [Workspace commands \(`workspace/executeCommand`\)](#workspace-commands-workspaceexecutecommand)
|
|
22
|
+
- [Go to Source Definition](#go-to-source-definition)
|
|
23
|
+
- [Apply Workspace Edits](#apply-workspace-edits)
|
|
24
|
+
- [Apply Code Action](#apply-code-action)
|
|
25
|
+
- [Apply Refactoring](#apply-refactoring)
|
|
26
|
+
- [Organize Imports](#organize-imports)
|
|
27
|
+
- [Rename File](#rename-file)
|
|
28
|
+
- [Configure plugin](#configure-plugin)
|
|
29
|
+
- [Code Lenses \(`textDocument/codeLens`\)](#code-lenses-textdocumentcodelens)
|
|
30
|
+
- [Inlay hints \(`textDocument/inlayHint`\)](#inlay-hints-textdocumentinlayhint)
|
|
31
|
+
- [TypeScript Version Notification](#typescript-version-notification)
|
|
33
32
|
- [Development](#development)
|
|
34
33
|
- [Build](#build)
|
|
35
34
|
- [Test](#test)
|
|
@@ -61,358 +60,16 @@ typescript-language-server --stdio
|
|
|
61
60
|
-V, --version output the version number
|
|
62
61
|
--stdio use stdio (required option)
|
|
63
62
|
--log-level <log-level> A number indicating the log level (4 = log, 3 = info, 2 = warn, 1 = error). Defaults to `3`.
|
|
64
|
-
--tsserver-log-verbosity <verbosity> [deprecated] Specify tsserver log verbosity (off, terse, normal, verbose). Defaults to `normal`. example: --tsserver-log-verbosity=verbose
|
|
65
|
-
--tsserver-path <path> [deprecated] Specify path to tsserver directory. example: --tsserver-path=/Users/me/typescript/lib/
|
|
66
63
|
-h, --help output usage information
|
|
67
64
|
```
|
|
68
65
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
> Note: The path passed to `--tsserver-path` should be a path to the `[...]/typescript/lib/tssserver.js` file or to the `[...]/typescript/lib/` directory and not to the shell script `[...]/node_modules/.bin/tsserver`. Though for backward-compatibility reasons, the server will try to do the right thing even when passed a path to the shell script.
|
|
72
|
-
|
|
73
|
-
## initializationOptions
|
|
74
|
-
|
|
75
|
-
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:
|
|
76
|
-
|
|
77
|
-
| Setting | Type | Description |
|
|
78
|
-
|:------------------|:---------|:--------------------------------------------------------------------------------------|
|
|
79
|
-
| hostInfo | string | Information about the host, for example `"Emacs 24.4"` or `"Sublime Text v3075"`. **Default**: `undefined` |
|
|
80
|
-
| completionDisableFilterText | boolean | Don't set `filterText` property on completion items. **Default**: `false` |
|
|
81
|
-
| disableAutomaticTypingAcquisition | boolean | Disables tsserver from automatically fetching missing type definitions (`@types` packages) for external modules. |
|
|
82
|
-
| 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` |
|
|
83
|
-
| npmLocation | string | Specifies the path to the NPM executable used for Automatic Type Acquisition. |
|
|
84
|
-
| locale | string | The locale to use to show error messages. |
|
|
85
|
-
| plugins | object[] | An array of `{ name: string, location: string }` objects for registering a Typescript plugins. **Default**: [] |
|
|
86
|
-
| preferences | object | Preferences passed to the Typescript (`tsserver`) process. See below for more |
|
|
87
|
-
| tsserver | object | Options related to the `tsserver` process. See below for more |
|
|
88
|
-
|
|
89
|
-
The `tsserver` setting specifies additional options related to the internal `tsserver` process, like tracing and logging.
|
|
90
|
-
|
|
91
|
-
```ts
|
|
92
|
-
interface TsserverOptions {
|
|
93
|
-
/**
|
|
94
|
-
* The path to the directory where the `tsserver` log files will be created.
|
|
95
|
-
* If not provided, the log files will be created within the workspace, inside the `.log` directory.
|
|
96
|
-
* If no workspace root is provided when initializating the server and no custom path is specified then
|
|
97
|
-
* the logs will not be created.
|
|
98
|
-
*
|
|
99
|
-
* @default undefined
|
|
100
|
-
*/
|
|
101
|
-
logDirectory?: string;
|
|
102
|
-
/**
|
|
103
|
-
* Verbosity of the information logged into the `tsserver` log files.
|
|
104
|
-
*
|
|
105
|
-
* Log levels from least to most amount of details: `'terse'`, `'normal'`, `'requestTime`', `'verbose'`.
|
|
106
|
-
* Enabling particular level also enables all lower levels.
|
|
107
|
-
*
|
|
108
|
-
* @default 'off'
|
|
109
|
-
*/
|
|
110
|
-
logVerbosity?: 'off' | 'terse' | 'normal' | 'requestTime' | 'verbose';
|
|
111
|
-
/**
|
|
112
|
-
* The path to the `tsserver.js` file or the typescript lib directory. For example: `/Users/me/typescript/lib/tsserver.js`.
|
|
113
|
-
*/
|
|
114
|
-
path?: string;
|
|
115
|
-
/**
|
|
116
|
-
* The verbosity of logging of the tsserver communication.
|
|
117
|
-
* Delivered through the LSP messages and not related to file logging.
|
|
118
|
-
*
|
|
119
|
-
* @default 'off'
|
|
120
|
-
*/
|
|
121
|
-
trace?: 'off' | 'messages' | 'verbose';
|
|
122
|
-
/**
|
|
123
|
-
* Whether a dedicated server is launched to more quickly handle syntax related operations, such as computing diagnostics or code folding.
|
|
124
|
-
*
|
|
125
|
-
* Allowed values:
|
|
126
|
-
* - auto: Spawn both a full server and a lighter weight server dedicated to syntax operations. The syntax server is used to speed up syntax operations and provide IntelliSense while projects are loading.
|
|
127
|
-
* - never: Don't use a dedicated syntax server. Use a single server to handle all IntelliSense operations.
|
|
128
|
-
*
|
|
129
|
-
* @default 'auto'
|
|
130
|
-
*/
|
|
131
|
-
useSyntaxServer?: 'auto' | 'never';
|
|
132
|
-
}
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
-
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:
|
|
136
|
-
|
|
137
|
-
```ts
|
|
138
|
-
interface UserPreferences {
|
|
139
|
-
/**
|
|
140
|
-
* Glob patterns of files to exclude from auto imports. Requires using TypeScript 4.8 or newer in the workspace.
|
|
141
|
-
* Relative paths are resolved relative to the workspace root.
|
|
142
|
-
* @since 4.8.2
|
|
143
|
-
*/
|
|
144
|
-
autoImportFileExcludePatterns: [],
|
|
145
|
-
disableSuggestions: boolean;
|
|
146
|
-
quotePreference: "auto" | "double" | "single";
|
|
147
|
-
/**
|
|
148
|
-
* If enabled, TypeScript will search through all external modules' exports and add them to the completions list.
|
|
149
|
-
* This affects lone identifier completions but not completions on the right hand side of `obj.`.
|
|
150
|
-
*/
|
|
151
|
-
includeCompletionsForModuleExports: boolean;
|
|
152
|
-
/**
|
|
153
|
-
* Enables auto-import-style completions on partially-typed import statements. E.g., allows
|
|
154
|
-
* `import write|` to be completed to `import { writeFile } from "fs"`.
|
|
155
|
-
*/
|
|
156
|
-
includeCompletionsForImportStatements: boolean;
|
|
157
|
-
/**
|
|
158
|
-
* Allows completions to be formatted with snippet text, indicated by `CompletionItem["isSnippet"]`.
|
|
159
|
-
*/
|
|
160
|
-
includeCompletionsWithSnippetText: boolean;
|
|
161
|
-
/**
|
|
162
|
-
* If enabled, the completion list will include completions with invalid identifier names.
|
|
163
|
-
* For those entries, The `insertText` and `replacementSpan` properties will be set to change from `.x` property access to `["x"]`.
|
|
164
|
-
*/
|
|
165
|
-
includeCompletionsWithInsertText: boolean;
|
|
166
|
-
/**
|
|
167
|
-
* Unless this option is `false`, or `includeCompletionsWithInsertText` is not enabled,
|
|
168
|
-
* member completion lists triggered with `.` will include entries on potentially-null and potentially-undefined
|
|
169
|
-
* values, with insertion text to replace preceding `.` tokens with `?.`.
|
|
170
|
-
*/
|
|
171
|
-
includeAutomaticOptionalChainCompletions: boolean;
|
|
172
|
-
/**
|
|
173
|
-
* If enabled, completions for class members (e.g. methods and properties) will include
|
|
174
|
-
* a whole declaration for the member.
|
|
175
|
-
* E.g., `class A { f| }` could be completed to `class A { foo(): number {} }`, instead of
|
|
176
|
-
* `class A { foo }`.
|
|
177
|
-
* @since 4.5.2
|
|
178
|
-
* @default true
|
|
179
|
-
*/
|
|
180
|
-
includeCompletionsWithClassMemberSnippets: boolean;
|
|
181
|
-
/**
|
|
182
|
-
* If enabled, object literal methods will have a method declaration completion entry in addition
|
|
183
|
-
* to the regular completion entry containing just the method name.
|
|
184
|
-
* E.g., `const objectLiteral: T = { f| }` could be completed to `const objectLiteral: T = { foo(): void {} }`,
|
|
185
|
-
* in addition to `const objectLiteral: T = { foo }`.
|
|
186
|
-
* @since 4.7.2
|
|
187
|
-
* @default true
|
|
188
|
-
*/
|
|
189
|
-
includeCompletionsWithObjectLiteralMethodSnippets: boolean;
|
|
190
|
-
/**
|
|
191
|
-
* Indicates whether {@link CompletionEntry.labelDetails completion entry label details} are supported.
|
|
192
|
-
* If not, contents of `labelDetails` may be included in the {@link CompletionEntry.name} property.
|
|
193
|
-
* Only supported if the client supports `textDocument.completion.completionItem.labelDetailsSupport` capability
|
|
194
|
-
* and a compatible TypeScript version is used.
|
|
195
|
-
* @since 4.7.2
|
|
196
|
-
* @default true
|
|
197
|
-
*/
|
|
198
|
-
useLabelDetailsInCompletionEntries: boolean;
|
|
199
|
-
/**
|
|
200
|
-
* Allows import module names to be resolved in the initial completions request.
|
|
201
|
-
* @default false
|
|
202
|
-
*/
|
|
203
|
-
allowIncompleteCompletions: boolean;
|
|
204
|
-
importModuleSpecifierPreference: "shortest" | "project-relative" | "relative" | "non-relative";
|
|
205
|
-
/** Determines whether we import `foo/index.ts` as "foo", "foo/index", or "foo/index.js" */
|
|
206
|
-
importModuleSpecifierEnding: "auto" | "minimal" | "index" | "js";
|
|
207
|
-
allowTextChangesInNewFiles: boolean;
|
|
208
|
-
lazyConfiguredProjectsFromExternalProject: boolean;
|
|
209
|
-
/**
|
|
210
|
-
* Indicates whether imports should be organized in a case-insensitive manner.
|
|
211
|
-
*
|
|
212
|
-
* @default "auto".
|
|
213
|
-
*/
|
|
214
|
-
organizeImportsIgnoreCase: "auto" | boolean;
|
|
215
|
-
/**
|
|
216
|
-
* Indicates whether imports should be organized via an "ordinal" (binary) comparison using the numeric value
|
|
217
|
-
* of their code points, or via "unicode" collation (via the
|
|
218
|
-
* [Unicode Collation Algorithm](https://unicode.org/reports/tr10/#Scope)) using rules associated with the locale
|
|
219
|
-
* specified in {@link organizeImportsCollationLocale}.
|
|
220
|
-
*
|
|
221
|
-
* @default "ordinal".
|
|
222
|
-
*/
|
|
223
|
-
organizeImportsCollation: "ordinal" | "unicode";
|
|
224
|
-
/**
|
|
225
|
-
* Indicates the locale to use for "unicode" collation. If not specified, the locale `"en"` is used as an invariant
|
|
226
|
-
* for the sake of consistent sorting. Use `"auto"` to use the detected UI locale.
|
|
227
|
-
*
|
|
228
|
-
* This preference is ignored if {@link organizeImportsCollation} is not `"unicode"`.
|
|
229
|
-
*
|
|
230
|
-
* @default "en"
|
|
231
|
-
*/
|
|
232
|
-
organizeImportsCollationLocale: string;
|
|
233
|
-
/**
|
|
234
|
-
* Indicates whether numeric collation should be used for digit sequences in strings. When `true`, will collate
|
|
235
|
-
* strings such that `a1z < a2z < a100z`. When `false`, will collate strings such that `a1z < a100z < a2z`.
|
|
236
|
-
*
|
|
237
|
-
* This preference is ignored if {@link organizeImportsCollation} is not `"unicode"`.
|
|
238
|
-
*
|
|
239
|
-
* @default false
|
|
240
|
-
*/
|
|
241
|
-
organizeImportsNumericCollation: boolean;
|
|
242
|
-
/**
|
|
243
|
-
* Indicates whether accents and other diacritic marks are considered unequal for the purpose of collation. When
|
|
244
|
-
* `true`, characters with accents and other diacritics will be collated in the order defined by the locale specified
|
|
245
|
-
* in {@link organizeImportsCollationLocale}.
|
|
246
|
-
*
|
|
247
|
-
* This preference is ignored if {@link organizeImportsCollation} is not `"unicode"`.
|
|
248
|
-
*
|
|
249
|
-
* @default true
|
|
250
|
-
*/
|
|
251
|
-
organizeImportsAccentCollation: boolean;
|
|
252
|
-
/**
|
|
253
|
-
* Indicates whether upper case or lower case should sort first. When `false`, the default order for the locale
|
|
254
|
-
* specified in {@link organizeImportsCollationLocale} is used.
|
|
255
|
-
*
|
|
256
|
-
* This preference is ignored if {@link organizeImportsCollation} is not `"unicode"`. This preference is also
|
|
257
|
-
* ignored if we are using case-insensitive sorting, which occurs when {@link organizeImportsIgnoreCase} is `true`,
|
|
258
|
-
* or if {@link organizeImportsIgnoreCase} is `"auto"` and the auto-detected case sensitivity is determined to be
|
|
259
|
-
* case-insensitive.
|
|
260
|
-
*
|
|
261
|
-
* @default false
|
|
262
|
-
*/
|
|
263
|
-
organizeImportsCaseFirst: "upper" | "lower" | false;
|
|
264
|
-
providePrefixAndSuffixTextForRename: boolean;
|
|
265
|
-
provideRefactorNotApplicableReason: boolean;
|
|
266
|
-
allowRenameOfImportPath: boolean;
|
|
267
|
-
includePackageJsonAutoImports: "auto" | "on" | "off";
|
|
268
|
-
/**
|
|
269
|
-
* Preferred style for JSX attribute completions:
|
|
270
|
-
* - `"auto"` - Insert `={}` or `=\"\"` after attribute names based on the prop type.
|
|
271
|
-
* - `"braces"` - Insert `={}` after attribute names.
|
|
272
|
-
* - `"none"` - Only insert attribute names.
|
|
273
|
-
* @since 4.5.2
|
|
274
|
-
* @default 'auto'
|
|
275
|
-
*/
|
|
276
|
-
/**
|
|
277
|
-
* @since 5.2.2
|
|
278
|
-
* @default true
|
|
279
|
-
*/
|
|
280
|
-
interactiveInlayHints: true,
|
|
281
|
-
jsxAttributeCompletionStyle: "auto" | "braces" | "none";
|
|
282
|
-
displayPartsForJSDoc: boolean;
|
|
283
|
-
generateReturnInDocTemplate: boolean;
|
|
284
|
-
|
|
285
|
-
includeInlayParameterNameHints: "none" | "literals" | "all";
|
|
286
|
-
includeInlayParameterNameHintsWhenArgumentMatchesName: boolean;
|
|
287
|
-
includeInlayFunctionParameterTypeHints: boolean,
|
|
288
|
-
includeInlayVariableTypeHints: boolean;
|
|
289
|
-
/**
|
|
290
|
-
* When disabled then type hints on variables whose name is identical to the type name won't be shown. Requires using TypeScript 4.8+ in the workspace.
|
|
291
|
-
* @since 4.8.2
|
|
292
|
-
* @default false
|
|
293
|
-
*/
|
|
294
|
-
includeInlayVariableTypeHintsWhenTypeMatchesName: boolean;
|
|
295
|
-
includeInlayPropertyDeclarationTypeHints: boolean;
|
|
296
|
-
includeInlayFunctionLikeReturnTypeHints: boolean;
|
|
297
|
-
includeInlayEnumMemberValueHints: boolean;
|
|
298
|
-
}
|
|
299
|
-
```
|
|
300
|
-
|
|
301
|
-
From the `preferences` options listed above, this server explicilty sets the following options (all other options use their default values):
|
|
302
|
-
|
|
303
|
-
```js
|
|
304
|
-
{
|
|
305
|
-
allowIncompleteCompletions: true,
|
|
306
|
-
allowRenameOfImportPath: true,
|
|
307
|
-
allowTextChangesInNewFiles: true,
|
|
308
|
-
displayPartsForJSDoc: true,
|
|
309
|
-
generateReturnInDocTemplate: true,
|
|
310
|
-
includeAutomaticOptionalChainCompletions: true,
|
|
311
|
-
includeCompletionsForImportStatements: true,
|
|
312
|
-
includeCompletionsForModuleExports: true,
|
|
313
|
-
includeCompletionsWithClassMemberSnippets: true,
|
|
314
|
-
includeCompletionsWithObjectLiteralMethodSnippets: true,
|
|
315
|
-
includeCompletionsWithInsertText: true,
|
|
316
|
-
includeCompletionsWithSnippetText: true,
|
|
317
|
-
interactiveInlayHints: true,
|
|
318
|
-
jsxAttributeCompletionStyle: "auto",
|
|
319
|
-
providePrefixAndSuffixTextForRename: true,
|
|
320
|
-
provideRefactorNotApplicableReason: true,
|
|
321
|
-
}
|
|
322
|
-
```
|
|
323
|
-
|
|
324
|
-
## workspace/didChangeConfiguration
|
|
66
|
+
## Configuration
|
|
325
67
|
|
|
326
|
-
|
|
68
|
+
See [configuration documentation](./docs/configuration.md).
|
|
327
69
|
|
|
328
|
-
|
|
329
|
-
// Formatting preferences
|
|
330
|
-
[language].format.baseIndentSize: number;
|
|
331
|
-
[language].format.convertTabsToSpaces: boolean;
|
|
332
|
-
[language].format.indentSize: number;
|
|
333
|
-
[language].format.indentStyle: 'None' | 'Block' | 'Smart';
|
|
334
|
-
[language].format.insertSpaceAfterCommaDelimiter: boolean;
|
|
335
|
-
[language].format.insertSpaceAfterConstructor: boolean;
|
|
336
|
-
[language].format.insertSpaceAfterFunctionKeywordForAnonymousFunctions: boolean;
|
|
337
|
-
[language].format.insertSpaceAfterKeywordsInControlFlowStatements: boolean;
|
|
338
|
-
[language].format.insertSpaceAfterOpeningAndBeforeClosingEmptyBraces: boolean;
|
|
339
|
-
[language].format.insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces: boolean;
|
|
340
|
-
[language].format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces: boolean;
|
|
341
|
-
[language].format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets: boolean;
|
|
342
|
-
[language].format.insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: boolean;
|
|
343
|
-
[language].format.insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces: boolean;
|
|
344
|
-
[language].format.insertSpaceAfterSemicolonInForStatements: boolean;
|
|
345
|
-
[language].format.insertSpaceAfterTypeAssertion: boolean;
|
|
346
|
-
[language].format.insertSpaceBeforeAndAfterBinaryOperators: boolean;
|
|
347
|
-
[language].format.insertSpaceBeforeFunctionParenthesis: boolean;
|
|
348
|
-
[language].format.insertSpaceBeforeTypeAnnotation: boolean;
|
|
349
|
-
[language].format.newLineCharacter: string;
|
|
350
|
-
[language].format.placeOpenBraceOnNewLineForControlBlocks: boolean;
|
|
351
|
-
[language].format.placeOpenBraceOnNewLineForFunctions: boolean;
|
|
352
|
-
[language].format.semicolons: 'ignore' | 'insert' | 'remove';
|
|
353
|
-
[language].format.tabSize: number;
|
|
354
|
-
[language].format.trimTrailingWhitespace: boolean;
|
|
355
|
-
// Inlay Hints preferences
|
|
356
|
-
[language].inlayHints.includeInlayEnumMemberValueHints: boolean;
|
|
357
|
-
[language].inlayHints.includeInlayFunctionLikeReturnTypeHints: boolean;
|
|
358
|
-
[language].inlayHints.includeInlayFunctionParameterTypeHints: boolean;
|
|
359
|
-
[language].inlayHints.includeInlayParameterNameHints: 'none' | 'literals' | 'all';
|
|
360
|
-
[language].inlayHints.includeInlayParameterNameHintsWhenArgumentMatchesName: boolean;
|
|
361
|
-
[language].inlayHints.includeInlayPropertyDeclarationTypeHints: boolean;
|
|
362
|
-
[language].inlayHints.includeInlayVariableTypeHints: boolean;
|
|
363
|
-
[language].inlayHints.includeInlayVariableTypeHintsWhenTypeMatchesName: boolean;
|
|
364
|
-
/**
|
|
365
|
-
* Complete functions with their parameter signature.
|
|
366
|
-
*
|
|
367
|
-
* This functionality relies on LSP client resolving the completion using the `completionItem/resolve` call. If the
|
|
368
|
-
* client can't do that before inserting the completion then it's not safe to enable it as it will result in some
|
|
369
|
-
* completions having a snippet type without actually being snippets, which can then cause problems when inserting them.
|
|
370
|
-
*
|
|
371
|
-
* @default false
|
|
372
|
-
*/
|
|
373
|
-
completions.completeFunctionCalls: boolean;
|
|
374
|
-
// Diagnostics code to be omitted when reporting diagnostics.
|
|
375
|
-
// See https://github.com/microsoft/TypeScript/blob/master/src/compiler/diagnosticMessages.json for a full list of valid codes.
|
|
376
|
-
diagnostics.ignoredCodes: number[];
|
|
377
|
-
/**
|
|
378
|
-
* Enable/disable semantic checking of JavaScript files. Existing `jsconfig.json` or `tsconfig.json` files override this setting.
|
|
379
|
-
*
|
|
380
|
-
* @default false
|
|
381
|
-
*/
|
|
382
|
-
implicitProjectConfiguration.checkJs: boolean;
|
|
383
|
-
/**
|
|
384
|
-
* Enable/disable `experimentalDecorators` in JavaScript files that are not part of a project. Existing `jsconfig.json` or `tsconfig.json` files override this setting.
|
|
385
|
-
*
|
|
386
|
-
* @default false
|
|
387
|
-
*/
|
|
388
|
-
implicitProjectConfiguration.experimentalDecorators: boolean;
|
|
389
|
-
/**
|
|
390
|
-
* Sets the module system for the program. See more: https://www.typescriptlang.org/tsconfig#module.
|
|
391
|
-
*
|
|
392
|
-
* @default 'ESNext'
|
|
393
|
-
*/
|
|
394
|
-
implicitProjectConfiguration.module: string;
|
|
395
|
-
/**
|
|
396
|
-
* Enable/disable [strict function types](https://www.typescriptlang.org/tsconfig#strictFunctionTypes) in JavaScript and TypeScript files that are not part of a project. Existing `jsconfig.json` or `tsconfig.json` files override this setting.
|
|
397
|
-
*
|
|
398
|
-
* @default true
|
|
399
|
-
*/
|
|
400
|
-
implicitProjectConfiguration.strictFunctionTypes: boolean;
|
|
401
|
-
/**
|
|
402
|
-
* Enable/disable [strict null checks](https://www.typescriptlang.org/tsconfig#strictNullChecks) in JavaScript and TypeScript files that are not part of a project. Existing `jsconfig.json` or `tsconfig.json` files override this setting.
|
|
403
|
-
*
|
|
404
|
-
* @default true
|
|
405
|
-
*/
|
|
406
|
-
implicitProjectConfiguration.strictNullChecks: boolean;
|
|
407
|
-
/**
|
|
408
|
-
* Set target JavaScript language version for emitted JavaScript and include library declarations. See more: https://www.typescriptlang.org/tsconfig#target.
|
|
409
|
-
*
|
|
410
|
-
* @default 'ES2020'
|
|
411
|
-
*/
|
|
412
|
-
implicitProjectConfiguration.target: string;
|
|
413
|
-
```
|
|
70
|
+
## Features
|
|
414
71
|
|
|
415
|
-
|
|
72
|
+
### Code actions on save
|
|
416
73
|
|
|
417
74
|
Server announces support for the following code action kinds:
|
|
418
75
|
|
|
@@ -437,7 +94,7 @@ The user can enable it with a setting similar to (can vary per-editor):
|
|
|
437
94
|
}
|
|
438
95
|
```
|
|
439
96
|
|
|
440
|
-
|
|
97
|
+
### Workspace commands (`workspace/executeCommand`)
|
|
441
98
|
|
|
442
99
|
See [LSP specification](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#workspace_executeCommand).
|
|
443
100
|
|
|
@@ -445,7 +102,7 @@ Most of the time, you'll execute commands with arguments retrieved from another
|
|
|
445
102
|
|
|
446
103
|
`lsp` refers to the language server protocol types, `tsp` refers to the typescript server protocol types.
|
|
447
104
|
|
|
448
|
-
|
|
105
|
+
#### Go to Source Definition
|
|
449
106
|
|
|
450
107
|
- Request:
|
|
451
108
|
```ts
|
|
@@ -464,7 +121,7 @@ Most of the time, you'll execute commands with arguments retrieved from another
|
|
|
464
121
|
|
|
465
122
|
(This command is supported from Typescript 4.7.)
|
|
466
123
|
|
|
467
|
-
|
|
124
|
+
#### Apply Workspace Edits
|
|
468
125
|
|
|
469
126
|
- Request:
|
|
470
127
|
```ts
|
|
@@ -478,7 +135,7 @@ Most of the time, you'll execute commands with arguments retrieved from another
|
|
|
478
135
|
lsp.ApplyWorkspaceEditResult
|
|
479
136
|
```
|
|
480
137
|
|
|
481
|
-
|
|
138
|
+
#### Apply Code Action
|
|
482
139
|
|
|
483
140
|
- Request:
|
|
484
141
|
```ts
|
|
@@ -494,7 +151,7 @@ Most of the time, you'll execute commands with arguments retrieved from another
|
|
|
494
151
|
void
|
|
495
152
|
```
|
|
496
153
|
|
|
497
|
-
|
|
154
|
+
#### Apply Refactoring
|
|
498
155
|
|
|
499
156
|
- Request:
|
|
500
157
|
```ts
|
|
@@ -510,7 +167,7 @@ Most of the time, you'll execute commands with arguments retrieved from another
|
|
|
510
167
|
void
|
|
511
168
|
```
|
|
512
169
|
|
|
513
|
-
|
|
170
|
+
#### Organize Imports
|
|
514
171
|
|
|
515
172
|
- Request:
|
|
516
173
|
```ts
|
|
@@ -527,7 +184,7 @@ Most of the time, you'll execute commands with arguments retrieved from another
|
|
|
527
184
|
void
|
|
528
185
|
```
|
|
529
186
|
|
|
530
|
-
|
|
187
|
+
#### Rename File
|
|
531
188
|
|
|
532
189
|
- Request:
|
|
533
190
|
```ts
|
|
@@ -543,7 +200,7 @@ Most of the time, you'll execute commands with arguments retrieved from another
|
|
|
543
200
|
void
|
|
544
201
|
```
|
|
545
202
|
|
|
546
|
-
|
|
203
|
+
#### Configure plugin
|
|
547
204
|
|
|
548
205
|
- Request:
|
|
549
206
|
```ts
|
|
@@ -557,7 +214,39 @@ Most of the time, you'll execute commands with arguments retrieved from another
|
|
|
557
214
|
void
|
|
558
215
|
```
|
|
559
216
|
|
|
560
|
-
|
|
217
|
+
### Code Lenses (`textDocument/codeLens`)
|
|
218
|
+
|
|
219
|
+
Code lenses can be enabled using the `implementationsCodeLens` and `referencesCodeLens` [workspace configuration options](/docs/configuration.md/#workspacedidchangeconfiguration).
|
|
220
|
+
|
|
221
|
+
Code lenses provide a count of **references** and/or **implemenations** for symbols in the document. For clients that support it it's also possible to click on those to navigate to the relevant locations in the the project. Do note that clicking those trigger a `editor.action.showReferences` command which is something that client needs to have explicit support for. Many do by default but some don't. An example command will look like this:
|
|
222
|
+
|
|
223
|
+
```ts
|
|
224
|
+
command: {
|
|
225
|
+
title: '1 reference',
|
|
226
|
+
command: 'editor.action.showReferences',
|
|
227
|
+
arguments: [
|
|
228
|
+
'file://project/foo.ts', // URI
|
|
229
|
+
{ line: 1, character: 1 }, // Position
|
|
230
|
+
[ // A list of Location objects.
|
|
231
|
+
{
|
|
232
|
+
uri: 'file://project/bar.ts',
|
|
233
|
+
range: {
|
|
234
|
+
start: {
|
|
235
|
+
line: 7,
|
|
236
|
+
character: 24,
|
|
237
|
+
},
|
|
238
|
+
end: {
|
|
239
|
+
line: 7,
|
|
240
|
+
character: 28,
|
|
241
|
+
},
|
|
242
|
+
},
|
|
243
|
+
},
|
|
244
|
+
],
|
|
245
|
+
],
|
|
246
|
+
}
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
### Inlay hints (`textDocument/inlayHint`)
|
|
561
250
|
|
|
562
251
|
For the request to return any results, some or all of the following options need to be enabled through `preferences`:
|
|
563
252
|
|
|
@@ -574,7 +263,7 @@ export interface InlayHintsOptions extends UserPreferences {
|
|
|
574
263
|
}
|
|
575
264
|
```
|
|
576
265
|
|
|
577
|
-
|
|
266
|
+
### TypeScript Version Notification
|
|
578
267
|
|
|
579
268
|
Right after initializing, the server sends a custom `$/typescriptVersion` notification that carries information about the version of TypeScript that is utilized by the server. The editor can then display that information in the UI.
|
|
580
269
|
|
|
@@ -583,35 +272,6 @@ The `$/typescriptVersion` notification params include two properties:
|
|
|
583
272
|
- `version` - a semantic version (for example `4.8.4`)
|
|
584
273
|
- `source` - a string specifying whether used TypeScript version comes from the local workspace (`workspace`), is explicitly specified through a `initializationOptions.tsserver.path` setting (`user-setting`) or was bundled with the server (`bundled`)
|
|
585
274
|
|
|
586
|
-
## Supported Protocol features
|
|
587
|
-
|
|
588
|
-
- [x] textDocument/codeAction
|
|
589
|
-
- [x] textDocument/completion (incl. `completion/resolve`)
|
|
590
|
-
- [x] textDocument/definition
|
|
591
|
-
- [x] textDocument/didChange (incremental)
|
|
592
|
-
- [x] textDocument/didClose
|
|
593
|
-
- [x] textDocument/didOpen
|
|
594
|
-
- [x] textDocument/didSave
|
|
595
|
-
- [x] textDocument/documentHighlight
|
|
596
|
-
- [x] textDocument/documentSymbol
|
|
597
|
-
- [x] textDocument/executeCommand
|
|
598
|
-
- [x] textDocument/formatting
|
|
599
|
-
- [x] textDocument/hover
|
|
600
|
-
- [x] textDocument/inlayHint (no support for `inlayHint/resolve` or `workspace/inlayHint/refresh`)
|
|
601
|
-
- [x] textDocument/linkedEditingRange
|
|
602
|
-
- [x] textDocument/prepareCallHierarchy
|
|
603
|
-
- [x] callHierarchy/incomingCalls
|
|
604
|
-
- [x] callHierarchy/outgoingCalls
|
|
605
|
-
- [x] textDocument/prepareRename
|
|
606
|
-
- [x] textDocument/rangeFormatting
|
|
607
|
-
- [x] textDocument/references
|
|
608
|
-
- [x] textDocument/rename
|
|
609
|
-
- [x] textDocument/selectionRange
|
|
610
|
-
- [x] textDocument/signatureHelp
|
|
611
|
-
- [x] workspace/symbol
|
|
612
|
-
- [x] workspace/didChangeConfiguration
|
|
613
|
-
- [x] workspace/executeCommand
|
|
614
|
-
|
|
615
275
|
## Development
|
|
616
276
|
|
|
617
277
|
### Build
|
|
@@ -635,4 +295,11 @@ yarn watch
|
|
|
635
295
|
|
|
636
296
|
### Publishing
|
|
637
297
|
|
|
638
|
-
|
|
298
|
+
The project uses https://github.com/google-github-actions/release-please-action Github action to automatically release new version on merging a release PR.
|
|
299
|
+
|
|
300
|
+
[npm-version-src]: https://img.shields.io/npm/dt/typescript-language-server.svg?style=flat-square
|
|
301
|
+
[npm-version-href]: https://npmjs.com/package/typescript-language-server
|
|
302
|
+
[npm-downloads-src]: https://img.shields.io/npm/v/typescript-language-server/latest.svg?style=flat-square
|
|
303
|
+
[npm-downloads-href]: https://npmjs.com/package/typescript-language-server
|
|
304
|
+
[discord-src]: https://img.shields.io/discord/873659987413573634?style=flat-square
|
|
305
|
+
[discord-href]: https://discord.gg/AC7Vs6hwFa
|