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

Source-map support #19

Open
franklin-ross opened this issue Oct 27, 2017 · 8 comments
Open

Source-map support #19

franklin-ross opened this issue Oct 27, 2017 · 8 comments

Comments

@franklin-ross
Copy link

Hey, I'd kill for source map support in this as we use Webpack to build a single output file. I don't think there's any way I can get this working as is.

Would you accept a PR for this? I don't think it'd be too hard from a cursory glance. Just replacing the 2 calls to sourceFile.getLineAndCharacterOfPosition(pos).line with something that goes further and pulls the source maps in. Does that sound right? The code I've seen using the source-map module seems fairly straightforward, and there's plenty of examples of it in the wild.

@CzBuCHi
Copy link
Collaborator

CzBuCHi commented Oct 27, 2017

im currently working on extracting all parsing and UI into separate package so i can use same code also for other test frameworks (specially jest). There i replaced typescript with babylon as source parser (typescript used here only because i didnt know better) and sourcemaps (almost always) works ... (except when vscode tries to load sourcemaps from src dir and not from out dir - wut?)

BTW: sourceFile.getLineAndCharacterOfPosition(pos).line it is used only for showing lenses - so it returns line from source not from bundle so sourcemaps arent neseseary...

@franklin-ross
Copy link
Author

franklin-ross commented Oct 30, 2017

But if the tests are run on a JS file that has source maps inside/beside it, then sourceFile.getLineAndCharacterOfPosition(pos).line is going to put lenses in the JS file, right? Not in wherever the source maps point.

Basically I want to be able to build a JS file however I want and run tests on it, then have the code lenses automatically follow source maps from that JS file back to whatever they were built from. So I might have 5 Typescript files and some build system producing 1 JS file with a source map. No other files. I don't want this extension to run on my Typescript files, I just want it to run on the JS file whenever that gets changed, but I want to see the codelenses in my Typescript files (or indeed, whatever strange language the source maps might point back to).

@CzBuCHi
Copy link
Collaborator

CzBuCHi commented Oct 30, 2017

Lenses are shown only in file, that is currently active.
Extension is mainly focused on debugging specific test (running all test is just 'bonus')

If u wanna run test on js when changes why not use plain old mocha cli in watch mode?

@franklin-ross
Copy link
Author

Ahhh, I see what you're saying. Running mocha in CLI watch mode is what I'm currently doing, I'd just love it if I had an extension that would mark up the file I'm currently viewing with the results as lenses.

Maybe I should think about writing a different extension, since it seems a little different from what you're aiming for.

@CzBuCHi
Copy link
Collaborator

CzBuCHi commented Oct 31, 2017

I could add ability to load test states from JSON file and watch that file for changes. (that would require some wrapper around mocha/Jest/whatever, that will save test results in 'my' json format - probably another set of packages and also some code that will update JSON when tests are executed from editor)

@franklin-ross
Copy link
Author

Hmmm. Seems like a lot of work, considering you're going through a rewrite at the moment.

@CzBuCHi
Copy link
Collaborator

CzBuCHi commented Nov 1, 2017

it was suprisingly simple to add json file for storing state and watch for changes ... in refactored code :/

@gusarov
Copy link

gusarov commented Dec 30, 2017

Hi! How it is going? I've tried TypeScript example and looks like it is still not working

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

3 participants