typescript-language-server 5.0.0 → 5.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 +16 -0
- package/README.md +119 -112
- package/lib/cli.mjs +1022 -344
- package/lib/cli.mjs.map +1 -1
- package/package.json +18 -18
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,22 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
All notable changes to this project will be documented in this file.
|
|
3
3
|
|
|
4
|
+
## [5.1.0](https://github.com/typescript-language-server/typescript-language-server/compare/v5.0.1...v5.1.0) (2025-10-31)
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
### Features
|
|
8
|
+
|
|
9
|
+
* request file-specific formatting options ([#1034](https://github.com/typescript-language-server/typescript-language-server/issues/1034)) ([de89dd3](https://github.com/typescript-language-server/typescript-language-server/commit/de89dd34b27d9dd65b9c3823ad2ddae06eb73c47))
|
|
10
|
+
* support passing "mode" to organize imports command ([#1036](https://github.com/typescript-language-server/typescript-language-server/issues/1036)) ([a7c24b8](https://github.com/typescript-language-server/typescript-language-server/commit/a7c24b85a4503f320aa78fb12ea6cb3f81186b28))
|
|
11
|
+
|
|
12
|
+
## [5.0.1](https://github.com/typescript-language-server/typescript-language-server/compare/v5.0.0...v5.0.1) (2025-10-07)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
* **deps:** update devdependency typescript to ^5.9.3 ([#1017](https://github.com/typescript-language-server/typescript-language-server/issues/1017)) ([44f8778](https://github.com/typescript-language-server/typescript-language-server/commit/44f87786a49b9810ac975973fbb5bdeebcdde022))
|
|
18
|
+
* improve code actions support ([#1018](https://github.com/typescript-language-server/typescript-language-server/issues/1018)) ([8591c0a](https://github.com/typescript-language-server/typescript-language-server/commit/8591c0a9e539b8de2340f6c9bf258db6f6eeea3e))
|
|
19
|
+
|
|
4
20
|
## [5.0.0](https://github.com/typescript-language-server/typescript-language-server/compare/v4.4.1...v5.0.0) (2025-09-15)
|
|
5
21
|
|
|
6
22
|
|
package/README.md
CHANGED
|
@@ -15,8 +15,6 @@
|
|
|
15
15
|
- [Code actions on save](#code-actions-on-save)
|
|
16
16
|
- [Workspace commands \(`workspace/executeCommand`\)](#workspace-commands-workspaceexecutecommand)
|
|
17
17
|
- [Go to Source Definition](#go-to-source-definition)
|
|
18
|
-
- [Apply Workspace Edits](#apply-workspace-edits)
|
|
19
|
-
- [Apply Code Action](#apply-code-action)
|
|
20
18
|
- [Apply Refactoring](#apply-refactoring)
|
|
21
19
|
- [Organize Imports](#organize-imports)
|
|
22
20
|
- [Rename File](#rename-file)
|
|
@@ -25,6 +23,7 @@
|
|
|
25
23
|
- [Code Lenses \(`textDocument/codeLens`\)](#code-lenses-textdocumentcodelens)
|
|
26
24
|
- [Inlay hints \(`textDocument/inlayHint`\)](#inlay-hints-textdocumentinlayhint)
|
|
27
25
|
- [TypeScript Version Notification](#typescript-version-notification)
|
|
26
|
+
- [Workspace Configuration request for formatting settings](#workspace-configuration-request-for-formatting-settings)
|
|
28
27
|
- [Development](#development)
|
|
29
28
|
- [Build](#build)
|
|
30
29
|
- [Dev](#dev)
|
|
@@ -110,119 +109,112 @@ Most of the time, you'll execute commands with arguments retrieved from another
|
|
|
110
109
|
|
|
111
110
|
#### Go to Source Definition
|
|
112
111
|
|
|
113
|
-
|
|
114
|
-
```ts
|
|
115
|
-
{
|
|
116
|
-
command: `_typescript.goToSourceDefinition`
|
|
117
|
-
arguments: [
|
|
118
|
-
lsp.DocumentUri, // String URI of the document
|
|
119
|
-
lsp.Position, // Line and character position (zero-based)
|
|
120
|
-
]
|
|
121
|
-
}
|
|
122
|
-
```
|
|
123
|
-
- Response:
|
|
124
|
-
```ts
|
|
125
|
-
lsp.Location[] | null
|
|
126
|
-
```
|
|
112
|
+
Request:
|
|
127
113
|
|
|
128
|
-
|
|
114
|
+
```ts
|
|
115
|
+
{
|
|
116
|
+
command: '_typescript.goToSourceDefinition'
|
|
117
|
+
arguments: [
|
|
118
|
+
lsp.DocumentUri, // String URI of the document
|
|
119
|
+
lsp.Position, // Line and character position (zero-based)
|
|
120
|
+
]
|
|
121
|
+
}
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
Response:
|
|
125
|
+
|
|
126
|
+
```ts
|
|
127
|
+
lsp.Location[] | null
|
|
128
|
+
```
|
|
129
129
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
- Request:
|
|
133
|
-
```ts
|
|
134
|
-
{
|
|
135
|
-
command: `_typescript.applyWorkspaceEdit`
|
|
136
|
-
arguments: [lsp.WorkspaceEdit]
|
|
137
|
-
}
|
|
138
|
-
```
|
|
139
|
-
- Response:
|
|
140
|
-
```ts
|
|
141
|
-
lsp.ApplyWorkspaceEditResult
|
|
142
|
-
```
|
|
143
|
-
|
|
144
|
-
#### Apply Code Action
|
|
145
|
-
|
|
146
|
-
- Request:
|
|
147
|
-
```ts
|
|
148
|
-
{
|
|
149
|
-
command: `_typescript.applyCodeAction`
|
|
150
|
-
arguments: [
|
|
151
|
-
tsp.CodeAction, // TypeScript Code Action object
|
|
152
|
-
]
|
|
153
|
-
}
|
|
154
|
-
```
|
|
155
|
-
- Response:
|
|
156
|
-
```ts
|
|
157
|
-
void
|
|
158
|
-
```
|
|
130
|
+
(This command is supported from Typescript 4.7.)
|
|
159
131
|
|
|
160
132
|
#### Apply Refactoring
|
|
161
133
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
134
|
+
Request:
|
|
135
|
+
|
|
136
|
+
```ts
|
|
137
|
+
{
|
|
138
|
+
command: '_typescript.applyRefactoring'
|
|
139
|
+
arguments: [
|
|
140
|
+
tsp.GetEditsForRefactorRequestArgs,
|
|
141
|
+
]
|
|
142
|
+
}
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
Response:
|
|
146
|
+
|
|
147
|
+
```ts
|
|
148
|
+
void
|
|
149
|
+
```
|
|
175
150
|
|
|
176
151
|
#### Organize Imports
|
|
177
152
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
153
|
+
Request:
|
|
154
|
+
|
|
155
|
+
```ts
|
|
156
|
+
{
|
|
157
|
+
command: '_typescript.organizeImports'
|
|
158
|
+
arguments: [
|
|
159
|
+
string, // file URI
|
|
160
|
+
// Optional options:
|
|
161
|
+
{
|
|
162
|
+
// @deprecated - use "mode". Supported from Typescript 4.4+.
|
|
163
|
+
skipDestructiveCodeActions?: boolean
|
|
164
|
+
// 'All' - organizes imports including destructive actions (removing unused imports)
|
|
165
|
+
// 'SortAndCombine' - Doesn't perform destructive actions.
|
|
166
|
+
// 'RemoveUnused' - Only removes unused imports.
|
|
167
|
+
mode?: 'All' | 'SortAndCombine' | 'RemoveUnused'
|
|
168
|
+
},
|
|
169
|
+
]
|
|
170
|
+
}
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
Response:
|
|
174
|
+
|
|
175
|
+
```ts
|
|
176
|
+
void
|
|
177
|
+
```
|
|
192
178
|
|
|
193
179
|
#### Rename File
|
|
194
180
|
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
181
|
+
Request:
|
|
182
|
+
|
|
183
|
+
```ts
|
|
184
|
+
{
|
|
185
|
+
command: '_typescript.applyRenameFile'
|
|
186
|
+
arguments: [
|
|
187
|
+
{ sourceUri: string; targetUri: string; },
|
|
188
|
+
]
|
|
189
|
+
}
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
Response:
|
|
193
|
+
|
|
194
|
+
```ts
|
|
195
|
+
void
|
|
196
|
+
```
|
|
208
197
|
|
|
209
198
|
#### Send Tsserver Command
|
|
210
199
|
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
200
|
+
Request:
|
|
201
|
+
|
|
202
|
+
```ts
|
|
203
|
+
{
|
|
204
|
+
command: 'typescript.tsserverRequest'
|
|
205
|
+
arguments: [
|
|
206
|
+
string, // command
|
|
207
|
+
any, // command arguments in a format that the command expects
|
|
208
|
+
ExecuteInfo, // configuration object used for the tsserver request (see below)
|
|
209
|
+
]
|
|
210
|
+
}
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
Response:
|
|
214
|
+
|
|
215
|
+
```ts
|
|
216
|
+
any
|
|
217
|
+
```
|
|
226
218
|
|
|
227
219
|
The `ExecuteInfo` object is defined as follows:
|
|
228
220
|
|
|
@@ -237,17 +229,20 @@ type ExecuteInfo = {
|
|
|
237
229
|
|
|
238
230
|
#### Configure plugin
|
|
239
231
|
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
232
|
+
Request:
|
|
233
|
+
|
|
234
|
+
```ts
|
|
235
|
+
{
|
|
236
|
+
command: '_typescript.configurePlugin'
|
|
237
|
+
arguments: [pluginName: string, configuration: any]
|
|
238
|
+
}
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
Response:
|
|
242
|
+
|
|
243
|
+
```ts
|
|
244
|
+
void
|
|
245
|
+
```
|
|
251
246
|
|
|
252
247
|
### Code Lenses (`textDocument/codeLens`)
|
|
253
248
|
|
|
@@ -307,6 +302,18 @@ The `$/typescriptVersion` notification params include two properties:
|
|
|
307
302
|
- `version` - a semantic version (for example `4.8.4`)
|
|
308
303
|
- `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`)
|
|
309
304
|
|
|
305
|
+
|
|
306
|
+
### Workspace Configuration request for formatting settings
|
|
307
|
+
|
|
308
|
+
Server asks the client for file-specific configuration options (`tabSize` and `insertSpaces`) that are required by `tsserver` to properly format the file edits when for example using "Organize imports" or performing other file modifications. Those options have to be dynamically provided by the client/editor since the values can differ for each file. For this reason server sends a `workspace/configuration` request with `scopeUri` equal to file's URI and `section` equal to `formattingOptions`. The client is expected to return a configuration that includes the following properties:
|
|
309
|
+
|
|
310
|
+
```js
|
|
311
|
+
{
|
|
312
|
+
"tabSize": number
|
|
313
|
+
"insertSpaces": boolean
|
|
314
|
+
}
|
|
315
|
+
```
|
|
316
|
+
|
|
310
317
|
## Development
|
|
311
318
|
|
|
312
319
|
### Build
|