-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
autoindent with == doesn't work as expected #1574
Comments
I just noticed this too with Ruby! And I believe it was working just a week or two ago - seems like a regression |
Would you guys mind testing to see if this isn't a regression with VSCode itself e.g. that using VSCode's command palette to indent the line continues to work appropriately? |
Using the command palette to |
If you guys find that to be the case, I'd encourage you to post a bug on the VSCode repo. 😄 |
I did not have time to check this myself. If I find the same I will definitely file a bug report there. |
Reindent lines in VSCode seems to still work. So yeh, == is definitely not behaving as expected.. |
@xiaogwu So there's actually 2 commands relevant to this. One is the reformat command and one is the reindent lines. The re-indent lines doesn't let us choose a range, so we have to use reformat for now. |
Here's my workaround for now (this goes into vscode config):
|
@oswaldoferreira The difference is that reindentlines reindents the whole file, while = operates over a range. |
@Chillee Was about to edit the comment when noticed that! :/ |
have the same issue with vue, it prompts that |
I also have the issue that @xvjiarui describe NOTE
the issue is when I use I have disabled all other extension and re-installed vscodevim, without any results. thanks |
@SamuelTissot I have the same problem, but using vscode's built-in selection formatting (⌘K ⌘F) has the same result, so I don't think it's a vim plugin issue. I can format the whole file with ⇧⌥F or on :w save, so I'm using that as a workaround for now. |
Doesn't work the same since it indents the entire file. |
Hi, What is the default action bind to |
The problem is there are two types of formatters in VS Code:
When extensions only have document formatter, and you try to format a selection (such as Vue and Go), the message |
Make format operator (=) consistent with Vim8/NeoVim. - Format operator now operates on complete lines. - Cursor ends on first non-blank character instead of column 0. fix VSCodeVim#1574
Hey, so it's nearly 2020 right now and I'm just wondering if there's been any progress on this front? The problem is that typing |
@vegerot I assume you mean it should behave the same as |
So what is the actual solution here? As of today, I have the issue as well. |
If you'd like |
@J-Fields You're thinking exactly as posted in #1574 (comment) ? Or something different? It might be helpful to post a definite solution on this thread. |
The command that relates to the aforementioned one should now be:
but it's not working for me :-( Does not work on python or bash (conflicting things?), and for the settings.json actually, it does not consider selected lines, but seems to do the whole block (as some others have mentioned, so no progress there I guess). |
@madchap you can try |
But is == really supposed to format? The default behavior in vim seems to be to reindent current line from what I can find, might be wrong though. |
I agree with @albheim. If the behavior is to mimic vim, |
From the VIM documentation:
So it uses the internal formatting by default with the "indent" program being used as a last resort. So in this case by internal formatting we can consider the vscode formatting as being just that and it will apply differently according to which language is being used. |
Okay, you're right that it does seem to be intended to be customizable depending on what language is used, but I would argue that the intention of the command is only to do indentation. The "internal formatting" here, for instance, refers to the 'lisp', 'cindent' or 'indentexpr' programs (https://vimhelp.org/options.txt.html#%27equalprg%27), which, unless I am mistaken, accomplish indentation and nothing else. indentexpr also explicitly states that the command shouldn't alter text (https://vimhelp.org/options.txt.html#%27indentexpr%27). The different language formatters that are out there for VS code applies all kinds of formatting, which at least to me is a not what I would expect when using |
Maybe just making it a setting would be sufficient in this case? A completely different idea is to emulate https://github.com/Chiel92/vim-autoformat. |
My comment came from having some problems with indentation that seems to stem from vscodevim using format and julia-vscode not doing indentation on format for some reason (but supporting the reindent lines command). So I would probably also be happy enough if julia-vscode fixed it on their end. But a setting seems like a reasonable way to solve this, just be able to easily select if |
Anyone figure out a solution yet? 👀 |
It's nearly 2022 now, is there any way to reindent the current line correctly ?? |
It's nearly 2023 now, is there any way to reindent the current line correctly ?? |
There is as mentioned above
|
Wondering if we still can't use |
I can't see any mode in the list of VSCode Vim's Vim modes that would enable implementing this with motions ( |
Has this been solved yet? For me selecting code in visual mode, then using |
The VSCodeVim team prioritizes issues based on reaction count.
What did you do?
When I have this code in Python:
And when in normal mode with my cursor on the line
print('this should indent')
and press==
What did you expect to happen?
Indent of four spaces
What happened instead?
Nothing
Technical details:
The text was updated successfully, but these errors were encountered: