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

Is there any way that I can debug javascript through the LSP4 IJ plug-in #684

Open
PassingByThs opened this issue Dec 11, 2024 · 6 comments
Labels
dap Debugging Adapter Protocol

Comments

@PassingByThs
Copy link

I am using the IntelliJ Idea Community version, which does not support debugging javascript. Is there any way that I can debug javascript through the LSP4 IJ plug-in? Will the LSP4 IJ plug-in have the ability to support debug javascript or other files in the future? Thanks

@angelozerr
Copy link
Contributor

angelozerr commented Dec 11, 2024

To debug JavaScript, it requires that LSP4IJ must implement and support DAP https://microsoft.github.io/debug-adapter-protocol/

Once this support will be implemented, we could use https://github.com/microsoft/vscode-js-debug

A nice article explains that with neovim which supports DAP https://www.darricheng.com/posts/setting-up-nodejs-debugging-in-neovim/

To implement DAP for IJ we could port DAP support from LSP4E https://github.com/eclipse-lsp4e/lsp4e/tree/main/org.eclipse.lsp4e.debug in IJ

@SCWells72 do you think you could be interested to implement DAP? I have implemented a DAP debugger for a language server (LSP server side), but never implement it for LSP client side.

@angelozerr angelozerr added the dap Debugging Adapter Protocol label Dec 11, 2024
@SCWells72
Copy link
Contributor

SCWells72 commented Dec 11, 2024

@angelozerr, I'll be happy to take a look and see what might be involved. I've implemented a custom debugger using the JB plugin SDK, and it's no small amount of work. I'll need to understand DAP and then try to map its concepts to the IDE's custom debugger SDK to understand just how much work this actually is...

@angelozerr
Copy link
Contributor

That's a fantastic news! I suggest really that you use https://github.com/eclipse-lsp4e/lsp4e/tree/main/org.eclipse.lsp4e.debug and translate code from Eclipse API to IJ API. We did that for LSP support when we start (quickly) the project and to benefit from fixed issues from LSP4E.

@angelozerr
Copy link
Contributor

And if you have any questions, I could perhaps help you since I have implemented a DAP debugger on language server side.

@SCWells72
Copy link
Contributor

@angelozerr, I perused the DAP specification today and it's pretty much what I expected based on our discussion the other day. However, also as discussed, it looks...BIG! I'm not sure it's something I'd be able to take on anytime soon. I certainly think I could split duties with someone else where, for example, I implemented the IDE extension points for a custom debugger against an existing DAP client that someone else has provided. I think it will also be critical to prioritize the various features and determine what constitutes a minimally viable product for a DAP integration and what can/should be added in subsequent iterations (which seems to follow the LSP4IJ model anyway).

I'm happy to spend some time chatting through how that might work and what division of responsibilities would make sense, but I definitely can't commit to taking something this large on myself with all of my other obligations right now.

@angelozerr
Copy link
Contributor

angelozerr commented Jan 3, 2025

@PassingByThs @SCWells72 after spending a lot of time to translate DAP support from LSP4E (DAP support for Eclipse) in IntelliJ I have an uggly POC and debugging (JavaScript only , not TypeScript) starts working:

Image

My goal now is to create a PR with a clean and generic code. Debugging TypeScript, manage evaludation,etc will be done in the future. My goal is to provide a basic DAP support that we will improve step by step.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dap Debugging Adapter Protocol
Projects
None yet
Development

No branches or pull requests

3 participants