-
Notifications
You must be signed in to change notification settings - Fork 37
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
Tabbing a block of TLA+ doesn't preserve indentation of conjunct and disjunct lists #232
Comments
I think this issue is not solvable on the extension level. In this case VSCode indents each line independently, and indentation on Tab pressing means "move to the next nearest position that corresponds to the configured tab size for the language (which is 4 by default fot TLA+)". This is why you end up with a broken TLA+ formatting. Actually, it works the same way in any other language. In JavaScript this block: const foo = 10;
// ^^^ here's the name of the const becomes const foo = 10;
// ^^^ here's the name of the const And the extenstion cannot change this behaviour (formatter API doesn't capture tab indentations). Though, for TLA+ it's a bigger problem than for most of other languages because text indentation is significant for the meaning of the spec. Some other editors (IntelliJ IDEA, for instance) analyze the selected block as a whole before indenting it, and use the same indentation "distance" for all the lines. Given all this, I think, this issue should go to the VSCode project, there's nothing we can do here. BTW, we can help users with proper block formatting, here's the issue: #99. But it won't help with the described case. |
I'm putting the issue on hold until there's an API to fix it on the extension level, or it's fixed on the VSCode level. |
@alygin Is there a way to prevent tabbing until tabbing works reliably? I fear that users accidentally change the semantics of their specs. |
@lemmy, I'm not aware of an API that would help us here. There's the |
@lemmy, unfortunately, none of these links help much. I think, by "the indentation behaviour" he meant that there's Indentation Rules that a language configuration can provide. But those rules do not affect how tabbing works. And Python still has the same problem with tabbing. Other two links describe a different problem, they are about dichotomy between tab size and indentation size, which VSCdoe doesn't recognize out-of-the-box. |
It appears that when the VSCode editor configuration option "Use Tab Stops" is unticked, then a uniform amount of indentation is inserted across a set of selected lines, when pressing the tab key. This editor option is described in VSCode as:
|
Given that |
vs
Fortunately in this case, SANY caught it:
FWIW: The (Eclipse-based) Toolbox does the right thing when tabbing. :-)
The text was updated successfully, but these errors were encountered: