typescript-language-server 5.1.0 → 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 CHANGED
@@ -1,6 +1,13 @@
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
+
4
11
  ## [5.1.0](https://github.com/typescript-language-server/typescript-language-server/compare/v5.0.1...v5.1.0) (2025-10-31)
5
12
 
6
13
 
package/README.md CHANGED
@@ -156,7 +156,7 @@ Request:
156
156
  {
157
157
  command: '_typescript.organizeImports'
158
158
  arguments: [
159
- string, // file URI
159
+ string, // file path
160
160
  // Optional options:
161
161
  {
162
162
  // @deprecated - use "mode". Supported from Typescript 4.4+.
@@ -305,7 +305,7 @@ The `$/typescriptVersion` notification params include two properties:
305
305
 
306
306
  ### Workspace Configuration request for formatting settings
307
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:
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
309
 
310
310
  ```js
311
311
  {
package/lib/cli.mjs CHANGED
@@ -21494,10 +21494,14 @@ class FileConfigurationManager {
21494
21494
  }
21495
21495
  async getFormattingOptions(document) {
21496
21496
  const formatConfiguration = await this.lspClient.getWorkspaceConfiguration(document.uri.toString(), 'formattingOptions') || {};
21497
- return {
21498
- tabSize: typeof formatConfiguration.tabSize === 'number' ? formatConfiguration.tabSize : undefined,
21499
- insertSpaces: typeof formatConfiguration.insertSpaces === 'boolean' ? formatConfiguration.insertSpaces : undefined
21500
- };
21497
+ const options = {};
21498
+ if (typeof formatConfiguration.tabSize === 'number') {
21499
+ options.tabSize = formatConfiguration.tabSize;
21500
+ }
21501
+ if (typeof formatConfiguration.insertSpaces === 'boolean') {
21502
+ options.insertSpaces = formatConfiguration.insertSpaces;
21503
+ }
21504
+ return options;
21501
21505
  }
21502
21506
  async ensureConfigurationOptions(document, options, token) {
21503
21507
  const currentOptions = this.getFileOptions(document, options);
@@ -23580,7 +23584,6 @@ class LspServer {
23580
23584
  const uri = this.tsClient.toResourceUri(cachedData.file);
23581
23585
  document = this.tsClient.toOpenDocument(uri);
23582
23586
  if (document) {
23583
- await this.fileConfigurationManager.ensureConfigurationForDocument(document, token);
23584
23587
  const response = await this.tsClient.interruptGetErr(() => this.tsClient.execute(CommandTypes.CompletionDetails, cachedData, token));
23585
23588
  if (response.type !== 'response' || !response.body?.length) {
23586
23589
  return item;