Skip to content
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

Indent using == or = on visual selection does not properly indent #4205

Open
kschaab opened this issue Oct 22, 2019 · 3 comments
Open

Indent using == or = on visual selection does not properly indent #4205

kschaab opened this issue Oct 22, 2019 · 3 comments

Comments

@kschaab
Copy link

kschaab commented Oct 22, 2019

Describe the bug
I have been able to reliably reproduce this in json files, but not in other languages. Using == or = on visual selection does not always indent properly.

To Reproduce
In JSON if you have an improperly indented line and hit == it will not indent. However, let's say the previous line is indented properly, if you hit 2== from that line then the line that would not indent will now indent. It also works properly in select mode if there are lines that are indented properly in the selection.

{
    "naut.auto-install": true,
"typescript.preferences.quoteStyle": "single",
    "typescript.referencesCodeLens.enabled": true
}

== on line 3 does nothing
2== from line 2 indents line 3 as expected
= on 2 selected with 3 works as expected
= on 3 and 4 selected deindents 4 (not expected)

Expected behavior
== is contextual and should indent based on surrounding code.

@pseyfert
Copy link

let me add (background info: out of habit I use =j instead of ==. =j should apply "the correct indentation to the current and the following line, such that they match the previous line)

=j on line 3 in vim would indent line 3 (and it would indent 4 if there was anything to be done with line 4)

=j with vscodevim leaves line 3 and deindents line 4.

@ph0ngp
Copy link

ph0ngp commented Aug 19, 2020

@kschaab try putting this into your keybindings.json

    {
        "key": "= =",
        "command": "editor.action.reindentselectedlines",
        "when": "editorTextFocus && editorLangId == jsonc && vim.active && vim.mode == 'Normal'"
    }

@kschaab
Copy link
Author

kschaab commented Aug 29, 2020 via email

@J-Fields J-Fields changed the title Indent using == or = on visual selection does not properly indent Indent using == or = on visual selection does not properly indent Oct 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants