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

Debugging TypeScript in non-root folder can't find corresponding JavaScript #973

Closed
AndrewFerr opened this issue Nov 20, 2022 · 1 comment · Fixed by #1064
Closed

Debugging TypeScript in non-root folder can't find corresponding JavaScript #973

AndrewFerr opened this issue Nov 20, 2022 · 1 comment · Fixed by #1064

Comments

@AndrewFerr
Copy link
Member

After using the fix for #960, if a debug session is launched for TypeScript file that resides within a subdirectory, the debugger is unable to find its corresponding JavaScript, even when the JavaScript has unambiguous source maps & a tsconfig.json file specifies the location of the JavaScript.

Steps to reproduce:

  • Initialize a new directory with npm/yarn & a Typescript installation, and make an Eclipse project out of it.
  • Write a tsconfig.json that includes at least "sourceMap": true & "outDir": "./<someOutPath>", and optionally "rootDir: "./<someSrcPath>".
  • Write a simple *.ts file in ./<someSrcPath> and compile it with tsc (and make sure it picked up the tsconfig.json by checking that generated the *.js file is in ./<someOutPath>).
  • Place a breakpoint on your *.ts file and debug it with Debug As > Node Application.

Results:
The debug session with fail with this error dialog:

Unexpected exception
org.eclipse.lsp4j.jsonrpc.ResponseErrorException: Cannot launch program '{path}' because corresponding JavaScript cannot be found.

Workarounds:

  • Run the generated *.js file with node --inspect-brk in a terminal (or with External Tool Configurations > Program), and attach to it with Debug Configurations > Running Node.js application.
  • Move the *.ts file to the root directory of the project (and remove "rootDir" from the tsconfig.json if it was specified), the recompile & relaunch the debug session.
@mickaelistria
Copy link
Contributor

I believe NodeRunDAPDebugDelegate is the what this can be improved. I suspect that source maps are not properly passed by Wild Web Developer to the Debug Adapter Protocol.

@mickaelistria mickaelistria transferred this issue from eclipse-lsp4e/lsp4e Nov 21, 2022
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 a pull request may close this issue.

2 participants