From a0dfb1e741e68af08b8d5f01f3b08e23fe5d2680 Mon Sep 17 00:00:00 2001 From: l0ng-ai <24760907+l0ng-ai@users.noreply.github.com> Date: Wed, 4 Nov 2026 23:32:58 +0800 Subject: [PATCH] fix(lsp): rename TypeScript symbols everywhere instead of aliasing the import (#1302) Renaming an imported function at a call site renamed only the local binding, leaving `import { formatMoney as formatPrice }` and the declaration as it was: both TypeScript servers default to aliases on rename. vtsls gets `typescript.preferences.useAliasesForRenames = false` (and the JavaScript one), typescript-language-server `providePrefixAndSuffixTextForRename = false`, in every language that starts them. --- languages/javascript.toml | 11 +++++++++++ languages/javascriptreact.toml | 11 +++++++++++ languages/typescript.toml | 11 +++++++++++ languages/typescriptreact.toml | 11 +++++++++++ languages/vue.toml | 7 +++++++ 5 files changed, 51 insertions(+) diff --git a/languages/javascript.toml b/languages/javascript.toml index 5f19df869..8d31fefe9 100644 --- a/languages/javascript.toml +++ b/languages/javascript.toml @@ -17,6 +17,13 @@ args = ["--stdio"] root-markers = ["jsconfig.json", "tsconfig.json", "package.json"] install-hint = "npm i -g @vtsls/language-server" +# Rename renames the symbol everywhere: no `import { a as b }` alias in the file renamed from. +[language-servers.initialization-options.typescript.preferences] +useAliasesForRenames = false + +[language-servers.initialization-options.javascript.preferences] +useAliasesForRenames = false + [[language-servers]] name = "typescript-language-server" tsserver-project = true @@ -27,6 +34,10 @@ args = ["--stdio"] root-markers = ["jsconfig.json", "tsconfig.json", "package.json"] install-hint = "npm i -g typescript@6 typescript-language-server" +# Rename renames the symbol everywhere: no `import { a as b }` alias in the file renamed from. +[language-servers.initialization-options.preferences] +providePrefixAndSuffixTextForRename = false + [[language-servers]] name = "oxlint" command = "oxlint" diff --git a/languages/javascriptreact.toml b/languages/javascriptreact.toml index be5b5ab90..d3c6c57df 100644 --- a/languages/javascriptreact.toml +++ b/languages/javascriptreact.toml @@ -16,6 +16,13 @@ args = ["--stdio"] root-markers = ["jsconfig.json", "tsconfig.json", "package.json"] install-hint = "npm i -g @vtsls/language-server" +# Rename renames the symbol everywhere: no `import { a as b }` alias in the file renamed from. +[language-servers.initialization-options.typescript.preferences] +useAliasesForRenames = false + +[language-servers.initialization-options.javascript.preferences] +useAliasesForRenames = false + [[language-servers]] name = "typescript-language-server" tsserver-project = true @@ -26,6 +33,10 @@ args = ["--stdio"] root-markers = ["jsconfig.json", "tsconfig.json", "package.json"] install-hint = "npm i -g typescript@6 typescript-language-server" +# Rename renames the symbol everywhere: no `import { a as b }` alias in the file renamed from. +[language-servers.initialization-options.preferences] +providePrefixAndSuffixTextForRename = false + [[language-servers]] name = "oxlint" command = "oxlint" diff --git a/languages/typescript.toml b/languages/typescript.toml index 0dedc17ad..c0da45953 100644 --- a/languages/typescript.toml +++ b/languages/typescript.toml @@ -16,6 +16,13 @@ args = ["--stdio"] root-markers = ["tsconfig.json", "jsconfig.json", "package.json"] install-hint = "npm i -g @vtsls/language-server" +# Rename renames the symbol everywhere: no `import { a as b }` alias in the file renamed from. +[language-servers.initialization-options.typescript.preferences] +useAliasesForRenames = false + +[language-servers.initialization-options.javascript.preferences] +useAliasesForRenames = false + [[language-servers]] name = "typescript-language-server" tsserver-project = true @@ -26,6 +33,10 @@ args = ["--stdio"] root-markers = ["tsconfig.json", "jsconfig.json", "package.json"] install-hint = "npm i -g typescript@6 typescript-language-server" +# Rename renames the symbol everywhere: no `import { a as b }` alias in the file renamed from. +[language-servers.initialization-options.preferences] +providePrefixAndSuffixTextForRename = false + # Angular projects only: templates inline in components (`template: ...`), # and their usages and renames in templates. Last: TypeScript's own hover, # definition and symbols come first. diff --git a/languages/typescriptreact.toml b/languages/typescriptreact.toml index d7ecf0b8c..82a1a5bcd 100644 --- a/languages/typescriptreact.toml +++ b/languages/typescriptreact.toml @@ -16,6 +16,13 @@ args = ["--stdio"] root-markers = ["tsconfig.json", "jsconfig.json", "package.json"] install-hint = "npm i -g @vtsls/language-server" +# Rename renames the symbol everywhere: no `import { a as b }` alias in the file renamed from. +[language-servers.initialization-options.typescript.preferences] +useAliasesForRenames = false + +[language-servers.initialization-options.javascript.preferences] +useAliasesForRenames = false + [[language-servers]] name = "typescript-language-server" tsserver-project = true @@ -26,6 +33,10 @@ args = ["--stdio"] root-markers = ["tsconfig.json", "jsconfig.json", "package.json"] install-hint = "npm i -g typescript@6 typescript-language-server" +# Rename renames the symbol everywhere: no `import { a as b }` alias in the file renamed from. +[language-servers.initialization-options.preferences] +providePrefixAndSuffixTextForRename = false + [[language-servers]] name = "oxlint" command = "oxlint" diff --git a/languages/vue.toml b/languages/vue.toml index 247f09303..2f1b2d73c 100644 --- a/languages/vue.toml +++ b/languages/vue.toml @@ -23,6 +23,13 @@ args = ["--stdio"] root-markers = ["tsconfig.json", "jsconfig.json", "package.json"] install-hint = "npm i -g @vtsls/language-server" +# Rename renames the symbol everywhere: no `import { a as b }` alias in the file renamed from. +[language-servers.initialization-options.typescript.preferences] +useAliasesForRenames = false + +[language-servers.initialization-options.javascript.preferences] +useAliasesForRenames = false + [[language-servers]] name = "oxlint" command = "oxlint"