summaryrefslogtreecommitdiff
path: root/cli/lsp
AgeCommit message (Collapse)Author
2024-05-16fix(lsp): respect types dependencies for tsc roots (#23825)Nayeem Rahman
2024-05-16fix(node): seperate worker module cache (#23634)Divy Srivastava
Construct a new module graph container for workers instead of sharing it with the main worker. Fixes #17248 Fixes #23461 --------- Co-authored-by: David Sherret <dsherret@gmail.com>
2024-05-15perf(lsp): Cache semantic tokens for open documents (#23799)Nathan Whitaker
VScode will typically send a `textDocument/semanticTokens/full` request followed by `textDocument/semanticTokens/range`, and occassionally request semantic tokens even when we know nothing has changed. Semantic tokens also get refreshed on each change. Computing semantic tokens is relatively heavy in TSC, so we should avoid it as much as possible. Caches the semantic tokens for open documents, to avoid making TSC do unnecessary work. Results in a noticeable improvement in local benchmarking before: ``` Starting Deno benchmark -> Start benchmarking lsp - Simple Startup/Shutdown (10 runs, mean: 383ms) - Big Document/Several Edits (5 runs, mean: 1079ms) - Find/Replace (10 runs, mean: 59ms) - Code Lens (10 runs, mean: 440ms) - deco-cx/apps Multiple Edits + Navigation (5 runs, mean: 9921ms) <- End benchmarking lsp ``` after: ``` Starting Deno benchmark -> Start benchmarking lsp - Simple Startup/Shutdown (10 runs, mean: 395ms) - Big Document/Several Edits (5 runs, mean: 1024ms) - Find/Replace (10 runs, mean: 56ms) - Code Lens (10 runs, mean: 438ms) - deco-cx/apps Multiple Edits + Navigation (5 runs, mean: 8927ms) <- End benchmarking lsp ```
2024-05-14fix(lsp): show reference code lens on methods (#23804)Nayeem Rahman
2024-05-13refactor(lsp): reuse CliGraphResolverOptions::sloppy_imports_resolver (#23764)Nayeem Rahman
2024-05-09refactor(lsp): Have JS drive TSC event loop in LSP (#23565)Nathan Whitaker
2024-05-09refactor(lsp): unify caching into LspCache (#23746)Nayeem Rahman
2024-05-09fix(lsp): completions for using decl identifiers (#23748)David Sherret
Closes #23688
2024-05-09fix(lsp): move sloppy import resolution from loader to resolver (#23751)Nathan Whitaker
Moves sloppy import resolution from the loader to the resolver. Also adds some test helper functions to make the lsp tests less verbose --------- Co-authored-by: David Sherret <dsherret@gmail.com>
2024-05-08refactor(lsp): cleanup partially locking methods (#23723)Nayeem Rahman
2024-05-07refactor(lsp): reland move resolver fields to LspResolver (#23685)Nayeem Rahman
2024-05-06fix(lsp): Pass diagnostic codes to TSC as numbers (#23720)Nathan Whitaker
Fixes the `Debug Failure` errors described in https://github.com/denoland/deno/issues/23643#issuecomment-2094552765 . The issue here was that we were passing diagnostic codes as strings but TSC expects the codes to be numbers. This resulted in some quick fixes not working (as illustrated by the test added here which fails before this PR). The first commit is the actual fix. The rest are just test related.
2024-05-06fix(compile): relative permissions should be retained as relative (#23719)David Sherret
Closes #23715
2024-05-04fix(lsp): handle multiline semantic tokens (#23691)Nayeem Rahman
2024-05-03fix(lsp): always cache all npm packages (#23679)David Sherret
Closes #23659
2024-05-03refactor(lsp): cleanup cache and module registry update (#23620)Nayeem Rahman
2024-05-01fix(lsp): Catch cancellation exceptions thrown by TSC, stop waiting for TS ↵Nathan Whitaker
result upon cancellation (#23645) Fixes #23643. We weren't catching the cancellation exception thrown by TSC on the JS side, so the rust side was catching this exception and then attempting to print out the exception via `toString`. That last bit resulted in a cryptic `[object Object]` showing up in the logs like so: ``` Error during TS request "getCompletionEntryDetails": [object Object] ``` I'm not 100% sure how we weren't seeing this in the past. My guess is that #23409 and the subsequent PR to improve the exception catching and logging surfaced this, but I'm still not quite clear on it. My initial fix here returned `null` to rust when a server request was cancelled, but this resulted in a deserialization error when we attempted to deserialize that into the expected response type. So now, as soon as the request's cancellation token signals we'll stop waiting for a response and return an error (which will get swallowed as the LSP request is being cancelled). I was a bit surprised to find that [this branch](https://github.com/nathanwhit/deno/blob/0c671c9792ac706c1ecd60f88efdc5eb8e941917/cli/lsp/tsc.rs#L1093) actually executes sometimes, I believe due to the fact that aborting a future may not [immediately stop its execution](https://docs.rs/futures/latest/futures/stream/struct.AbortHandle.html#method.abort).
2024-05-01Revert "refactor(lsp): move fields from Documents to LspResolver" (#23626)Divy Srivastava
This reverts commit 5cae3439912ad60eb2866f3d4372a5fe4d0de957. ![image](https://github.com/denoland/deno/assets/34997667/e68e40a1-7baf-453b-80d9-f8b6aae186c7) Caused a +3.3s regression in one of the LSP benchmarks at deno.land/benchmarks.
2024-05-01chore(lsp): revert import map pre-resolution for jsxImportSource (#23619)Nayeem Rahman
2024-04-30feat(cli): add support for jsxImportSourceTypes (#23419)Luca Casonato
Co-authored-by: David Sherret <dsherret@gmail.com>
2024-04-30docs: fix some typos in comments (#23520)findmyhappy
2024-04-30refactor(lsp): move fields from Documents to LspResolver (#23585)Nayeem Rahman
2024-04-29FUTURE: remove import assertions support for JavaScript (#23541)Kenta Moriuchi
Ref #17944, https://github.com/swc-project/swc/issues/8893 TypeScript removes the `assert` keywords in the transpile, so this PR only works for JavaScript files
2024-04-27chore(lsp): remove ConfigSnapshot (#23579)Nayeem Rahman
2024-04-26refactor(lsp): unify resolver types into LspResolver (#23514)Nayeem Rahman
2024-04-24feat(jsr): support importing from jsr via HTTPS specifiers (except for type ↵David Sherret
checking) (#23513) Closes https://github.com/jsr-io/jsr/issues/322
2024-04-24fix(lsp): inherit missing fmt and lint config from parent scopes (#23547)Nayeem Rahman
2024-04-24chore(lsp): Print out stack trace if exception occurs in TS request (#23543)Nathan Whitaker
Before this PR, there would just be an uninformative "Error occurred" message, after this PR you'll get a stack trace in the LSP output window like this: ```text Error during TS request "$getSupportedCodeFixes": Error: i threw an exception at serverRequest (ext:deno_tsc/99_main_compiler.js:1089:11) ```
2024-04-23fix(lsp): Fix logic for coalescing pending changes + clear script names ↵Nathan Whitaker
cache when file is closed (#23517)
2024-04-23perf(lsp): Call `serverRequest` via V8 instead of via `executeScript` (#23409)Nathan Whitaker
Doesn't have a noticeable perf impact from my benchmarking, but theoretically should be better.
2024-04-22refactor(lsp): use CliGraphResolver in documents params (#23499)Nayeem Rahman
2024-04-22fix(lsp): remove Document::open_data on close (#23483)Nayeem Rahman
2024-04-22perf(lsp): Batch "$projectChanged" notification in with the next JS request ↵Nathan Whitaker
(#23451) The actual handling of `$projectChanged` is quick, but JS requests are not. The cleared caches only get repopulated on the next actual request, so just batch the change notification in with the next actual request. No significant difference in benchmarks on my machine, but this speeds up `did_change` handling and reduces our total number of JS requests (in addition to coalescing multiple JS change notifs into one).
2024-04-20perf(lsp): Pass code action trigger kind to TSC (#23466)Nathan Whitaker
2024-04-20perf(lsp): only store parsed sources for open documents (#23454)Nayeem Rahman
2024-04-19perf(lsp): Avoid passing struct into op_resolve (#23452)Nathan Whitaker
Going through serde_v8 is slow, so just pass the args separately. `op_resolve` is especially hot, so any speedups are good.
2024-04-19refactor: move redirect handling into deno_graph (#23444)David Sherret
2024-04-19perf(lsp): cleanup document dependencies (#23426)Nayeem Rahman
2024-04-17perf(lsp): release unused documents (#23398)Nayeem Rahman
2024-04-17perf: v8 code cache (#23081)Igor Zinkovsky
This PR enables V8 code cache for ES modules and for `require` scripts through `op_eval_context`. Code cache artifacts are transparently stored and fetched using sqlite db and are passed to V8. `--no-code-cache` can be used to disable. --------- Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-04-16fix(lsp): slice strings by byte index in code actions (#23387)Nayeem Rahman
Fixes #23361.
2024-04-15fix(lsp): improved cjs tracking (#23374)David Sherret
Our cjs tracking was a bit broken. It was marking stuff as esm that was actually cjs leading to type checking errors.
2024-04-15fix(lsp): ensure project version is incremented when config changes (#23366)David Sherret
I'm running into a node resolution bug in the lsp only and while tracking it down I noticed this one. Fixed by moving the project version out of `Documents`.
2024-04-14refactor(lsp): use fallback resolution in op_resolve() (#23329)Nayeem Rahman
2024-04-12perf(lsp): Only deserialize response from `op_respond` once (#23349)Nathan Whitaker
Previously we were deserializing it twice - once to `serde_json::Value`, and then again from the `serde_json::Value` to a concrete type
2024-04-12chore: upgrade deno_core to 0.274.0 (#23344)Divy Srivastava
Signed-off-by: Divy Srivastava <dj.srivastava23@gmail.com>
2024-04-12chore: remove repetitive words (#23341)youngwendy
Signed-off-by: youngwendy <clonefetch@outlook.com>
2024-04-12fix(inspector): don't panic if port is not free (#22745)Bartek Iwańczuk
Closes https://github.com/denoland/deno/issues/22113 Closes https://github.com/denoland/deno/issues/23177 Closes https://github.com/denoland/deno/issues/22883 Closes https://github.com/denoland/deno/issues/22377
2024-04-11perf(lsp): use a stub module in tsc for failed resolutions (#23313)Nayeem Rahman
2024-04-11fix(lsp): Denormalize specifiers before calling `$projectChanged` (#23322)Nathan Whitaker
Fixes the regression described in https://github.com/denoland/deno/pull/23293#issuecomment-2049819724. This affected jupyter notebooks, as the LSP was passing in already denormalized specifiers, while the jupyter kernel was not. We need to denormalize the specifiers to evict the proper keys from our caches.