Files
openidea/languages/vue.toml
Jaw 410761e0f7 fix(lsp): register .vue files and Vue CLI aliases in config-less tsserver projects (#1771)
In a Vue CLI project without jsconfig.json, tsserver only knew the files that
were opened: usage counts said "no usages" for code used from unopened .vue
files, and `@/` imports resolved to nothing, so a mixin imported that way made
the component's whole `this` `any` and Go to Declaration failed in the same file.

The tsserver project registered for config-less trees now also serves Vue
(vtsls of vue.toml), includes the files the Vue tsserver plugin handles, and maps
the webpack aliases that @vue/cli-service resolves (else Vue CLI's `@` -> `src`).
Until vtsls has diagnostics for an open file it answers from its syntax server,
so the server reports loading meanwhile and empty usage counts are asked again.
2026-11-07 02:25:29 +08:00

49 lines
1.7 KiB
TOML

id = "vue"
name = "Vue"
formatter = { tool = "prettier", parser = "vue", range = true }
extensions = ["vue"]
block-comment = ["<!--", "-->"]
indent = { tab-size = 2, insert-spaces = true }
ui-mode = "Vue"
[[language-servers]]
name = "vue-language-server"
command = "vue-language-server"
args = ["--stdio"]
root-markers = ["package.json", "vite.config.ts", "vite.config.js", "nuxt.config.ts", "tsconfig.json"]
install-hint = "npm i -g @vue/language-server typescript@6"
# Hybrid mode: TypeScript in `.vue` files comes from tsserver with
# `@vue/typescript-plugin` (configured by the settings hook); vue-language-server
# reaches it through `tsserver/request`, which the client forwards to vtsls.
[[language-servers]]
name = "vtsls"
tsserver-project = true
command = "vtsls"
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
# Moving a file: the IDE asks for the import updates up front (preview, undo); the server
# doesn't prompt after the move.
[language-servers.initialization-options.typescript.updateImportsOnFileMove]
enabled = "never"
[language-servers.initialization-options.javascript.updateImportsOnFileMove]
enabled = "never"
[[language-servers]]
name = "oxlint"
command = "oxlint"
args = ["--lsp"]
root-markers = [".oxlintrc.json", ".oxlintrc.jsonc", "oxlint.config.ts", "oxlint.config.mts"]
require-root-marker = true
install-hint = "npm i -D oxlint"