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

VSCode-compatible line number output #6

Open
Gama11 opened this issue Mar 3, 2017 · 15 comments
Open

VSCode-compatible line number output #6

Gama11 opened this issue Mar 3, 2017 · 15 comments

Comments

@Gama11
Copy link
Contributor

Gama11 commented Mar 3, 2017

JStack combos really well with VSCode's output panel, because it detects file paths and makes them clickable:

However, as you can see, it only takes me to the file (first line), not the correct line number in that file. This comment suggests that #lineNumber works, and sure enough, after hacking that into Callstack.itemToString(), this works perfectly:

Could this be supported by jstack somehow? I guess you'd have to re-implement Callstack.itemToString(), and also differentiate by OS (that comment suggests that the syntax for Mac is different right now, don't know about Linux).

Not sure if this should be the default behavior or configurable in some way - depends on whether or not other tools rely on the current output format I guess?

@RealyUniqueName
Copy link
Owner

It's a nice feature to have.
That definitely should not be a default behavior and should be configurable, because different IDEs may rely on different position syntax.

@Gama11
Copy link
Contributor Author

Gama11 commented Mar 3, 2017

Something like -D JSTACK_FORMAT=<DEFAULT|VSCODE> maybe?

@Gama11
Copy link
Contributor Author

Gama11 commented Mar 3, 2017

It might also make sense to detect the presence of the vscode externs (#if vscode) and switch the default to VSCODE in that case.

@RealyUniqueName
Copy link
Owner

@Gama11 do you know if HaxeDevelop have a pattern for clickable file names in output panel?

@Gama11
Copy link
Contributor Author

Gama11 commented Mar 6, 2017

I don't think FD has links inside the output panel - it does however parse the output and check for certain patterns, for instance lines that look like Haxe error messages. Those then appear in the Results panel.

https://github.com/fdorg/flashdevelop/blob/5.2.0/External/Plugins/ResultsPanel/PluginUI.cs#L657

@Gama11
Copy link
Contributor Author

Gama11 commented Mar 6, 2017

There was a feature request here, but it was turned down: fdorg/flashdevelop#301

@RealyUniqueName
Copy link
Owner

Try with

-D JSTACK_FORMAT=vscode

@Gama11
Copy link
Contributor Author

Gama11 commented Mar 6, 2017

Thanks, works great! :)

@AndreasLuckert
Copy link

Even though this issue has been closed already, I didn't get how to implement what'd been said under
microsoft/vscode#586 (comment) in order to achieve the desired output:

Where do I have to insert "::" (in combination with "Callstack.itemToString()" ??) that the vs-code console shows me something like
"~/path/script.py in project_variable_return(..), line 66" I can jump directly to via Ctrl + Left-click, instead of having (in my case the default) output where only the file is clickable, but not the line mentioned in the error output:
~/path/script.py in project_variable_return(..)
64 blabla = "bla"
65 if not os.path.exists(blabla):
---> 66 os.mkdir(blabla)

Thanks in advance for stating more clearly how (or WHERE) to implement "::".

@RealyUniqueName
Copy link
Owner

It's because jstack only handles js and php targets currently. I should probably update it to at least format callstack on other targets.

@AndreasLuckert
Copy link

So you mean for python in vscode it wouldn't work?
Given that I'd work, I'd appreciate to know step by step how to implement the aforesaid, because so far I only have <path>:<line>:<column>, but not where and how.
Thanks in advance :)

@RealyUniqueName
Copy link
Owner

You need to copy-paste haxe.CallStack module to your project and rewrite CallStack.toString accordingly

@AndreasLuckert
Copy link

Thanks for the tipp. Unfortunately, I don't know how to carry out what you write.
Do you mean that I need to open the SETTINGS-json-file and add a line there containing something like haxe.CallStack.toString: <path>:<line>:<column> ?
Apart from that, as I work with python scripts, I don't have a specific "project" defined nor does it involved anything with "haxe".
Well, I'd be grateful if you could illustrate more step-by-step how to implement what you mentioned. I hope it's possible for python debugging, and not only for haxe.

@RealyUniqueName
Copy link
Owner

Oh, if you work with the python itself (not with haxe->python), then I don't know how to help you. Sorry.

@AndreasLuckert
Copy link

Alright, thanks for your time. I hope to find some way elsewhere, but if anyone knows a solution, please post it here.
Thanks in advance and cheers!

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