Skip to content

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

Closed

Description

@PassingByThs

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

Activity

  1. angelozerr commented on Dec 11, 2024

    @angelozerr
    Contributor

    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.

  2. added
    dap
    on Dec 11, 2024
  3. SCWells72 commented on Dec 11, 2024

    @SCWells72
    Contributor

    @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...

  4. angelozerr commented on Dec 11, 2024

    @angelozerr
    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.

  5. angelozerr commented on Dec 11, 2024

    @angelozerr
    Contributor

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

  6. SCWells72 commented on Dec 13, 2024

    @SCWells72
    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.

  7. angelozerr commented on Jan 3, 2025

    @angelozerr
    Contributor

    @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.

  8. angelozerr commented on Jan 21, 2025

    @angelozerr
    Contributor

    @PassingByThs if you want to test the dap support please install nightly-builds.

    and read https://github.com/redhat-developer/lsp4ij/blob/main/docs/dap/user-defined-dap/vscode-js-debug.md

    It is a basic dap support which is not perfect, please report issues and give us feedback.

  9. PassingByThs commented on Jan 24, 2025

    @PassingByThs
    Author

    Excellent work!🎉🎉🎉 It worked well with javascript. There is no errors I have found.

    But it can not debug typescript directly unless compiled to javascript, which seems conflict as mentiond below.
    Image

  10. angelozerr commented on Jan 24, 2025

    @angelozerr
    Contributor

    Excellent work!🎉🎉🎉 It worked well with javascript. There is no errors I have found.

    That's excellent! Thanks for your feedback!

    But it can not debug typescript directly unless compiled to javascript, which seems conflict as mentiond below.

    It is possible since this debugger is used inside vscode and LSP4E uses it https://github.com/eclipse-wildwebdeveloper/wildwebdeveloper/blob/master/org.eclipse.wildwebdeveloper/src/org/eclipse/wildwebdeveloper/debug/node/VSCodeJSDebugDelegate.java.

    I added a TODO at https://github.com/redhat-developer/lsp4ij/blob/main/docs/dap/user-defined-dap/vscode-js-debug.md#configure-the-typescript-file-to-rundebug

    It is just a matter with Launch DAP parameters I think. I need to investigate more how to configure that.

    To understand how to do that we need:

    The first thing I will try it is to use this following config:

    {
      "type": "pwa-node",
      "request": "launch",
      "program": "${file}",
      "cwd": "${workspaceFolder}",
      "sourceMap": true,
      "outFiles": ["${workspaceFolder}/out/**/*.js"]
    }

    Image

    When you read doc at https://code.visualstudio.com/docs/typescript/typescript-debugging

    It uses

    preLaunchTask": "tsc: build - tsconfig.json",

    but it is specific to vscode, perhaps we could do the same thing with the before task (I don't know if it is working).

    Please try it and give me feedback.

  11. PassingByThs commented on Jan 24, 2025

    @PassingByThs
    Author

    DAP parameters content disappeared when opened again.

    Image

    Image

  12. angelozerr commented on Jan 24, 2025

    @angelozerr
    Contributor

    DAP parameters content disappeared when opened again.

    Image

    Image

    Indeed I have noticed this problem. I am fixing and providing run / debug with contextual menu

  13. angelozerr commented on Jan 24, 2025

    @angelozerr
    Contributor

    @PassingByThs after spending a lot of times to debug vscode to understand how it configure VSCode Debug JS, I can debug TypeScript!

    Image

    There are some bugs that I need to fix it, I will ping you when I will push my work.

  14. added this to the 0.10.0 milestone on Jan 25, 2025
  15. self-assigned this
    on Jan 25, 2025
  16. moved this to In Progress in Java Toolingon Jan 25, 2025
  17. angelozerr commented on Jan 25, 2025

    @angelozerr
    Contributor

    @PassingByThs please install again nightly-builds and read https://github.com/redhat-developer/lsp4ij/blob/main/docs/dap/user-defined-dap/vscode-js-debug.md#configure-the-typescript-file-to-rundebug

    I have fixed your below issues.

    You should (I hope) have the capability to debug TypeScript files, please report issues and give us feedback.

  18. moved this from In Progress to Done in Java Toolingon Feb 4, 2025
  19. angelozerr commented on Feb 14, 2025

    @angelozerr
    Contributor

    @PassingByThs for your information LSP4IJ 0.10.0 has been released.

    Is there any chance that you add a review at https://plugins.jetbrains.com/plugin/23257-lsp4ij/edit/reviews to speak about DAP support to help us to promote LSP4IJ DAP support. Reviews are very important for us to try to convince users to use LSP4IJ.

    Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

dap

Type

No type

Projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions