Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(lsp): allow to connect V8 inspector #21482

Merged
merged 16 commits into from
Dec 22, 2023

Conversation

bartlomieju
Copy link
Member

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.

Copy link
Member

@littledivy littledivy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@bartlomieju bartlomieju requested a review from nayeemrmn December 8, 2023 04:06
@bartlomieju
Copy link
Member Author

bartlomieju commented Dec 11, 2023

This needs more work - currently even loop is not spun and doesn't allow to collect any performance measurements using V8 inspector.

Addressed now.

@bartlomieju bartlomieju marked this pull request as draft December 11, 2023 16:25
@nayeemrmn nayeemrmn self-assigned this Dec 11, 2023
cli/lsp/mod.rs Outdated Show resolved Hide resolved
@nayeemrmn nayeemrmn marked this pull request as ready for review December 20, 2023 01:46
@nayeemrmn nayeemrmn removed their request for review December 20, 2023 01:49
cli/lsp/tsc.rs Outdated Show resolved Hide resolved
loop {
if has_inspector_server {
tsc_runtime_.lock().await.run_event_loop(PollEventLoopOptions {
wait_for_inspector: false,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had to set this to false, otherwise run_event_loop() won't return when there's an inspector attached and requests can't be processed.

The consequence is that the event loop only ticks after requests. So for example when starting and stopping the profiler it freezes, and you have to unfreeze it by interacting with your editor a bit to trigger some requests. Seems to finally be in a usable state besides that. The REPL also works with the same caveat.

It would help to have a cancel-safe JsRuntime method to continuously drive the inspector message loop instead of run_event_loop() here. Dunno if it's possible.

@bartlomieju bartlomieju merged commit cdbf902 into denoland:main Dec 22, 2023
13 checks passed
@bartlomieju bartlomieju deleted the lsp_tsc_inspector branch December 22, 2023 01:04
bartlomieju added a commit that referenced this pull request Jan 4, 2024
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants