mirror of
https://github.com/l0ng-ai/openidea.git
synced 2026-11-06 08:07:49 +00:00
fix(lsp): offer auto-imports from unopened files in projects without a tsconfig (#496)
Without a tsconfig.json or jsconfig.json, tsserver's inferred project holds only open files and what they import, so completion never offered exports from other files. Register the project's sources with tsserver as an external project, using the options an inferred project assumes, so no file is written to disk. Registration needs `typescript.tsserverRequest`. Projects with a configuration, including one in a subfolder, stay as they were, and so do trees over 10,000 sources or 16 MiB of JavaScript, since tsserver disables its language service past 20 MiB. Created and deleted files update the project, and unopened files stay out of Problems.
This commit is contained in:
@@ -9,6 +9,7 @@ tree-sitter = "javascript"
|
||||
|
||||
[[language-servers]]
|
||||
name = "vtsls"
|
||||
tsserver-project = true
|
||||
command = "vtsls"
|
||||
args = ["--stdio"]
|
||||
root-markers = ["jsconfig.json", "tsconfig.json", "package.json"]
|
||||
@@ -16,6 +17,7 @@ install-hint = "npm i -g @vtsls/language-server"
|
||||
|
||||
[[language-servers]]
|
||||
name = "typescript-language-server"
|
||||
tsserver-project = true
|
||||
# Alternative: used only when the server above is not installed.
|
||||
fallback = true
|
||||
command = "typescript-language-server"
|
||||
|
||||
Reference in New Issue
Block a user