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.
Цей коміт міститься в:
l0ng-ai authored and GitHub committed 2026-10-31 01:49:00 +08:00
1 джерело a3cd99db1f
коміт 8fabf054ef
16 files changed
+393 -1

No files matched your search

+2
Переглянути файл
@@ -10,6 +10,7 @@ tree-sitter = "javascript"
[[language-servers]]
name = "vtsls"
tsserver-project = true
command = "vtsls"
args = ["--stdio"]
root-markers = ["jsconfig.json", "tsconfig.json", "package.json"]
@@ -17,6 +18,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"