Commit graph

628 commits

Author SHA1 Message Date
Nayeem Rahman 327b5b280b
fix(lsp): disable no-cache diagnostics for jsr specifiers (#22284) 2024-02-06 14:56:26 +00:00
Matt Mastracci aecad7f353
refactor(cli): Add TestFailureDescription (#22267)
Extract zero-risk changes from #22226
2024-02-05 17:27:17 +00:00
David Sherret 4b7c6049ef
refactor: load bytes in deno_graph (#22212)
Upgrades deno_graph to 0.64 where deno_graph is now responsible for
turning bytes into a string. This is in preparation for Wasm modules.
2024-02-01 03:15:22 +00:00
Nayeem Rahman d730956f49
fix(lsp): don't normalize urls in cache command params (#22182) 2024-01-30 17:17:34 +00:00
Nayeem Rahman aed5e4997d
chore(lsp): rename client-side command invocations (#22140) 2024-01-28 21:56:45 +00:00
Bartek Iwańczuk 7281775381
Revert "refactor(cli): use new sanitizer for resources (#22125)" (#22153) 2024-01-27 20:37:36 +01:00
Matt Mastracci 84fb2ad71b
refactor(cli): use new sanitizer for resources (#22125)
Step 1 of the Rustification of sanitizers, which unblocks the faster
timers.

This replaces the resource sanitizer with a Rust one, using the new APIs
in deno_core.
2024-01-26 17:24:16 -05:00
Nayeem Rahman 9a5b4b0395
feat(lsp): complete parameters as tab stops and placeholders (#22126) 2024-01-26 13:41:12 +00:00
Bartek Iwańczuk 2fd26de396
fix(lsp): disable experimentalDecorators by default (#22101)
Follow up to https://github.com/denoland/deno/pull/22040.

By mistake I forgot to disable "experimental decorators" in the LSP.
2024-01-25 14:39:21 +00:00
Nayeem Rahman ec97c7dd4b
feat(lsp): include scope uri in "deno/didChangeDenoConfiguration" (#22002) 2024-01-23 06:12:41 +00:00
David Sherret fbfeedb68b
fix(lsp): improved npm specifier to import map entry mapping (#22016)
Upgrades to the latest deno_semver
2024-01-21 17:19:10 -05:00
David Sherret 35c1652f56
fix(lsp): regression - formatting was broken on windows (#21972)
~~Waiting on: https://github.com/denoland/deno_config/pull/31~~

Closes #21971
Closes https://github.com/denoland/vscode_deno/issues/1029
2024-01-18 15:57:30 -05:00
Nayeem Rahman 2141543105
feat(lsp): send "deno/didChangeDenoConfiguration" on init (#21965) 2024-01-17 20:22:28 +00:00
David Sherret 4e72ca313a
refactor: use globbing from deno_config (#21925) 2024-01-15 19:15:39 -05:00
Bartek Iwańczuk 0d51c1f90e
feat: remove conditional unstable type-checking (#21825)
This commit removes conditional type-checking of unstable APIs.

Before this commit `deno check` (or any other type-checking command and
the LSP) would error out if there was an unstable API in the code, but not
`--unstable` flag provided.

This situation hinders DX and makes it harder to configure Deno. Failing
during runtime unless `--unstable` flag is provided is enough in this case.
2024-01-14 18:29:17 +01:00
Nayeem Rahman d8f86c8b9c
refactor(lsp): store project version on documents (#21892) 2024-01-11 17:07:44 +00:00
Bartek Iwańczuk 69959aa01f
fix: update deno_lint and swc (#21718)
Co-authored-by: David Sherret <dsherret@gmail.com>
2024-01-09 23:20:52 +00:00
David Sherret 741afc4b94
fix(lsp): use a dedicated thread for the parent process checker (#21869)
Ensures the Deno process is brought down even when the runtime gets hung
up on something.

Marvin found that the lsp was running without a parent vscode around so
this is maybe/probably related.
2024-01-09 11:36:03 -05:00
David Sherret e212e1fc35
perf: skip expanding exclude globs (#21817)
We were calling `expand_glob` on our excludes, which is very expensive
and unnecessary because we can pattern match while traversing instead.

1. Doesn't expand "exclude" globs. Instead pattern matches while walking
the directory.
2. Splits up the "include" into base paths and applicable file patterns.
This causes less pattern matching to occur because we're only pattern
matching on patterns that might match and not ones in completely
unrelated directories.
2024-01-08 17:18:42 +00:00
Nayeem Rahman bac51f66aa
fix(lsp): show test code lens for template literal names (#21798) 2024-01-05 12:04:33 +00:00
Nayeem Rahman 9526520cf0
fix(lsp): support test code lens for Deno.test.{ignore,only}() (#21775) 2024-01-03 16:34:21 +00:00
Nayeem Rahman 261f32ef65
feat(lsp): cache jsxImportSource automatically (#21687) 2024-01-02 23:48:34 +00:00
林炳权 96b581bdd2
chore: update to Rust 1.75 (#21731) 2024-01-01 23:22:48 +01:00
David Sherret 7e72f3af61
chore: update copyright to 2024 (#21753) 2024-01-01 19:58:21 +00:00
Nayeem Rahman 48dae2441c
perf(lsp): use LanguageServiceHost::getProjectVersion() (#21719) 2023-12-28 00:13:57 +00:00
Bartek Iwańczuk cdbf902499
feat(lsp): allow to connect V8 inspector (#21482)
This commit adds a way to connect to the TS compiler host that is run
as part of the "deno lsp" subcommand. This can be done by specifying 
"DENO_LSP_INSPECTOR" variable.

---------

Co-authored-by: Nayeem Rahman <nayeemrmn99@gmail.com>
2023-12-22 02:04:02 +01:00
Nayeem Rahman cd480b481e
fix(lsp): apply specifier rewrite to CompletionItem::text_edit (#21564) 2023-12-15 15:24:38 +00:00
Nayeem Rahman 7d88e48296
perf(lsp): use null types instead of stub modules (#21541) 2023-12-12 10:26:27 +00:00
Bartek Iwańczuk 49a6daaa83
perf(lsp): collect counts and durations of all requests (#21540)
In addition to collecting details per-request metrics of the last 3000
request this commit adds aggregate metrics for all requests.
2023-12-12 08:18:10 +01:00
Bartek Iwańczuk 88566cee72
perf(lsp): instrument all ops with performance marks (#21536)
Adds performance measurements for all ops used by the LSP. Also changes
output of "Language server status" page to include more precise
information.

Current suspicion is that computing "script version" takes a long time
for some users.
2023-12-11 17:33:56 +01:00
Bartek Iwańczuk 7bf267c197
perf(lsp): simplify some of the startup code (#21538)
Remove some dead code in "99_main_compiler.js". Eagerly start the LSP
TSC host, it was adding some not needed complexity around the TSC thread code.
2023-12-11 16:59:09 +01:00
Nayeem Rahman 123d9ea047
feat(lsp): debug log file (#21500) 2023-12-08 17:04:56 +00:00
David Sherret ddfbe71ced
feat(lsp): provide quick fixes for specifiers that could be resolved sloppily (#21506) 2023-12-08 09:57:06 -05:00
David Sherret 78566753c8
feat: add suggestions to module not found error messages for file urls (#21498) 2023-12-07 15:59:13 -05:00
David Sherret 890780a9e9
feat(unstable): ability to resolve specifiers with no extension, specifiers 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-07 00:03:18 +00:00
Nayeem Rahman 0a738dc49d
perf(lsp): check tsc request cancellation before execution (#21447) 2023-12-03 22:07:40 +00:00
Nayeem Rahman 28c527c8f5
perf(lsp): fix redundant clones for ts responses (#21445) 2023-12-03 19:02:14 +00:00
Bartek Iwańczuk 39c7d8dafe
refactor: faster args for op_load in TSC (#21438)
This commit changes the argument that "op_load" accepts, from
a serde struct to "&str". This should equal to a slightly better
performance.
2023-12-03 02:07:04 +00:00
Asher Gomez d2b5254c33
chore: update std to 0.208.0 (#21318)
Re-attempt at #21284. I was more thorough this time.

---------

Signed-off-by: Asher Gomez <ashersaupingomez@gmail.com>
2023-12-02 03:20:06 +01:00
Bartek Iwańczuk ec0207e9b1
perf(lsp): better op performance logging (#21423) 2023-12-01 22:57:52 +01:00
David Sherret a1d823e27d
feat(compile): support discovering modules for more dynamic arguments (#21381)
This PR causes Deno to include more files in the graph based on how a
template literal looks that's provided to a dynamic import:

```ts
const file = await import(`./dir/${expr}`);
```

In this case, it will search the `dir` directory and descendant
directories for any .js/jsx/etc modules and include them in the graph.

To opt out of this behaviour, move the template literal to a separate
line:

```ts
const specifier = `./dir/${expr}`
const file = await import(specifier);
```
2023-12-01 20:12:10 +00:00
Bartek Iwańczuk fe90ba650d
refactor(lsp): log names (#21413)
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-12-01 03:54:59 +01:00
Nayeem Rahman 91626bac49
perf(lsp): avoid redundant getNavigationTree() calls (#21396) 2023-11-30 16:23:47 +00:00
Nayeem Rahman 595a2be024
perf(lsp): cancel ts requests on future drop (#21387)
When an old request is obsoleted while the user is typing, the client
will say so to the server and tower-lsp will drop the future associated
with that request.

This wires that up to the ts server by having any request's token be
cancelled when the surrounding state is dropped.
2023-11-30 03:35:39 +00:00
Bartek Iwańczuk 6718be87c8
perf(lsp): add performance marks for TSC requests (#21383)
This should help us get a better picture where most of the time is spent
(the TSC or the surrounding Rust code).
2023-11-29 21:18:23 +00:00
David Sherret 60b5d32d90
fix(lsp): handle byonm specifiers in jupyter notebooks (#21332)
Part of https://github.com/denoland/deno/issues/21308
2023-11-24 17:35:33 -05:00
Nayeem Rahman 64997cce6a
fix(lsp): force shutdown after a timeout (#21251) 2023-11-22 04:08:48 +00:00
David Sherret f46802cb1e
refactor(upgrade): add unit tests for lsp upgrade check (#21244) 2023-11-17 16:40:12 -05:00
林炳权 9a1c697045
chore: update to Rust 1.74 (#21210)
Update to Rust 1.74
2023-11-17 08:06:28 -07:00
Nayeem Rahman 4913274a65
feat(lsp): upgrade check on init and notification (#21105) 2023-11-14 22:10:51 +00:00