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

Debugger(s) over DAP #85

Closed
mickaelistria opened this Issue Oct 21, 2018 · 18 comments

Comments

Projects
None yet
2 participants
@mickaelistria
Copy link
Contributor

mickaelistria commented Oct 21, 2018

We could replace JSDT debugger by other based on existing Debug Adapters.

@mickaelistria

This comment has been minimized.

Copy link
Contributor

mickaelistria commented Dec 17, 2018

screenshot from 2018-12-17 16-23-57
This screenshot shows how a minimal configuration of LSP4E debug can successfully run/debug a node.js Hello World using VSCode Node debugger (talking DAP) with minimal configuration.

@mickaelistria

This comment has been minimized.

Copy link
Contributor

mickaelistria commented Dec 18, 2018

There is some good progress in embedding the debugger, but there is also this issue: Microsoft/vscode-node-debug#187
@jabby as our node expert here, do you think you could participate in fixing Microsoft/vscode-node-debug#187 ?

mickaelistria added a commit to mickaelistria/wildwebdeveloper that referenced this issue Dec 19, 2018

Issue eclipse#85 - Debug using VSCode debugger over DAP
This includes the node-debug VSCode module into
Wild Web Developer to use with LSP4E's DAP support.

Signed-off-by: Mickael Istria <mistria@redhat.com>
@jabby

This comment has been minimized.

Copy link
Member

jabby commented Dec 19, 2018

Mickael, can you explain how you launch a js script in debug mode? I'm not sure I try correctly.

@mickaelistria

This comment has been minimized.

Copy link
Contributor

mickaelistria commented Dec 19, 2018

At the moment, you need to create a Debug Configuration like the screenshot I've put in a previous comment. It will delegates the the VSCode Node Debug Adapter (nodeDebug.js) that takes care of starting the target "program" (blah.js) in debug mode, and LSP4E.debug connects to the adapter for interaction.
Current patch includes directly the adapter (so we can reference the internal one instead in relying on VSCode, it should be only a matter of updating the path to nodeDebug.js).
I'm working on creating more specific Launch/Debug Configuration that hide the internals of the debugger (path to nodeDebug.js and so on) to focus only on what user cares about.

@jabby

This comment has been minimized.

Copy link
Member

jabby commented Dec 19, 2018

OK I will retry tomorrow (time to lunch).
By the way can you share your blah.js file?

@mickaelistria

This comment has been minimized.

Copy link
Contributor

mickaelistria commented Dec 19, 2018

By the way can you share your blah.js file?

Get ready for it, it's a JavaScript piece of art, a mindblowing snippet, the proof that P==NP and a program that can reduce by 90% energy consumption in this world while curing the most important diseases...
...
...

console.log("kikoo");

!

mickaelistria added a commit to mickaelistria/wildwebdeveloper that referenced this issue Dec 19, 2018

Issue eclipse#85 - Debug using VSCode debugger over DAP
This includes the node-debug VSCode module into
Wild Web Developer to use with LSP4E's DAP support.

Signed-off-by: Mickael Istria <mistria@redhat.com>

mickaelistria added a commit to mickaelistria/wildwebdeveloper that referenced this issue Dec 19, 2018

Issue eclipse#85 - Debug using VSCode debugger over DAP
This includes the node-debug VSCode module into
Wild Web Developer to use with LSP4E's DAP support.

Signed-off-by: Mickael Istria <mistria@redhat.com>

mickaelistria added a commit to mickaelistria/wildwebdeveloper that referenced this issue Dec 20, 2018

Issue eclipse#85 - Debug using VSCode debugger over DAP
This includes the node-debug VSCode module into
Wild Web Developer to use with LSP4E's DAP support.

Signed-off-by: Mickael Istria <mistria@redhat.com>

mickaelistria added a commit to mickaelistria/wildwebdeveloper that referenced this issue Dec 20, 2018

Issue eclipse#85 - Debug using VSCode debugger over DAP
This includes the node-debug VSCode module into
Wild Web Developer to use with LSP4E's DAP support.

Signed-off-by: Mickael Istria <mistria@redhat.com>

mickaelistria added a commit to mickaelistria/wildwebdeveloper that referenced this issue Dec 20, 2018

Issue eclipse#85 - Debug using VSCode debugger over DAP
This includes the node-debug VSCode module into
Wild Web Developer to use with LSP4E's DAP support.

Signed-off-by: Mickael Istria <mistria@redhat.com>
@mickaelistria

This comment has been minimized.

Copy link
Contributor

mickaelistria commented Dec 20, 2018

I've merged my change. In master, there is now a run/debug configuration + right-click > Run/Debug As on .js files that can be used to run or debug a .js with node.
It uses VSCode Debug Adapter and LSP4E DAP support. The only code necessary is about defining the launch type, passing the right initialization options and related UI.
Wild Web Developer doesn't need JSDT any more for debug.

This is a major achievement for Wild Web Developer and the DAP support in Eclipse IDE!

Further issues should be reported in new finer-grain tickets.

@jabby

This comment has been minimized.

Copy link
Member

jabby commented Dec 20, 2018

@mickaelistria I tried your work from the marketplace.
I'm not able to hit a breakpoint when I launch my script with Debug as node program
Did you succeed?

@mickaelistria

This comment has been minimized.

Copy link
Contributor

mickaelistria commented Dec 20, 2018

Yes, it works for me. Does Run As work for you?

@jabby

This comment has been minimized.

Copy link
Member

jabby commented Dec 20, 2018

Run as works as expected for me. I get my awesome Hello World! message in the console.
When I use Debug As I just saw the launch of the node debug. But there is nothing in the console.

@jabby

This comment has been minimized.

Copy link
Member

jabby commented Dec 20, 2018

Run as:

/home/g.saint-martin-lacaz/.nvm/versions/node/v8.12.0/bin/node plop.js 
Hello World!!!

Debug as: 2 consoles.

First:

/home/g.saint-martin-lacaz/.nvm/versions/node/v8.12.0/bin/node --nolazy --debug-brk=42541 plop.js 
(node:18275) [DEP0062] DeprecationWarning: `node --debug` and `node --debug-brk` are invalid. Please use `node --inspect` or `node --inspect-brk` instead.

Second:

Content-Length: 583

{"seq":1,"type":"response","request_seq":1,"command":"initialize","success":true,"body":{"supportsConfigurationDoneRequest":true,"supportsFunctionBreakpoints":true,"supportsConditionalBreakpoints":true,"supportsEvaluateForHovers":false,"exceptionBreakpointFilters":[{"label":"All Exceptions","filter":"all","default":false},{"label":"Uncaught Exceptions","filter":"uncaught","default":true}],"supportsSetVariable":true,"supportsRestartFrame":true,"supportsCompletionsRequest":true,"supportsExceptionInfoRequest":true,"supportsDelayedStackTraceLoading":true,"supportsLogPoints":true}}Content-Length: 183

{"seq":2,"type":"event","event":"output","body":{"category":"console","output":"/home/g.saint-martin-lacaz/.nvm/versions/node/v8.12.0/bin/node --nolazy --debug-brk=42541 plop.js \n"}}Content-Length: 238

{"seq":3,"type":"event","event":"output","body":{"category":"stderr","output":"(node:18275) [DEP0062] DeprecationWarning: `node --debug` and `node --debug-brk` are invalid. Please use `node --inspect` or `node --inspect-brk` instead.\n"}}Content-Length: 45

{"seq":4,"type":"event","event":"terminated"}
@jabby

This comment has been minimized.

Copy link
Member

jabby commented Dec 20, 2018

And my awesome program is:

function toto(who) {
	return 'Hello ' + who + '!!!'; 
}

console.log(toto('World'))

I put 2 breakpoints. One on the return statement and another one on the console.log statement.

@mickaelistria

This comment has been minimized.

Copy link
Contributor

mickaelistria commented Dec 20, 2018

The message from the console show it could be an issue with you node version being newer and less permissive than mine (v7.10.1), which shows the following

/usr/bin/node --nolazy --debug-brk=41915 kikoo.js 
(node:13567) DeprecationWarning: node --debug is deprecated. Please use node --inspect instead.
Debugger listening on 127.0.0.1:41915
Hello World!!!

The deprecation sounds more like a warning for me, while it sounds more like an error in your case.

We need to check whether newer version of the node-debug fix it, and consider adopting them.

@mickaelistria

This comment has been minimized.

Copy link
Contributor

mickaelistria commented Dec 20, 2018

@jabby Can you try similar setup as #85 (comment) (using the generic Debug Adapter Launch config and referencing a local modern version of VSCode)?

@jabby

This comment has been minimized.

Copy link
Member

jabby commented Dec 20, 2018

I tried with node 7.10.1. I can't run in debug mode.
Here is a screenshot of my configuration.

capture d ecran de 2018-12-20 18-34-03

And here is my version of Eclipse IDE

Eclipse IDE for Java Developers
Version: 2018-12 (4.10.0)
Build id: 20181214-0600
OS: Linux, v.4.19.2-200.fc28.x86_64, x86_64 / gtk 3.22.30
Java version: 11.0.1

  Buildship: Eclipse Plug-ins for Gradle	3.0.0.v20181106-1441-m	org.eclipse.buildship.feature.group	Eclipse Buildship
  EclEmma Java Code Coverage	3.1.1.201809121651	org.eclipse.eclemma.feature.feature.group	Eclipse EclEmma
  Eclipse IDE for Java Developers	4.10.0.20181214-0600	epp.package.java	Eclipse Packaging Project
  Eclipse Java Development Tools	3.16.0.v20181206-1038	org.eclipse.jdt.feature.group	Eclipse.org
  Eclipse XML Editors and Tools	3.12.0.v201811192212	org.eclipse.wst.xml_ui.feature.feature.group	Eclipse Web Tools Platform
  Git integration for Eclipse	5.2.0.201812061821-r	org.eclipse.egit.feature.group	Eclipse EGit
  Git integration for Eclipse - Task focused interface	5.2.0.201812061821-r	org.eclipse.egit.mylyn.feature.group	Eclipse EGit
  Java implementation of Git	5.2.0.201812061821-r	org.eclipse.jgit.feature.group	Eclipse JGit
  Jenkins Editor	1.5.0	de.jcup.jenkinseditor.feature.feature.group	Albert Tregnaghi
  m2e - Maven Integration for Eclipse (includes Incubating components)	1.10.0.20181127-2120	org.eclipse.m2e.feature.feature.group	Eclipse.org - m2e
  m2e - slf4j over logback logging (Optional)	1.10.0.20181127-2120	org.eclipse.m2e.logback.feature.feature.group	Eclipse.org - m2e
  Marketplace Client	1.7.3.v20181205-1546	org.eclipse.epp.mpc.feature.group	Eclipse Marketplace Client
  Mylyn Builds Connector: Hudson/Jenkins	1.16.0.v20180403-2055	org.eclipse.mylyn.hudson.feature.group	Eclipse Mylyn
  Mylyn Context Connector: Eclipse IDE	3.24.2.v20180905-0014	org.eclipse.mylyn.ide_feature.feature.group	Eclipse Mylyn
  Mylyn Context Connector: Java Development	3.24.2.v20180905-0014	org.eclipse.mylyn.java_feature.feature.group	Eclipse Mylyn
  Mylyn Task List	3.24.2.v20180905-0003	org.eclipse.mylyn_feature.feature.group	Eclipse Mylyn
  Mylyn Task-Focused Interface	3.24.2.v20180905-0014	org.eclipse.mylyn.context_feature.feature.group	Eclipse Mylyn
  Mylyn Tasks Connector: Bugzilla	3.24.2.v20180905-0003	org.eclipse.mylyn.bugzilla_feature.feature.group	Eclipse Mylyn
  Mylyn Versions Connector: Git	1.16.0.v20170629-1738	org.eclipse.mylyn.git.feature.group	Eclipse Mylyn
  Mylyn WikiText	3.0.25.201806201740	org.eclipse.mylyn.wikitext_feature.feature.group	Eclipse Mylyn
  Tip of the Day UI Feature	0.2.200.v20181107-2118	org.eclipse.tips.feature.feature.group	Remain Software
  Tycho Project Configurators	0.8.1.201704211436	org.sonatype.tycho.m2e.feature.feature.group	Sonatype, Inc.
  Wild Web Developer - Web edition in Eclipse IDE (Experimental)	0.1.0.201812201501	org.eclipse.wildwebdeveloper.feature.feature.group	Eclipse Wild Web Developer project
@jabby

This comment has been minimized.

Copy link
Member

jabby commented Dec 20, 2018

I don't know why it's ok on your side but not on mine. I think our environments are pretty similar.

@mickaelistria

This comment has been minimized.

Copy link
Contributor

mickaelistria commented Dec 20, 2018

See the console, while you start the debug adapter with node 7.10.1 (in the launch config), the app is running with node 8.12.0 and the same warning is sent. To override the node version used to start the app, you need to put something like "runtimeExecutable": "/path/to/node" in the json part (according to https://github.com/Microsoft/vscode-node-debug/blob/master/src/node/nodeDebug.ts#L296 )

@jabby

This comment has been minimized.

Copy link
Member

jabby commented Dec 20, 2018

I miss that point. I need to check my path. OK I will try your new PR if it works for me.
By the way do we need to support Node.js versions < 8.0. As I understand vscode-node-debug2 is the debugger for Node.js versions >= 8.0.

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