forio / julia-studio

An IDE for the Julia Language
forio.com/products/julia-studio
GNU General Public License v3.0
223 stars 48 forks source link

Using array comprehension syntax causes code folding to break #225

Open DumpsterDoofus opened 10 years ago

DumpsterDoofus commented 10 years ago

I noticed that using array comprehension syntax inside of a function seems to confuse the IDE's ability to correctly fold code.

As a minimal example, consider the following working example:

fold bug 1

When you click the downward-facing arrow on the left, the function is collapsed correctly:

fold bug 2

Now let's try it with the following code:

fold buf 3

Clicking the arrow does this:

fold bug 4

This looks innocent enough until you realize that in a non-minimal example, all of the code underneath the function tempfunc would be folded into the body of tempfunc, including code which does not even belong in the body of tempfunc's definition.

This effectively makes it impossible to both use array comprehension syntax and still have the code-folding work properly on screen. The code itself executes properly, of course, but the array comprehension seems to confuse the IDE into incorrectly swallowing up every line of code underneath.

I suspect the reason has something to do with the fact that in a normal for loop, it begins with for and ends with end, but in array comprehension syntax, it begins with a for, but there is no end, and so the IDE searches for the next available instance of end, which typically belongs to an unrelated body of code, or (in the case of the minimal example above) does not exist. I haven't tested this on other platforms (I'm using Julia Studio 0.4.4 on Mac OS X 10.6), but it shouldn't be hard to test on other systems.

Other than this and some syntax-coloring issues I've been having, the software has been pretty fantastic.