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

How can I configure this adapter to work with source files? #82

Open
mkaulfers opened this issue Mar 6, 2023 · 2 comments
Open

How can I configure this adapter to work with source files? #82

mkaulfers opened this issue Mar 6, 2023 · 2 comments

Comments

@mkaulfers
Copy link

mkaulfers commented Mar 6, 2023

I have a TypeScriptToLua transpiler package I'm working on, and I'd love to get this working with it such that I can breakpoint/step through original source code. Is this a flag that I can set in a configuration? For more context, feel free to look at my current source code for the package I'm attempting to set it up on.

www.github.com/mkaulfers/create-typed-factorio.

With the current setup, I'm able to set breakpoints within the lua files themselves, and have been toying around with enabling the map files for translation. So far, unsuccessful.

@justarandomgeek
Copy link
Owner

justarandomgeek commented Mar 9, 2023

Unfortunately, it's not quite that simple.

I looked into reading the TS sourcemaps before but there's a few problems:

  1. Sourcemaps assume all locations have a column. Lua doesn't have column information at all. This by itself would be relatively minor, except it severely exacerbates the next problem.
  2. The sourcemaps TStoLua produces are completely lacking mappings for many output lines, which seems to be invalid based on the way the sourcemap library behaved when attempting to map through them (i forget now whether it throws or just returns null, but it's impractical to deal with).
  3. DAP frequently wants to convert the line/column/path information individually, which seems to be completely incompatible with sourcemaps needing it to always map as a complete "location", when combined with the differing location-styles.

But it's been a while since I tried to hook this up, so when i finish my current pipe reworks i'll see if they've fixed any of that...

@mkaulfers
Copy link
Author

You know, there could be some "Hacky" things that could be done with it. Perhaps wrapping the entry point with some function then sends it back to the debugger if an exception occurs. If you get around to checking it out, I'd love to help. I have some capacity for working on Open Source projects, and this is one I'd be keen to help with.

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

No branches or pull requests

2 participants