Closed minkir014 closed 3 years ago
Hi @minkir014 , we have looked into both Debug Adaptor Protocol (DAP) and Mathematica debugger in the Frontend, but neither of them is easy to start with. we will leave this as an open discussion and hope there will be a solution someday in the future.
You can you use Mathematica already existing debugger and start with the debug protocol.
Do you know if we can debug wolfram can be debugged on gdb like MATLAB?
AFAIK, this won't be easy. The debugger is from the Frontend package, they need GUI to set the breakpoints and so on. There is no text-based debugger and the related functions are not documented.
I know it isn't easy but we have to start and not be afraid. Secondly, you don't need to make a GUI you have vscode GUI you only have to connect vscode Debug API to that package so they work together to make a great debugger.
We may not prioritize this at the moment. I'm working on something more important for the next release that may eventually helpful for debugging. But, you are right, I won't give it up.
I know it'll take time but I can help you. First, Can you send me the link of the debugger package. I can't get alone without Wolfram branch. Send me the link so that I can help you.
@kenkangxgwe please send me the link as fast as you can.
There is no such an isolated package (or link if you insist), you may only access to it from inside the Mathematica. It is GeneralUtilities`Debugging`
. If you type Names["GeneralUtilities`Debugging`*`*"]
, you may see all the functions and variables in that package.
Ok, I'll begin working on the debugger but I'll need some. So, stay with me in communication.
Does your extension includes error detection?
@kenkangxgwe Are you here???
Yes, we leverage the GeneralUtilities`Packages`PackagePrivate`findFileSyntaxErrors
to reveal the errors. But the types of errors and warnings it can find is limited. I will consider enhancing it some day. I am not able to always be online recently, so please feel free to leave messages here. I will response to them ASAP.
OK, thanks for response. One thing, have you noticed that there isn't any debugger for wolfram. The debugger wolfram branch provides is for matlab?
As I said, there is a GUI debugger, but I am not sure if you may access it w/o the FrontEnd.
This isn't for .wl
and .wls
files. It's for mathematica
only.
You may debug the .wl
and .wls
files as well inside Mathematica. The debugger is not extracted from the FrontEnd. The best thing I can think of is to find the function for the GUI debugger and imitate it to implement a non-FE based debugger.
Some references that might help you if you want to mimic the Mathematica debugger:
I partially understood how mathematica
debugger works. It sends commands to the terminal and tells it if to compile or stop at line and uses its inspect to show variables. We could use vs code debugging APIs for that. Second, we must make a wolfram debugger for MATLAB and that wouldn't be hard because there is a language server for MATLAB and the debugger is ready. The only thing we will have to do is to allow breakpoints for MATLAB and this is very easy.
Sorry, but how is the wolfram debugger related to MATLAB, could you please elaborate?
See this video on wolfram
own website and you'll understand.
http://www.wolfram.com/broadcast/video.php?c=93&v=890
OK, what you showed is the Wolfram Workbench, a commercial plugin for Eclipse. But how is it related to MATLAB?
I know it's wolfram workbench. And about how it is related to MATLAB. Have you seen the debugged file extension. It's .m
.
.m
extension is not only for MATLAB, but it may also indicate a wolfram package (alternative to .wl
) or a Objective-C file.
You are right. The syntax is for Wolfram not for MATLAB. I didn't take care of that.
About error detection there are two packages called AST
and Lint
. They can help you.
See this link https://mathematica.stackexchange.com/a/192690
See you can use Lint
and preview the result in the problems part in vs code.
Hi @minkir014 , Thanks for opening this issue and I think your feature request is partially fulfilled by v0.3.0 after 2 yrs. I'd like to close this issue and continue improving on the existing debugging feature. Glad you mentioned the two packages which helped this project a lot.
This extension is very good but it needs a debugger to be completed.