-
Notifications
You must be signed in to change notification settings - Fork 92
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
ark: Reindent Lines action doesn't match as-you-type indentation behavior #19
Comments
More likely, the issue here is that we use some fairly complex |
There's a couple things we could consider here:
I think the cleanest way forward would likely be (2), and it would also give us an extension point separate from VSCode (and so reduce the risk of upstream conflicts) |
Not necessary for MVP. |
@kevinushey Do you have any concrete examples that really highlight the problem you have in mind? As in, how do we suffer from this? I played around a bit with breakpoints in places suggested by the above links, but am having trouble forming a call to action without knowing exactly what we're trying to fix. |
Adding more notes about the complexity of indentation. Complexity in the sense that indentation comes about in several different ways. microsoft/vscode#111088: Summary: the
We have taken control of user-is-typing indentation, because we have microsoft/vscode#111089: This is a very concrete demo of what @kevinushey's getting at, i.e. indentation-as-you-type != indentation-via-reindent-lines. Official VS Code response:
Which highlights the fact that we need a formatter (#1407). Finally, I think the indentation (and formatting more generally) when you paste is yet another, third thing and I think also related to having registered a formatter.
The Editor: Auto Indent setting is relevant.
|
Interesting; it seems like this might "just work" now? I wish I had included an example in my initial report, but IIRC the |
Ah, no, I should have updated here. I have now experienced how different the indentation can be from "indent-as-you-go" vs. "Reindent lines". Although concrete examples are always welcome! But I get it now. |
Either way, it seems like "Reindent Lines" is mostly useless once you have language support for proper formatters... |
I guess "Reindent lines" is for the case when you want help re-indenting but you explicitly don't want other formatting opinions enforced on your file? But I agree it's a gesture we might decide we don't care deeply about. I think if we can make our |
Just noting that I am running into "as-you-type" indentation issues as well. Should that go into a separate issue? Note the indent increasing on every new line. library(dplyr)
mtcars |>
group_by(cyl) |>
mutate(mean = mean(mpg)) |>
arrange(desc(mean)) Screen.Cast.2023-10-10.at.10.50.56.AM.mp4 |
… 5.0 Merge pull request #19 from posit-dev/ts5 Updates to support TypeScript 5.0 -------------------- Commit message for posit-dev/positron-python@8c6a3c0: Updates to support TypeScript 5.0 Stricter type checking of decorators was fixed in TypeScript 5.0. Until Inversify is fixed to compile with these new requirements, temporarily disabling ts checking of the @Unmanaged decorator. Authored-by: Pete Farland <[email protected]> Signed-off-by: Pete Farland <[email protected]>
… 5.0 Merge pull request #19 from posit-dev/ts5 Updates to support TypeScript 5.0 -------------------- Commit message for posit-dev/positron-python@8c6a3c0: Updates to support TypeScript 5.0 Stricter type checking of decorators was fixed in TypeScript 5.0. Until Inversify is fixed to compile with these new requirements, temporarily disabling ts checking of the @Unmanaged decorator. Authored-by: Pete Farland <[email protected]> Signed-off-by: Pete Farland <[email protected]>
Jenny nicely summed up the problem, we really need a formatter to fix this. We have RC plans for a rudimentary indent-only formatter in #2251 (comment) so I'm bumping this issue to RC. |
It looks like VSCode has some separate code paths for handling indentation...
This is used for the "Reindent Lines" command:
https://github.com/microsoft/vscode/blob/06bd7ae776e2706a4aba2690d95788327dd16c43/src/vs/editor/contrib/indentation/browser/indentation.ts#L29-L139
This is used for regular as-you-type indentation:
https://github.com/microsoft/vscode/blob/06bd7ae776e2706a4aba2690d95788327dd16c43/src/vs/editor/common/languages/autoIndent.ts#L278-L364
Unfortunately, the indentation rules as currently constructed seem to behave well for as-you-type indentation, but not for the explicit Reindent Lines command.
The text was updated successfully, but these errors were encountered: