quinnj / Sublime-IJulia

An IJulia Frontend for Sublime Text 3
90 stars 16 forks source link

Reindent fails with comments #48

Closed dpsanders closed 10 years ago

dpsanders commented 10 years ago

I was given some unindented (!) Julia code. In principle, Sublime Text can reindent it correctly using the same indentation algorithm. However, it seems to fail if there are commented lines within the blocks that should be indented. (Indentation reverts to 0 on those commented lines.)

quinnj commented 10 years ago

Can you post a code example? I can try to play around with it.

dpsanders commented 10 years ago

Here's a silly example: Initially everything was flat (unindented), then applying Edit->Line->Reindent gives

for i in 1:10
# a useless comment
println(i)
end

for i in 1:10
    print(i, " ")
    a = 0
# a useless comment
for j in 1:10
    a += i
    println(a)
end
end

The commented line and everything after it is immediately sent back to 0 indent level until the next block restarts the indenting. Boy is badly-indented code hard to read!

quinnj commented 10 years ago

Alright, I don't really know what's going on here, but as far as I can tell this is a sublime issue, not something specific to Sublime-IJulia. Sorry to not be more help.