JStack icon indicating copy to clipboard operation
JStack copied to clipboard

VSCode-compatible line number output

Open Gama11 opened this issue 8 years ago • 15 comments

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?

Gama11 avatar Mar 03 '17 10:03 Gama11

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.

RealyUniqueName avatar Mar 03 '17 10:03 RealyUniqueName

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

Gama11 avatar Mar 03 '17 11:03 Gama11

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

Gama11 avatar Mar 03 '17 11:03 Gama11

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

RealyUniqueName avatar Mar 06 '17 14:03 RealyUniqueName

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 avatar Mar 06 '17 15:03 Gama11

There was a feature request here, but it was turned down: https://github.com/fdorg/flashdevelop/issues/301

Gama11 avatar Mar 06 '17 15:03 Gama11

Try with

-D JSTACK_FORMAT=vscode

RealyUniqueName avatar Mar 06 '17 19:03 RealyUniqueName

Thanks, works great! :)

Gama11 avatar Mar 06 '17 20:03 Gama11

Even though this issue has been closed already, I didn't get how to implement what'd been said under https://github.com/Microsoft/vscode/issues/586#issuecomment-159401495 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 "::".

AndreasLuckert avatar Sep 17 '19 17:09 AndreasLuckert

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

RealyUniqueName avatar Sep 17 '19 20:09 RealyUniqueName

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 :)

AndreasLuckert avatar Sep 19 '19 12:09 AndreasLuckert

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

RealyUniqueName avatar Sep 19 '19 20:09 RealyUniqueName

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.

AndreasLuckert avatar Oct 25 '19 08:10 AndreasLuckert

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

RealyUniqueName avatar Oct 25 '19 14:10 RealyUniqueName

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!

AndreasLuckert avatar Oct 27 '19 18:10 AndreasLuckert