summaryrefslogtreecommitdiff
path: root/cli/lsp/diagnostics.rs
AgeCommit message (Collapse)Author
2023-12-07feat: add suggestions to module not found error messages for file urls (#21498)David Sherret
2023-12-07feat(unstable): ability to resolve specifiers with no extension, specifiers ↵David Sherret
for a directory, and TS files from JS extensions (#21464) Adds an `--unstable-sloppy-imports` flag which supports the following for `file:` specifiers: * Allows writing `./mod` in a specifier to do extension probing. - ex. `import { Example } from "./example"` instead of `import { Example } from "./example.ts"` * Allows writing `./routes` to do directory extension probing for files like `./routes/index.ts` * Allows writing `./mod.js` for *mod.ts* files. This functionality is **NOT RECOMMENDED** for general use with Deno: 1. It's not as optimal for perf: https://marvinh.dev/blog/speeding-up-javascript-ecosystem-part-2/ 1. It makes tooling in the ecosystem more complex in order to have to understand this. 1. The "Deno way" is to be explicit about what you're doing. It's better in the long run. 1. It doesn't work if published to the Deno registry because doing stuff like extension probing with remote specifiers would be incredibly slow. This is instead only recommended to help with migrating existing projects to Deno. For example, it's very useful for getting CJS projects written with import/export declaration working in Deno without modifying module specifiers and for supporting TS ESM projects written with `./mod.js` specifiers. This feature will output warnings to guide the user towards correcting their specifiers. Additionally, quick fixes are provided in the LSP to update these specifiers:
2023-12-03perf(lsp): check tsc request cancellation before execution (#21447)Nayeem Rahman
2023-12-02chore: update std to 0.208.0 (#21318)Asher Gomez
Re-attempt at #21284. I was more thorough this time. --------- Signed-off-by: Asher Gomez <ashersaupingomez@gmail.com>
2023-12-01refactor(lsp): log names (#21413)Bartek Iwańczuk
This commit changes LSP log names by prefixing them, we now have these prefixes: - `lsp.*` - requests coming from the client - `tsc.request.*` - requests coming from clients that are routed to TSC - `tsc.op.*` - ops called by the TS host - `tsc.host.*` - requests that call JavaScript runtime that runs TypeScript compiler host Additionall `Performance::mark` was split into `Performance::mark` and `Performance::mark_with_args` to reduce verbosity of code and logs.
2023-10-24perf(lsp): cleanup workspace settings scopes (#20937)Nayeem Rahman
2023-10-20feat(unstable): allow bare specifier for builtin node module (#20728)Yoshiya Hinosawa
closes #20566
2023-10-03refactor(npm): break up `NpmModuleLoader` and move more methods into the ↵David Sherret
managed `CliNpmResolver` (#20777) Part of https://github.com/denoland/deno/issues/18967
2023-09-29refactor(cli): make `CliNpmResolver` a trait (#20732)David Sherret
This makes `CliNpmResolver` a trait. The terminology used is: - **managed** - Deno manages the node_modules folder and does an auto-install (ex. `ManagedCliNpmResolver`) - **byonm** - "Bring your own node_modules" (ex. `ByonmCliNpmResolver`, which is in this PR, but unimplemented at the moment) Part of #18967
2023-09-28refactor(ext/node): remove dependency on deno_npm and deno_semver (#20718)David Sherret
This is required from BYONM (bring your own node_modules). Part of #18967
2023-09-26chore: slight cleanup in npm resolvers (#20692)David Sherret
2023-09-24feat(lsp): cache all dependencies quick fix (#20665)Nayeem Rahman
2023-09-24refactor(lsp): implement "deno.cacheOnSave" server-side (#20632)Nayeem Rahman
2023-09-24fix(lsp): show related information for tsc diagnostics (#20654)Nayeem Rahman
2023-09-13feat(lsp): WorkspaceSettings::disablePaths (#20475)Nayeem Rahman
2023-09-09fix(lsp): respect configured exclusions for testing APIs (#20427)Nayeem Rahman
LSP testing APIs now obey the various file inclusion settings: - Modules shown in the text explorer now respect the `exclude`, `test.exclude` and `test.include` fields in `deno.json`, as well as `deno.enablePaths` in VSCode settings. - Modules with testing code lens now respect the `"exclude"`, `test.exclude` and `test.include` fields in `deno.json`. Code lens already respects `deno.enablePaths`.
2023-09-09Reland "refactor(lsp): clean up "enablePaths" handling (#20388)" (#20423)Nayeem Rahman
2023-09-08Revert "refactor(lsp): clean up "enablePaths" handling (#20388)" (#20419)Nayeem Rahman
This reverts commit 4a11603c76b13ecf92ce3141ec317a42ae9f8d1d.
2023-09-08refactor(lsp): clean up "enablePaths" handling (#20388)Nayeem Rahman
Previously we pre-computed enabled paths into `Config::enabled_paths`, and had to keep updating it. Now we determine enabled paths directly from `Config::settings` on demand as a single source of truth. Removes `Config::root_uri`. If `InitializeParams::rootUri` is given, and it doesn't correspond to a folder in `InitializeParams::workspaceFolders`, prepend it to `Config::workspace_folders` as a mocked folder. Includes groundwork for https://github.com/denoland/vscode_deno/issues/908. In a minor version cycle or two we can fix that in vscode_deno, and it won't break for Deno versions post this patch due to the corrected deserialization logic for `enablePaths`.
2023-09-07feat: support import attributes (#20342)David Sherret
2023-09-05feat(lsp): provide the deno.cache command server-side (#20111)sigmaSd
Co-authored-by: Nayeem Rahman <nayeemrmn99@gmail.com>
2023-09-01Reland "feat(lsp): enable via config file detection (#20334)" (#20349)Nayeem Rahman
2023-09-01Revert "feat(lsp): enable via config file detection (#20334)" (#20347)Bartek Iwańczuk
This reverts commit c0dcf6a3571ee04b4826c52d1329804e7c2b02c4. CC @nayeemrmn
2023-08-31feat(lsp): enable via config file detection (#20334)Nayeem Rahman
With https://github.com/denoland/vscode_deno/pull/902 for https://github.com/denoland/vscode_deno/issues/880. For multi-folder workspaces, note that this only scans the first one and applies the result to all. That means users would have to still have to specify `"deno.enable": true/false` for their secondary folders if the preference is different for those.
2023-08-23fix(ext/web): add stream tests to detect v8slice split bug (#20253)Matt Mastracci
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-08-21refactor: upgrade deno_ast 0.28 and deno_semver 0.4 (#20193)David Sherret
2023-08-08refactor: use deno_cache_dir crate (#20092)David Sherret
Uses https://github.com/denoland/deno_cache/pull/26
2023-08-02feat(unstable/lsp): support navigating to deno_modules folder (#20030)David Sherret
Closes #20015 Closes https://github.com/denoland/vscode_deno/issues/850 (only for deno_modules, but I don't think this will be possible for the global cache)
2023-08-02feat(unstable): optional `deno_modules` directory (#19977)David Sherret
Closes #15633
2023-07-25refactor: simplify signature of diagnose_resolution (#19753)Martin Fischer
This commit makes the data flow in the `diagnose_dependency` function more obvious.
2023-07-11fix(lsp): stop diagnostics flickering (#19803)David Sherret
Closes https://github.com/denoland/vscode_deno/issues/835
2023-07-11refactor(lsp): update diagnostics.rs to use structs instead of records (#19799)David Sherret
Part of https://github.com/denoland/vscode_deno/issues/835
2023-07-11fix(lsp): remove quotes and period surrounding specifier in uncached ↵David Sherret
messages (#19794)
2023-07-08refactor: abstract away file system to be buried inside HttpCache (#19760)David Sherret
This improves the HttpCache to make it being stored on the file system an implementation detail.
2023-07-02Reland "fix(cli): don't store blob and data urls in the module cache" (#18581)Nayeem Rahman
Relands #18261 now that https://github.com/lucacasonato/esbuild_deno_loader/pull/54 is landed and used by fresh. Fixes #18260.
2023-06-10chore(tests): test_util - Add `PathRef` (#19450)David Sherret
This adds a new `PathRef` struct to test_util for making it easier to work with paths in test code. I'm going to expand on this more in the future.
2023-05-28refactor(core): remove ext: modules from the module map (#19040)Nayeem Rahman
Rather than disallowing `ext:` resolution, clear the module map after initializing extensions so extension modules are anonymized. This operation is explicitly called in `deno_runtime`. Re-inject `node:` specifiers into the module map after doing this. Fixes #17717.
2023-05-26chore(lsp/tests): diagnostic synchronization (reland) (#19270)David Sherret
Merge on approval as it fixes the flaky test.
2023-05-26Revert "chore(lsp/tests): diagnostic synchronization (#19264)" (#19268)Bartek Iwańczuk
This reverts commit 89026abe395c22eb2ace4ea5f948189daa1dadf1. This change caused LSP benchmarks to fail on `main`.
2023-05-26chore(lsp/tests): diagnostic synchronization (#19264)David Sherret
Fixes the flaky lsp test by having better synchronization of diagnostics between the client and server for testing purposes.
2023-05-22feat(lsp): support lockfile and node_modules directory (#19203)David Sherret
This adds support for the lockfile and node_modules directory to the lsp. In the case of the node_modules directory, it is only enabled when explicitly opted into via `"nodeModulesDir": true` in the configuration file. This is to reduce the language server automatically modifying the node_modules directory when the user doesn't want it to. Closes #16510 Closes #16373
2023-05-14refactor(core): bake single-thread assumptions into spawn/spawn_blocking ↵Matt Mastracci
(#19056) Partially supersedes #19016. This migrates `spawn` and `spawn_blocking` to `deno_core`, and removes the requirement for `spawn` tasks to be `Send` given our single-threaded executor. While we don't need to technically do anything w/`spawn_blocking`, this allows us to have a single `JoinHandle` type that works for both cases, and allows us to more easily experiment with alternative `spawn_blocking` implementations that do not require tokio (ie: rayon). Async ops (+~35%): Before: ``` time 1310 ms rate 763358 time 1267 ms rate 789265 time 1259 ms rate 794281 time 1266 ms rate 789889 ``` After: ``` time 956 ms rate 1046025 time 954 ms rate 1048218 time 924 ms rate 1082251 time 920 ms rate 1086956 ``` HTTP serve (+~4.4%): Before: ``` Running 10s test @ http://localhost:4500 2 threads and 10 connections Thread Stats Avg Stdev Max +/- Stdev Latency 68.78us 19.77us 1.43ms 86.84% Req/Sec 68.78k 5.00k 73.84k 91.58% 1381833 requests in 10.10s, 167.36MB read Requests/sec: 136823.29 Transfer/sec: 16.57MB ``` After: ``` Running 10s test @ http://localhost:4500 2 threads and 10 connections Thread Stats Avg Stdev Max +/- Stdev Latency 63.12us 17.43us 1.11ms 85.13% Req/Sec 71.82k 3.71k 77.02k 79.21% 1443195 requests in 10.10s, 174.79MB read Requests/sec: 142921.99 Transfer/sec: 17.31MB ``` Suggested-By: alice@ryhl.io Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-05-12refactor(lsp): make `RequestMethod` private (#19114)David Sherret
2023-05-11feat(lsp): ability to configure document pre-load limit (#19097)David Sherret
Adds a `deno.preloadLimit` option (ex. `"deno.preloadLimit": 2000`) which specifies how many file entries to traverse on the file system when the lsp loads or its configuration changes. Closes #18955
2023-04-24fix(lsp): show dependency errors for repeated imports (#18807)Nayeem Rahman
2023-04-21refactor(node): move most of cli/node to ext/node (#18797)David Sherret
This is just a straight refactor and I didn't do any cleanup in ext/node. After this PR we can start to clean it up and make things private that don't need to be public anymore.
2023-04-06refactor(npm): use deno_npm and deno_semver (#18602)David Sherret
2023-04-01fix(repl): disable language server document preloading in the repl (#18543)David Sherret
This was an oversight because the repl uses the language server under the hood. Also, never preloads from a root directory. Part of #18538
2023-03-29refactor(lsp): remove boolean parameters on `documents.documents(...)` (#18493)David Sherret
I think this makes things clearer at the call sites.
2023-03-21feat: TypeScript 5.0.2 (except decorators) (#18294)David Sherret
This upgrades TypeScript to 5.0.2, but does not have ES decorator support because swc does not support that yet.