breakpoint atom juno


#1

Dear all,
I’m new to Julia. Can someone tell me how to set a breakpoint in the atom/juno editor? I’m considering switching from Matlab to Julia but I noticed that the atom/juno editor is a bit underdeveloped. Using breakpoints is really important when debugging
Thanks!!


#2

You can use Rebugger, insert

error("here's a breakpoint")

into the code, then use Meta-s to capture the stacktrace. (This is similar to dbstop if error where you create the error deliberately.)


#3

I disagree. It doesn’t have inbuilt breakpoints because the Julia debugger currently does not have that. But otherwise it is highly featured. Which IMHO is quite incredible when you consider that Juno has essentially been two people’s spare-time unsalaried project next to their studies, not the main interface to a hundreds-of-millions-dollar business like matlab’s editor.

Of course we can’t evaluate what you mean by this because you don’t expand further on how exactly it strikes you as undeveloped.

Thankfully, you still got a great answer that you can try out.


#4

I’ve been meaning to work on


for some time, but might actually get around to it soon :slight_smile: (once the remote process support is ready for a release).


#5

I agree, atom is a good editor, matlab’s editor feels very handicapped in comparison. Atom is highly customizable and supports plug-ins that make everyday coding much easier.


#6

Thanks a lot for your answer, I’ll give it a try!


#7

Being new to the Julia language I don’t know the Juno/Atom editor as well as I know the Matlab editor, so please take the following with a grain of salt.

  1. The most important are breakpoints for debugging. In my view this is the main issue.
  2. The error messages tell me the relevant line of code, but the iJulia cells do not tell me line numbers, so I had to manually count them.
  3. You can’t mouse-over end’s to see which if/for/while they relate to.
  4. Suppose I have generated the array A: in matlab editor I can ctrl-D over A (when debugging) and open it in a spreadsheet, to check values in real time. Can I do the same with Atom?
  5. You have a messy code with if-for-end not aligned: in matlab you can select the code and press ctrl+I to automatically indent. Can you do the same with Atom?

It would be great if the future releases of Atom could fix some of these issues, especially (1)


#8

Regarding point (2), you can easily display line numbers in IJulia/Jupyter.


#9

For 5, you can Ctrl+Shift+P and type “indent” to Toggle Auto Indent. Or you can add a new Keybinding as in https://stackoverflow.com/questions/22611377/how-to-auto-indent-code-in-the-atom-editor


#10

There are a bunch of discussions about the situation with debugging - you are not alone in wanting it, but the short answer is that there are other things that are higher priority among the core devs.

In any case, this is not a juno issue - if there were a traditional debugger, it would be integrated into juno (in fact, this used to be the case).


#11

I thought the Juno gets funded by Julia computing. It is incredible that it is done by unpaid volunteers. A good IDE really makes new adopters’ life much easier.


#12

For point 5, not sure if I configured something or not but I think you can select what you want to indent and press ctrl-m.

For what it’s worth, I spent about 15 years with Matlab, so you can imagine that I had some habits, to say the least. When I switched to Julia, I also had some growing pain, such as a need for breakpoints, a nice array viewer, etc. The thing is: Julia will not be similar to Matlab (and vice-versa!). You’ll have to adapt some of your workflow in the end. Now, after 2 years using Julia, I can say that I do no longer need a debugger, nor do I need an array viewer. The former is because I now heavily relies on small functions (which is easy to debug live in the REPL) an the latter is because I just plot the array to see if there’s something wrong with the data (or develop small debug functions to analyze the arrays). And finally, now that I use Atom/Juno on a daily basis, I really think that the Matlab editor is in fact really poor in terms of features and when I open Matlab, I actually use Atom for the nice syntax highlighting!

An alternative to Atom/Juno is VSCode with the Julia plugin. It’s another nice option.

For a nice workflow, I can’t recommend enough Revise.jl


#13

Juno actually has an array viewer, it’s visible in the first screenshot at http://junolab.org, titled “workspace”


#14

Frankly, I would not have high hopes for any free software project for which the people who really want it and the people who can write/maintain it are almost disjoint sets.

I think the most reasonable approach for a newcomer to Julia is to take a step back and re-evaluate their approach to debugging and programming style in general.

IMO the good question to ask is the following: the people who could write a debugger are apparently writing a lot of code. Judging from the issues, it has bugs. These are eventually fixed. So they must be debugging.

How are they doing it? What tools are they using? How do they structure their code to be comfortably manageable with these tools?


#15

I understand that people who will write a debugger decided that other things have priority. I regret it but but ofc understand it. But insisting that a need of a debugger is an indication of a poor coding style is frankly annoying.


#16

I really don’t think that’s what he meant. But, passions have been inflamed by this issue on this forum before. I think I speak for everyone when I say we don’t want to have that argument again :laughing:

No one is judging you for wanting a debugger, I promise. Everyone recognizes that it would be really useful. But we don’t have one, so what’s a new user to do? As @Tamas_Papp said, there are ways to efficiently write really good code without a debugger and that’s worth learning.


#17

I fully agree.