[Lua] Reindenting does not work after commenting on a line
After you add a comment to a line in lua, it no longer reindents correctly. This only happens with lines that have comments on them, and it messes up all future lines that would otherwise be indented.
Example: https://embed.gyazo.com/c4e1c0b0256129d349ba7de997cc4cdf.png
Your example works fine for me in Build 3118. However, if a comment is on it's own line, then it won't have it's indentation altered by ST when using the reindent command, and this will affect the indentation of subsequent lines.
It seems comment detection is a bit over-eager as the commit on the same line prevents any indentation increase from happening, even if the comment is not entirely on its own line. Looks very related to https://github.com/SublimeTextIssues/Core/issues/1271.
If I start out with
function test()
if a == "abc" then -- comment here
for x, b do
stuff
end
end
end
and run the reindent command, it changes to
function test()
if a == "abc" then -- comment here
for x, b do
stuff
end
end
end
Whereas, if I start with
function test()
if a == "abc" then -- comment here
for x, b do
stuff
end
end
end
it correctly indents to
function test()
if a == "abc" then -- comment here
for x, b do
stuff
end
end
end
Oh, silly me - I was trying with the Packages/Default/Indentation Rules - Comments.tmPreferences file overridden to fix it, so of course it worked for me - apologies ;)
I can confirm the same, but it is not a problem with the Lua package, it's a problem with the Core ST3 indentation system. Similar problems with Python etc.
If it's a problem with the core, should I go mark it as a bug there?
I saw this was open when I searched for Lua issues just now, this has been fixed since the rehaul of the entire Lua SH
I saw this was open when I searched for Lua issues just now, this has been fixed since the rehaul of the entire Lua SH
Seems still broken for me. (Not that I'm a Lua user... yet.)
function test()
if a == "abc" then -- comment here
for x, b do
stuff
end
end
end
indents to
function test()
if a == "abc" then -- comment here
for x, b do
stuff
end
end
end
Yeah, indentation rules depend on scopes on eol. As indentation rules' selector excludes comments ...