Commit graph

226 commits

Author SHA1 Message Date
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
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 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
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
Bartek Iwańczuk ec0207e9b1
perf(lsp): better op performance logging (#21423) 2023-12-01 22:57:52 +01: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 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 a7bd0cf7a8
perf(lsp): cleanup workspace settings scopes (#20937) 2023-10-24 21:27:27 +01:00
Nayeem Rahman 659cd90758
feat(lsp): respect "typescript.preferences.quoteStyle" when deno.json is absent (#20891) 2023-10-17 02:51:42 +01:00
Nayeem Rahman ebb7fe412e
fix(lsp): show diagnostics for untitled files (#20916) 2023-10-16 20:21:57 +01:00
Nayeem Rahman 64f9155126
fix(lsp): show diagnostics for type imports from untyped deps (#20780) 2023-10-05 01:38:11 +01:00
Nayeem Rahman 6fd2d08418
refactor(lsp): clean up tsc requests (#20743) 2023-10-02 07:32:05 +01:00
Nayeem Rahman 2d1af0cf51
feat(lsp): jupyter notebook analysis (#20719) 2023-09-29 20:44:59 +01:00
David Sherret 5edd102f3f
refactor(cli): make CliNpmResolver a trait (#20732)
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-29 09:26:25 -04:00
David Sherret d43e48c4e9
refactor(ext/node): remove dependency on deno_npm and deno_semver (#20718)
This is required from BYONM (bring your own node_modules).

Part of #18967
2023-09-28 22:43:45 +02:00
Nayeem Rahman cb154d6afa
chore(lsp): bump tower-lsp to 0.20.0 (#20693) 2023-09-26 21:57:14 +01:00
David Sherret dcb00bb9b8
chore: slight cleanup in npm resolvers (#20692) 2023-09-26 16:42:39 -04:00
Nayeem Rahman 939279aa10
feat(lsp): support more vscode built-in settings (#20679) 2023-09-26 03:54:07 +01:00
Nayeem Rahman a4ac6a3f5f
refactor(lsp): store language sections in WorkspaceSettings (#20593)
When sending configuration requests to the client, reads `javascript`
and `typescript` sections in addition to `deno`.

The LSP's initialization options now accepts `javascript` and
`typescript` namespaces.
2023-09-21 06:46:39 +01:00
Nayeem Rahman 40122d7f2a
fix(lsp): force correct media type detection from tsc (#20562) 2023-09-19 16:37:27 +01:00
Nayeem Rahman b9b4ad31d9
refactor(lsp): dedup import map lookup for auto-imports (#20538) 2023-09-19 00:59:26 +01:00
Nayeem Rahman 86c04f43e0
fix(lsp): pass quote preference to tsc (#20547) 2023-09-18 20:48:32 +01:00
Nayeem Rahman f7ba701304
fix(lsp): prefer local auto-import specifiers (#20539)
Give auto-import completion entries a sort-text suffix depending on if
the specifier parses as a URL. This will favour relative and bare
(likely import-mapped) specifiers.
2023-09-18 19:55:24 +01:00
Nayeem Rahman d13e6e6db8
feat(lsp): include source in auto import completion label (#20523) 2023-09-16 15:51:35 +01:00
Bartek Iwańczuk 0b78a61f08
refactor: rewrite cli/ ops to op2 (#20462) 2023-09-12 13:14:45 +02:00
Bartek Iwańczuk 82c2864065
refactor: strongly typed TSC ops (#20466)
Removes usage of `serde_json::Value` in several ops used in TSC, in
favor of using strongly typed structs. This will unblock more 
changes in https://github.com/denoland/deno/pull/20462.
2023-09-12 00:55:57 +00:00
Nayeem Rahman f75a17521d
fix(lsp): respect configured exclusions for testing APIs (#20427)
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-09 19:37:01 +01:00