New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compared to 0.9, 1.0.1 does not handle re-indentation correctly #90
Comments
I checked the |
I was able to narrow it down quite a bit:
In ST 4 the first definition of the function is not reindented properly. ST 3 does the job correctly. |
It seems to me that being confused about scope could be an explanation. |
More data: sublimehq/Packages#2550 (comment) |
The problem is apparently in the definition of comments:
I replaced this with the old definition
and the re-indentation on ST 4 works as well as on ST3. Edit: Actually, with the new definition re-indentation doesn't work when a block comment is present. Neither on ST 4, nor on ST3. |
It seems that @ViktorQvarfordt is the author of the comment definitions? Any ideas how to fix this properly, Viktor? |
Except for the issue of the block comments the proposed change makes the indentation work the same in ST 4 and ST 3. |
I always do no trust the auto-indentation feature of editors. If you want to format a document, it is better to use a code formatter, for example https://github.com/domluna/JuliaFormatter.jl |
That is true, I tried that package and it works great. However, the workflow is much smoother with re-indentation integrated into the editor. And most of the times it works just fine. |
By the way, I use re-indentation most often on just selections, not the entire documents. Then the use of a package to do that is much less attractive. |
I have pushed one more commit, all the comments code are ignored when applying indentation. function f(x)
# comment
x = 1
end
function(x)
#comment
x = 1
end
function(x)
#=
comment 1
comment 2
=#
x = 1
end
function(x)
#=
comment 1
comment 2
=#
x = 1
end becomes function f(x)
# comment
x = 1
end
function(x)
#comment
x = 1
end
function(x)
#=
comment 1
comment 2
=#
x = 1
end
function(x)
#=
comment 1
comment 2
=#
x = 1
end |
I don't know, this is what I got:
Edit 10/15: I don't know what happened last time, but when I redid this whole process of installing the PR, I got this result:
|
Did you fetch the PR? |
I downloaded the PR and made a package file from it. It did not work for me. Here's another example where the re-indentation does not work yet:
|
It gives me function flint_loadmesh(meshfile, nunref = 0, nref = 0)
# Mesh file in the format of the Abaqus .inp file
fens, fes = BEMScat.MeshingUtilities.loadmesh(meshfile)
if nodesperelem(fes) == 10
fens, fes = T10toT4(fens, fes) # Convert to linear tetrahedra
end
# The coordinates are in millimeters
fens.xyz .*= phun("mm") # The input file lists the coordinates of the nodes in millimeters
end which is what I expected. |
Okay, then I am perplexed.
|
When I simply copy the code
and try to re-indent it, then nothing happens. |
I wonder if you have applied the PR correctly. |
I downloaded the PR using Github desktop. |
I checked the TMPreferences files as well. I do seem to have all your changes. |
Would you like to try it out with my portable ST 4? |
Sorry to report but this still does not work correctly. When I try to re-indent, nothing happens. It stays the same. The other examples above work fine. |
#90 (comment): this is still not reindented properly. |
@randy3k : If the above sample re-indents properly in your ST, perhaps there's something different between our setups? Perhaps another package interferes? |
For instance, this code is not re-indented correctly when I do "select all" and "reindent":
ST3 with Julia-sublime package 0.9 can do it right.
The text was updated successfully, but these errors were encountered: