Reindent Lines commands don't work
See original GitHub issueDescribe the bug
Commands Reindent Lines, Reindent Selected Lines do nothing.
To Reproduce
- Create a file
temp.Rwith the following content:for(i in 1:2) { print(i) } - Use command
Reindent Lines; nothing happens - Select all lines
- Use command
Reindent Selected Lines; nothing happens
Contrast with JavaScript:
- Create a file
temp.jswith the following content:for (let index = 0; index < array.length; index++) { const element = array[index]; } - Use command
Reindent Lines; middle line is indented as expected
EDIT: For Javascript, it also works if only lines 2-3 are selected and the Reindent Selected Lines command is used.
Notes
Not sure if this is a vscode-R bug or a VS Code bug, as there seem to be quite a few VS Code issues related to reindenting, e.g., https://github.com/microsoft/vscode/issues/19847
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:5
Top Results From Across the Web
VS Code 'Reindent Lines' is not working properly #45849
Reindent command is using 4 indentation rules to adjust the indentation and that's not always accurate. When reindenting a large content, we ...
Read more >python 2.7 - reindent.py - Does not work from the command line
So I downloaded reindent.py to correct the indentation errors. I installed reindent.py using the following command-: pip install reindent. But I ...
Read more >indent Command - IBM
The indent command fits as many words (separated by blanks, tabs, or new-lines) on a line as possible. Blank lines break paragraphs. A...
Read more >Auto Indentation - EmacsWiki
Add something along the following lines to your .emacs : ... Seem that electric-indent-mode doesn't work properly with python-mode.
Read more >indentation - \noindent before command not working - TeX
Your macros \InsertTextA and \InsertTetxB expand to space (tokenized from the end of the line) followed by This is some text. (or \noindent ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Thanks @andycraig. Sorry, I did not read this thread properly and concluded from our Twitter discussion that styler was the bottleneck. If you want to use styler to build your own command for indenting lines, at least you now have the tools to do so. Doesn’t look like there is much progress on the Microsoft language server side of this issue at the moment…
Thanks @lorenzwalthert. At present the VS Code command
Reindent Linesuses a language’s indentation rules, not the language server. So styler supporting reindentation only wouldn’t help withReindent Lines, although we could (for example) add our ownR: Reindent Linescommand. VS Code may add language server reindentation at some point: https://github.com/microsoft/vscode/issues/19847