1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-22 15:06:54 -05:00
Commit graph

261 commits

Author SHA1 Message Date
Nayeem Rahman
14a74600de
perf(lsp): lock out requests until init is complete (#23998) 2024-05-29 01:26:43 +01:00
Nayeem Rahman
0a30897925
refactor(lsp): determine file referrer for each document (#23867) 2024-05-23 17:31:56 +01:00
Hajime-san
cbddf468e3
fix(lsp): process Fenced Code Block in JSDoc on completion correctly (#23822)
partially fixing https://github.com/denoland/deno/issues/23820


https://github.com/denoland/deno/assets/41257923/0adb5d4e-cfd5-4195-9045-19d1c0a07a43

BTW, it is out of scope on this PR that to process type of `@param` to
be an code block due to it's a bit complicated.
2024-05-22 12:00:14 -07:00
Nathan Whitaker
db82e8b557
fix(lsp): Fix display of JSDoc named examples (#23927)
We were wrapping the display string in an unnecessary pair of triple
backticks, breaking highlighting

Before:
![Screenshot 2024-05-21 at 12 16
12 PM](https://github.com/denoland/deno/assets/17734409/1cf5a3ce-56dd-443d-9d1a-bd33625ff1f2)

After:
![Screenshot 2024-05-21 at 12 16
36 PM](https://github.com/denoland/deno/assets/17734409/646c4c48-9b5a-4326-bb95-b1374627d969)
2024-05-21 14:04:19 -07:00
Nayeem Rahman
f8956eb763
fix(lsp): respect types dependencies for tsc roots (#23825) 2024-05-16 22:12:25 +01:00
Nayeem Rahman
88529f0b47
refactor(lsp): reuse CliGraphResolverOptions::sloppy_imports_resolver (#23764) 2024-05-13 17:55:31 +01:00
Nathan Whitaker
19c0633a94
refactor(lsp): Have JS drive TSC event loop in LSP (#23565) 2024-05-09 13:49:10 -07:00
Nayeem Rahman
439b3b8db9
refactor(lsp): unify caching into LspCache (#23746) 2024-05-09 20:22:27 +01:00
David Sherret
f0e8ec0146
fix(lsp): completions for using decl identifiers (#23748)
Closes #23688
2024-05-09 13:18:13 -04:00
Nayeem Rahman
cbb78e138f
refactor(lsp): reland move resolver fields to LspResolver (#23685) 2024-05-07 03:20:15 +01:00
Nathan Whitaker
672216d65a
fix(lsp): Pass diagnostic codes to TSC as numbers (#23720)
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-06 23:54:52 +00:00
Nayeem Rahman
973743b751
fix(lsp): handle multiline semantic tokens (#23691) 2024-05-04 21:48:06 +01:00
Nathan Whitaker
66b66de96a
fix(lsp): Catch cancellation exceptions thrown by TSC, stop waiting for TS 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](0c671c9792/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-01 20:31:11 -07:00
Divy Srivastava
7f80d90f1c
Revert "refactor(lsp): move fields from Documents to LspResolver" (#23626)
This reverts commit 5cae343991.


![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-01 05:54:25 +00:00
findmyhappy
ce4a7773cc
docs: fix some typos in comments (#23520) 2024-04-30 17:59:56 +10:00
Nayeem Rahman
5cae343991
refactor(lsp): move fields from Documents to LspResolver (#23585) 2024-04-30 02:41:19 +01:00
Nayeem Rahman
e0f849289f
chore(lsp): remove ConfigSnapshot (#23579) 2024-04-27 21:35:41 +01:00
Nayeem Rahman
f8ddcc4f78
refactor(lsp): unify resolver types into LspResolver (#23514) 2024-04-26 21:39:33 +01:00
Nathan Whitaker
a6c2472949
chore(lsp): Print out stack trace if exception occurs in TS request (#23543)
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-24 19:46:08 +00:00
Nathan Whitaker
5294885a5a
fix(lsp): Fix logic for coalescing pending changes + clear script names cache when file is closed (#23517) 2024-04-23 15:29:29 -07:00
Nathan Whitaker
804b97c636
perf(lsp): Call serverRequest via V8 instead of via executeScript (#23409)
Doesn't have a noticeable perf impact from my benchmarking, but
theoretically should be better.
2024-04-23 08:50:30 -07:00
Nathan Whitaker
aac7a8cb7c
perf(lsp): Batch "$projectChanged" notification in with the next JS request (#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-22 08:03:16 -07:00
Nathan Whitaker
f62018e80f
perf(lsp): Pass code action trigger kind to TSC (#23466) 2024-04-20 13:18:43 -07:00
Nathan Whitaker
b5ce9cda0d
perf(lsp): Avoid passing struct into op_resolve (#23452)
Going through serde_v8 is slow, so just pass the args separately.
`op_resolve` is especially hot, so any speedups are good.
2024-04-19 10:11:17 -07:00
Nayeem Rahman
24fa5c784a
perf(lsp): release unused documents (#23398) 2024-04-17 21:40:42 +01:00
Igor Zinkovsky
b3d7df5535
perf: v8 code cache (#23081)
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-17 07:19:55 -07:00
David Sherret
6f278e5c40
fix(lsp): improved cjs tracking (#23374)
Our cjs tracking was a bit broken. It was marking stuff as esm that was
actually cjs leading to type checking errors.
2024-04-15 17:50:52 -04:00
David Sherret
1835b4f061
fix(lsp): ensure project version is incremented when config changes (#23366)
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-15 00:07:04 +00:00
Nayeem Rahman
8f1a92f3c3
refactor(lsp): use fallback resolution in op_resolve() (#23329) 2024-04-14 22:42:58 +01:00
Nathan Whitaker
3dacba5057
perf(lsp): Only deserialize response from op_respond once (#23349)
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-12 16:04:54 -07:00
Divy Srivastava
c56f2e0fc0
chore: upgrade deno_core to 0.274.0 (#23344)
Signed-off-by: Divy Srivastava <dj.srivastava23@gmail.com>
2024-04-12 21:45:38 +02:00
Bartek Iwańczuk
f358ae6278
fix(inspector): don't panic if port is not free (#22745)
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-12 01:17:10 +02:00
Nayeem Rahman
f1ea8ca358
perf(lsp): use a stub module in tsc for failed resolutions (#23313) 2024-04-11 21:55:27 +01:00
Nathan Whitaker
4ab0215727
fix(lsp): Denormalize specifiers before calling $projectChanged (#23322)
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.
2024-04-11 18:33:03 +00:00
Nathan Whitaker
736f73b008
perf(lsp): Only evict caches on JS side when things actually change (#23293)
Currently we evict a lot of the caches on the JS side of things on every
request, namely script versions, script file names, and compiler
settings (as of #23283, it's not quite every request but it's still
unnecessarily often).

This PR reports changes to the JS side, so that it can evict exactly the
caches that it needs too. We might want to do some batching in the
future so as not to do 1 request per change.
2024-04-10 18:06:37 -07:00
Nayeem Rahman
3c346c8ea6
perf(lsp): don't pass remote modules as tsc roots (#23259) 2024-04-08 19:45:20 +01:00
Nayeem Rahman
f9f37963b7
refactor(lsp): remove DocumentInner (#23251) 2024-04-06 15:36:43 +01:00
Nayeem Rahman
2b1c6e172e
feat(lsp): respect nested deno.json for fmt and lint config (#23159) 2024-04-02 23:02:50 +01:00
Nathan Whitaker
2dc37f411e
feat(task): Task description in the form of comments (#23101)
Closes #22786.

TLDR;
```jsonc
{
  "tasks": {
    // Some comment
    //
    // describing what the task does
    "dev": "deno run -A --watch main.ts"
  }
}
```
```bash
deno task
```
![Screenshot 2024-03-27 at 1 43
49 PM](https://github.com/denoland/deno/assets/17734409/7a14da8c-8e63-45ba-9bfb-590d250b56a9)
2024-03-27 14:14:27 -07:00
Hajime-san
feb744cebd
fix(lsp): decoding percent-encoding(non-ASCII) file path correctly (#22582) 2024-03-27 15:58:18 +00:00
David Sherret
ac4a5f74b8
feat: TypeScript 5.4 (#23086)
Fork PR: https://github.com/denoland/TypeScript/pull/10

Closes #23080
2024-03-26 18:52:57 -04:00
Nayeem Rahman
3b61104e2a
refactor(lsp): unify config file data into ConfigTree (#23032) 2024-03-26 15:52:20 +00:00
Nayeem Rahman
5a716d1d06
refactor(lsp): factor out workspace walk from resolver update (#22937) 2024-03-21 04:29:52 +00:00
David Sherret
ad6b00a2bf
chore: enable clippy unused_async rule (#22834) 2024-03-11 23:48:00 -04:00
Nayeem Rahman
8df47882c9
fix(lsp): don't apply renames to remote modules (#22765) 2024-03-07 17:27:24 +00:00
Bartek Iwańczuk
d9fa2dd550
chore: upgrade deno_core (#22699)
Co-authored-by: Matt Mastracci <matthew@mastracci.com>
2024-03-05 01:17:39 +00:00
Nayeem Rahman
e32c704970
feat(lsp): auto-import completions for jsr specifiers (#22462) 2024-02-21 02:45:00 +00:00
Nayeem Rahman
9a5b4b0395
feat(lsp): complete parameters as tab stops and placeholders (#22126) 2024-01-26 13:41:12 +00:00
Nayeem Rahman
d8f86c8b9c
refactor(lsp): store project version on documents (#21892) 2024-01-11 17:07:44 +00:00
David Sherret
7e72f3af61
chore: update copyright to 2024 (#21753) 2024-01-01 19:58:21 +00:00