typescript-language-server 5.0.1 → 5.1.1
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 +15 -0
- package/README.md +119 -80
- package/lib/cli.mjs +206 -90
- package/lib/cli.mjs.map +1 -1
- package/package.json +15 -15
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,21 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
All notable changes to this project will be documented in this file.
|
|
3
3
|
|
|
4
|
+
## [5.1.1](https://github.com/typescript-language-server/typescript-language-server/compare/v5.1.0...v5.1.1) (2025-11-05)
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
### Bug Fixes
|
|
8
|
+
|
|
9
|
+
* don't override formatting options with undefined values ([#1041](https://github.com/typescript-language-server/typescript-language-server/issues/1041)) ([4645124](https://github.com/typescript-language-server/typescript-language-server/commit/464512454a1f68bb6f1e270cf5c0c2be13cdaa54))
|
|
10
|
+
|
|
11
|
+
## [5.1.0](https://github.com/typescript-language-server/typescript-language-server/compare/v5.0.1...v5.1.0) (2025-10-31)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Features
|
|
15
|
+
|
|
16
|
+
* 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))
|
|
17
|
+
* 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))
|
|
18
|
+
|
|
4
19
|
## [5.0.1](https://github.com/typescript-language-server/typescript-language-server/compare/v5.0.0...v5.0.1) (2025-10-07)
|
|
5
20
|
|
|
6
21
|
|
package/README.md
CHANGED
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
- [Code Lenses \(`textDocument/codeLens`\)](#code-lenses-textdocumentcodelens)
|
|
24
24
|
- [Inlay hints \(`textDocument/inlayHint`\)](#inlay-hints-textdocumentinlayhint)
|
|
25
25
|
- [TypeScript Version Notification](#typescript-version-notification)
|
|
26
|
+
- [Workspace Configuration request for formatting settings](#workspace-configuration-request-for-formatting-settings)
|
|
26
27
|
- [Development](#development)
|
|
27
28
|
- [Build](#build)
|
|
28
29
|
- [Dev](#dev)
|
|
@@ -108,89 +109,112 @@ Most of the time, you'll execute commands with arguments retrieved from another
|
|
|
108
109
|
|
|
109
110
|
#### Go to Source Definition
|
|
110
111
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
112
|
+
Request:
|
|
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
|
+
|
|
124
|
+
Response:
|
|
125
|
+
|
|
126
|
+
```ts
|
|
127
|
+
lsp.Location[] | null
|
|
128
|
+
```
|
|
125
129
|
|
|
126
130
|
(This command is supported from Typescript 4.7.)
|
|
127
131
|
|
|
128
132
|
#### Apply Refactoring
|
|
129
133
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
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
|
+
```
|
|
143
150
|
|
|
144
151
|
#### Organize Imports
|
|
145
152
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
153
|
+
Request:
|
|
154
|
+
|
|
155
|
+
```ts
|
|
156
|
+
{
|
|
157
|
+
command: '_typescript.organizeImports'
|
|
158
|
+
arguments: [
|
|
159
|
+
string, // file path
|
|
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
|
+
```
|
|
160
178
|
|
|
161
179
|
#### Rename File
|
|
162
180
|
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
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
|
+
```
|
|
176
197
|
|
|
177
198
|
#### Send Tsserver Command
|
|
178
199
|
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
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
|
+
```
|
|
194
218
|
|
|
195
219
|
The `ExecuteInfo` object is defined as follows:
|
|
196
220
|
|
|
@@ -205,17 +229,20 @@ type ExecuteInfo = {
|
|
|
205
229
|
|
|
206
230
|
#### Configure plugin
|
|
207
231
|
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
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
|
+
```
|
|
219
246
|
|
|
220
247
|
### Code Lenses (`textDocument/codeLens`)
|
|
221
248
|
|
|
@@ -275,6 +302,18 @@ The `$/typescriptVersion` notification params include two properties:
|
|
|
275
302
|
- `version` - a semantic version (for example `4.8.4`)
|
|
276
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`)
|
|
277
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 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
|
+
|
|
278
317
|
## Development
|
|
279
318
|
|
|
280
319
|
### Build
|