Commit graph

770 commits

Author SHA1 Message Date
Nayeem Rahman dd6d19e120
fix(lsp): correct scope attribution for injected @types/node (#24404) 2024-07-03 20:25:42 +01:00
Nathan Whitaker c13b6d1413
feat(cli): Add --frozen flag to error out if lockfile is out of date (#24355)
Closes #18296.

Adds a `--frozen` (alias `--frozen-lockfile`) flag that errors out if
the lockfile is out of date. This is useful for running in CI (where an
out of date lockfile is usually a mistake) or to prevent accidental
changes in dependencies.

![Screenshot 2024-06-26 at 7 11
13 PM](https://github.com/denoland/deno/assets/17734409/538404b8-b422-4f05-89e8-4c9b1c248576)
2024-07-02 15:00:16 -07:00
Bartek Iwańczuk b0cd43b5f3
fix(lsp): use CliLockfile (#24387)
The build broke in https://github.com/denoland/deno/pull/24365.
2024-07-01 22:14:17 +00:00
Nayeem Rahman 38a6be2e8e
fix(lsp): respect lockfile redirects entries for resolution (#24365) 2024-07-01 22:08:32 +01:00
Nathan Whitaker bc8a0e6e68
refactor(cli): Create wrapper around deno_lockfile::Lockfile (#24366)
As suggested in
https://github.com/denoland/deno/pull/24355#discussion_r1657875422.

I wasn't able to hide the mutex stuff as much as I'd like (ended up just
adding an escape hatch `inner()` method that locks the inner mutex),
because you can't return references to the inner fields through a mutex.

This is mostly motivated by the frozen lockfile changes
2024-06-28 17:18:21 -07:00
Nayeem Rahman 2ddae872f9
fix(lsp): don't use global cache paths for scope allocation (#24353) 2024-06-28 18:18:21 +01:00
Nayeem Rahman 67dcd6db51
feat(lsp): ts language service scopes (#24345) 2024-06-26 23:47:01 +01:00
David Sherret 0da01c0ca6
refactor: move PackageJson to deno_config (#24348) 2024-06-26 21:24:10 +00:00
David Sherret eb283c43f5
refactor: bump deno_graph to 0.79 (#24337)
No fixes in this to my knowledge. Just an upgrade. The functionality
here will be used in a different PR.
2024-06-26 01:42:18 +00:00
Nayeem Rahman 810474d8b7
fix(lsp): use import map from workspace root (#24246)
Follow up to #24206 which broke deno_std intellisense.
2024-06-19 00:00:17 +02:00
Nayeem Rahman 5dec3fd4b7
feat(lsp): multi deno.json resolver scopes (#24206) 2024-06-17 21:54:23 +01:00
Satya Rohith 0f48313565
chore: upgrade to rust 1.79 (#24207) 2024-06-14 17:10:57 +05:30
Nayeem Rahman 518e4d3b3a
perf(lsp): store settings in Arc (#24191) 2024-06-13 20:57:14 +01:00
Nayeem Rahman b30e5c0985
fix(lsp): strip .js before probing for valid import fix (#24188) 2024-06-12 22:22:57 +01:00
Nayeem Rahman 85e9a790c9
feat(lsp): respect editor indentation options (#24181) 2024-06-12 17:41:01 +01:00
Divy Srivastava 05ec50672d
chore: remove dead code (#24185) 2024-06-12 10:13:03 -04:00
Nayeem Rahman 3b9eeba02c
fix(lsp): don't sort workspace files (#24180) 2024-06-11 21:06:43 +01:00
Nayeem Rahman 0c199acb88
refactor(lsp): collect npm reqs by scope (#24172) 2024-06-11 18:14:36 +01:00
David Sherret 4bc96c5d2a
fix(npm): resolve dynamic npm imports individually (#24170)
* https://github.com/denoland/deno_npm/pull/57
* https://github.com/denoland/deno_graph/pull/498

Closes https://github.com/denoland/deno/issues/17802
2024-06-11 08:55:12 -04:00
Nayeem Rahman 7c5dbd5d54
feat(lsp): workspace jsr resolution (#24121) 2024-06-10 17:03:17 +01:00
David Sherret 386d5c8310
refactor: remove PermissionsContainer in deno_runtime (#24119)
Also removes permissions being passed in for node resolution. It was
completely useless because we only checked it for reading package.json
files, but Deno reading package.json files for resolution is perfectly
fine.

My guess is this is also a perf improvement because Deno is doing less
work.
2024-06-06 23:37:53 -04:00
David Sherret 7ed90a20d0
fix: better handling of npm resolution occurring on workers (#24094)
Closes https://github.com/denoland/deno/issues/24063
2024-06-05 17:04:16 +02:00
David Sherret 3341c50b6a
refactor: don't share reqwest::HttpClient across tokio runtimes (#24092)
This also fixes several issues where we weren't properly creating http
clients with the user's settings.
2024-06-03 21:17:08 +00:00
Nayeem Rahman 72088f2f52
fix(lsp): complete exports for import mapped jsr specifiers (#24054) 2024-06-03 21:32:28 +01:00
Nayeem Rahman 556012320e
feat(lsp): support .npmrc (#24042)
Closes #24040
2024-05-30 03:16:15 +00:00
Luca Casonato e084fe10a9
feat(lint): add no-boolean-literal-for-arguments rule and enable no-unused-vars for jsx files (#24034)
* https://github.com/denoland/deno_lint/pull/1271
* https://github.com/denoland/deno_lint/pull/1277

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-05-30 00:09:16 +00:00
Nayeem Rahman 3d3722507e
perf(repl): don't walk workspace in repl language server (#24037) 2024-05-29 21:31:09 +01:00
David Sherret 94f040ac28
fix: bump cache sqlite dbs to v2 for WAL journal mode change (#24030)
In https://github.com/denoland/deno/pull/23955 we changed the sqlite db
journal mode to WAL. This causes issues when someone is running an old
version of Deno using TRUNCATE and a new version because the two fight
against each other.
2024-05-29 18:38:18 +00:00
Nayeem Rahman fada25b0dd
fix(lsp): don't discover deno.json in vendor dir (#24032) 2024-05-29 18:08:54 +01:00
David Sherret a8923534ed
chore: set lockfile as having no content changes after write (#24023)
Slight perf regression when updating deno_lockfile in
https://github.com/denoland/deno/pull/23979
2024-05-28 23:40:40 -04:00
Nayeem Rahman 14a74600de
perf(lsp): lock out requests until init is complete (#23998) 2024-05-29 01:26:43 +01:00
David Sherret 448fe67b7a
feat(vendor): support modifying remote files in vendor folder without checksum errors (#23979)
Includes:

* https://github.com/denoland/deno_graph/pull/486
* https://github.com/denoland/deno_graph/pull/488
* https://github.com/denoland/deno_lockfile/pull/25
* https://github.com/denoland/deno_lockfile/pull/22
* https://github.com/denoland/deno_graph/pull/483
* https://github.com/denoland/deno_graph/pull/470
2024-05-28 14:58:43 -04:00
Bartek Iwańczuk 959739f609
FUTURE: initial support for .npmrc file (#23560)
This commit adds initial support for ".npmrc" files.

Currently we only discover ".npmrc" files next to "package.json" files
and discovering these files in user home dir is left for a follow up.

This pass supports "_authToken" and "_auth" configuration
for providing authentication.

LSP support has been left for a follow up PR.

Towards https://github.com/denoland/deno/issues/16105
2024-05-23 23:26:23 +02: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
Matt Mastracci 596a2996cf
feat(cli): Add slow test warning (#23874)
By default, uses a 60 second timeout, backing off 2x each time (can be
overridden using the hidden `DENO_SLOW_TEST_TIMEOUT` which we implement
only really for spec testing.

```
Deno.test(async function test() {
  await new Promise(r => setTimeout(r, 130_000));
});
```

```
$ target/debug/deno test /tmp/test_slow.ts 
Check file:///tmp/test_slow.ts
running 1 test from ../../../../../../tmp/test_slow.ts
test ...'test' is running very slowly (1m0s)
'test' is running very slowly (2m0s)
 ok (2m10s)

ok | 1 passed | 0 failed (2m10s)
```

---------

Signed-off-by: Matt Mastracci <matthew@mastracci.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-05-22 08:08:27 -06: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 cc8c0609eb
fix(lsp): apply import fix to missing declaration code action (#23924) 2024-05-21 21:15:16 +01:00
Nayeem Rahman a5111fbc4d
fix(cli): use CliNodeResolver::resolve() for managed node_modules (#23902) 2024-05-21 17:54:15 +01:00
Nayeem Rahman f8956eb763
fix(lsp): respect types dependencies for tsc roots (#23825) 2024-05-16 22:12:25 +01:00
Divy Srivastava 88983fb3eb
fix(node): seperate worker module cache (#23634)
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-16 07:09:35 +00:00
Nathan Whitaker 36d877be4a
perf(lsp): Cache semantic tokens for open documents (#23799)
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-15 01:51:48 +00:00
Nayeem Rahman dda8979cb1
fix(lsp): show reference code lens on methods (#23804) 2024-05-14 22:42:35 +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
Nathan Whitaker dc29986ae5
fix(lsp): move sloppy import resolution from loader to resolver (#23751)
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-09 14:17:31 +00:00
Nayeem Rahman 5e6c72d39f
refactor(lsp): cleanup partially locking methods (#23723) 2024-05-08 06:34:42 +01:00
Nayeem Rahman cbb78e138f
refactor(lsp): reland move resolver fields to LspResolver (#23685) 2024-05-07 03:20:15 +01:00