Skip to content

Commit 4fbc394

Browse files
Add support for JS/TS import module specifier ending preferences
These settings change the preferred path ending for auto imports.
1 parent 5298775 commit 4fbc394

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

CHANGELOG.org

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
* Added a new optional ~:action-filter~ argument when defining LSP clients that allows code action requests to be modified before they are sent to the server. This is used by the Haskell language server client to work around an ~lsp-mode~ parsing quirk that incorrectly sends ~null~ values instead of ~false~ in code action requests.
99
* Add support for C# via the [[https://github.com/dotnet/roslyn/tree/main/src/LanguageServer][Roslyn language server]].
1010
* Add basic support for [[https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_pullDiagnostics][pull diagnostics]] requests.
11+
* Add support for the ~javascript.preferences.importModuleSpecifierEnding~ and ~typescript.preferences.importModuleSpecifierEnding~ preferences.
1112

1213
** 9.0.0
1314
* Add language server config for QML (Qt Modeling Language) using qmlls.

clients/lsp-javascript.el

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -545,6 +545,26 @@ workspace."
545545
(const "non-relative"))
546546
:package-version '(lsp-mode . "6.1"))
547547

548+
(defcustom lsp-javascript-preferences-import-module-specifier-ending "auto"
549+
"Preferred path ending for auto imports.
550+
Requires using TypeScript 4.5+ in the workspace."
551+
:type '(choice
552+
(const "auto")
553+
(const "minimal")
554+
(const "index")
555+
(const "js"))
556+
:package-version '(lsp-mode . "9.0.1"))
557+
558+
(defcustom lsp-typescript-preferences-import-module-specifier-ending "auto"
559+
"Preferred path ending for auto imports.
560+
Requires using TypeScript 4.5+ in the workspace."
561+
:type '(choice
562+
(const "auto")
563+
(const "minimal")
564+
(const "index")
565+
(const "js"))
566+
:package-version '(lsp-mode . "9.0.1"))
567+
548568
(defcustom lsp-javascript-preferences-rename-shorthand-properties t
549569
"Enable/disable introducing aliases for object shorthand
550570
properties during renames. Requires using TypeScript 3.4 or newer
@@ -653,6 +673,7 @@ name (e.g. `data' variable passed as `data' parameter)."
653673
("javascript.implicitProjectConfig.checkJs" lsp-javascript-implicit-project-config-check-js t)
654674
("javascript.implicitProjectConfig.experimentalDecorators" lsp-javascript-implicit-project-config-experimental-decorators t)
655675
("javascript.preferences.importModuleSpecifier" lsp-javascript-preferences-import-module-specifier)
676+
("javascript.preferences.importModuleSpecifierEnding" lsp-javascript-preferences-import-module-specifier-ending)
656677
("javascript.preferences.quoteStyle" lsp-javascript-preferences-quote-style)
657678
("javascript.preferences.renameShorthandProperties" lsp-javascript-preferences-rename-shorthand-properties t)
658679
("javascript.referencesCodeLens.enabled" lsp-javascript-references-code-lens-enabled t)
@@ -688,6 +709,7 @@ name (e.g. `data' variable passed as `data' parameter)."
688709
("typescript.locale" lsp-typescript-locale)
689710
("typescript.npm" lsp-typescript-npm)
690711
("typescript.preferences.importModuleSpecifier" lsp-typescript-preferences-import-module-specifier)
712+
("typescript.preferences.importModuleSpecifierEnding" lsp-typescript-preferences-import-module-specifier-ending)
691713
("typescript.preferences.quoteStyle" lsp-typescript-preferences-quote-style)
692714
("typescript.preferences.renameShorthandProperties" lsp-typescript-preferences-rename-shorthand-properties t)
693715
("typescript.referencesCodeLens.enabled" lsp-typescript-references-code-lens-enabled t)

0 commit comments

Comments
 (0)