You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In VSCode 0.10.6 the "end" in ruby doesn't gets indented after writing it. It should be handled like the brackets in Javascript.
Left: VSCode, Right: Atom (Gif. Reload to see it again)
Reacted by Mark Yan, otodo, Gabriel Siedler, ret-Phoenix, Roman Syuzyov, Austin Horning, maruware, Michael Raimondi, Matthew Mayer, Gabriel Pereira and 88 more
Firstly we have snippets in my ruby extension so each time you type def you will get correctly indented end. So it's likely a workaround.
Secondly, I think we have this auto indenting feature but unluckily I found it not working right now. I'll let you guys know when I have more info, then this issue can be treated as external.
But when we come to decreaseIndentPattern, we are running into some problems. The documenation in TextMate site is not that clear, when a line matches decreaseIndentPattern regex, should we unindent the current line or lines after? IMHO, it should be current line as any previous line has additional indentation and it's the right time to unindent. This is also how Atom does it.
However, in our implementation as below
/**
* Describes indentation rules for a language.
*/
export interface IndentationRule {
/**
* If a line matches this pattern, then all the lines after it should be unindendented once (until another rule matches).
*/
decreaseIndentPattern: RegExp;
Per comments we put in the definition, we are unindenting lines after but not the current line. I'm not sure if it's the root cause, but this makes end never gets correct unindentation.
There is also a long bebate to add decreaseNextIndentPattern to Atom in atom/atom#6808 so I think we need to rethink what's the correct behavior of decreaseIndentPattern. I'll give TextMate a try once I'm back to my Mac to see what's the default behavior, before that I'd like to hear your voices. alexandrudima , any thoughts?
To support decreasing the current line indent, the EnterAction must be extended with an additional type of IndentAction, a new one maybe called OutdentInclusive or something and it must be adopted everywhere where EnterAction is interpreted.
Are there any updates on this? It's the one crutch for developing ruby apps using VS Code
Reacted by Alessandro Mencarini, Nathan, itsMapleLeaf, Alex Hermstad, David Foster, Debjeet Biswas, Elliot Larson, Ivan Storck, Damon Aw, Kabiru Mwenja and 12 more
To add my voice, as a newcomer I'm extremely happy with VS Code but this just seems odd. If this works for curly-brace languages, I can't see the logic in not implementing this same behavior for languages which terminate blocks with end.
You can now set editor.autoIndent to true in today's Insider to embrace this feature, thank you all for your patience and help on this! Feedback welcome.
Reacted by Kyle Pollich, Evgenii Morozov, Pavel Puzin, Tim Ross, Kayla Harris, Jonathas Dantas, Gary, Matt Bettinson, Sean Roberts, Tim Sabat and 7 more
Reacted by Matt Bettinson, Tim Sabat and Kabiru Mwenja
Reacted by Kyle Pollich, Jason Filipe, Ivan Storck, itsMapleLeaf, Drew Dara-Abrams, Vladimir Pouzanov, Evgenii Morozov, Michał Buczek, Pavel Puzin, Stan Bright and 8 more
Reacted by Denis Barushev, Matthew Mayer, Evgenii Morozov, Kayla Harris, Andrii Dmytrenko, Matt Bettinson, Tim Sabat and altla
Search for editor.autoIndent in settings and change it to true
Reacted by Menachem Hornbacher, edward, Otávio Schwanck dos Santos, Wowdyaln, Rob Wilson, yokoyama tatsuo, Ash McKenzie, Chad Nate Mardini, Spencer Horn and Eric Sauter
Reacted by Spencer Horn, Qiang Guo, Eric Sauter and Anwar
Activity
markediez commentedon Feb 21, 2016
I'm guessing this will come in the next release?
markediez commentedon Apr 14, 2016
Any update on this?
kyleect commentedon Jun 9, 2016
+1 for this feature
Tyriar commentedon Jun 10, 2016
Peng Lyu (@rebornix) does your ruby extension do this?
rebornix commentedon Jun 10, 2016
Firstly we have snippets in my ruby extension so each time you type
defyou will get correctly indentedend. So it's likely a workaround.Secondly, I think we have this auto indenting feature but unluckily I found it not working right now. I'll let you guys know when I have more info, then this issue can be treated as external.
rebornix commentedon Jun 13, 2016
I'm trying to support correct indentation as Atom does, and find following interesting difference between VS Code, Atom and TextMate.
TextMate documents
increaseIndentPatternanddecreaseIndentPatternat https://manual.macromates.com/en/appendix .increaseIndentPatternmatches a starting line and any lines after it will have an additional indentation, this functionality is handled correclty in all editors.But when we come to
decreaseIndentPattern, we are running into some problems. The documenation in TextMate site is not that clear, when a line matchesdecreaseIndentPatternregex, should we unindent the current line or lines after? IMHO, it should be current line as any previous line has additional indentation and it's the right time to unindent. This is also how Atom does it.However, in our implementation as below
Per comments we put in the definition, we are unindenting lines after but not the current line. I'm not sure if it's the root cause, but this makes
endnever gets correct unindentation.There is also a long bebate to add
decreaseNextIndentPatternto Atom in atom/atom#6808 so I think we need to rethink what's the correct behavior ofdecreaseIndentPattern. I'll give TextMate a try once I'm back to my Mac to see what's the default behavior, before that I'd like to hear your voices. alexandrudima , any thoughts?alexdima commentedon Jul 5, 2016
Peng Lyu (@rebornix) I followed https://manual.macromates.com/en/appendix while implementing it.
I think I got wrong the semantics of
decreaseIndentPattern(it should probably decrease the current line too).The implementation is at https://github.com/Microsoft/vscode/blob/master/src/vs/editor/common/modes/supports/onEnter.ts#L128
To support decreasing the current line indent, the
EnterActionmust be extended with an additional type ofIndentAction, a new one maybe calledOutdentInclusiveor something and it must be adopted everywhere whereEnterActionis interpreted.coderberry commentedon Oct 26, 2016
Are there any updates on this? It's the one crutch for developing ruby apps using VS Code
15 remaining items
StanBright commentedon Apr 26, 2017
I started using VSCode 2 days ago, moving from Sublime, and I love it. This, however, is one of the few things that annoys me at the moment...
zebogen commentedon May 4, 2017
Agreed. I love VS Code thus far, but I'm switching back to Atom for Ruby development just because of this.
coleby210 commentedon May 11, 2017
VSCode is by far my favorite editor, except for this. Would absolutely love to see this implemented.
emitchel commentedon May 24, 2017
VSCode is awesome, I've gotten around this by Shift+TABing following
endbut VSCode NEEDS to update this.seivan commentedon Jun 14, 2017
Not just indentation, but also highlighting do/end brackets for languages like
RubyorElixirIt works fine with braces
{ }but I'd like to see it fordo endas well.andyferris commentedon Jun 14, 2017
To add my voice, as a newcomer I'm extremely happy with VS Code but this just seems odd. If this works for curly-brace languages, I can't see the logic in not implementing this same behavior for languages which terminate blocks with
end.rebornix commentedon Jun 19, 2017
You can now set
editor.autoIndenttotruein today's Insider to embrace this feature, thank you all for your patience and help on this! Feedback welcome.mhornbacher commentedon Jul 14, 2017
This issue was reintroduced in the latest update
blackhaj commentedon Jul 18, 2017
Search for editor.autoIndent in settings and change it to true