Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(lsp): ignore errors on ambient module imports (#27855)
This makes it so imports of ambient modules (e.g. `$app/environment` in svelte, any virtual module in vite, or other module provided by a bundler) don't error in the LSP. The way this works is that when we request diagnostics from TSC, we also respond with the list of ambient modules. Then, in the diagnostics code, we save diagnostics (produced by deno) that may be invalidated as an ambient module and wait to publish the diagnostics until we've received the ambient modules from TSC. The actual ambient modules you get from TSC can contain globs, e.g. `*.css`. So when we get new ambient modules, we compile them all into a regex and check erroring imports against that regex. Ambient modules should change rarely, so in most cases we should be using a pre-compiled regex, which executes in linear time (wrt the specifier length). TODO: - Ideally we should only publish once, right now we publish with the filtered specifiers and then the TSC ones - deno check (#27633)
- Loading branch information