question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Reindent Lines commands don't work

See original GitHub issue

Describe the bug

Commands Reindent Lines, Reindent Selected Lines do nothing.

To Reproduce

  1. Create a file temp.R with the following content:
    for(i in 1:2) {
    print(i)
    }
    
  2. Use command Reindent Lines; nothing happens
  3. Select all lines
  4. Use command Reindent Selected Lines; nothing happens

Contrast with JavaScript:

  1. Create a file temp.js with the following content:
    for (let index = 0; index < array.length; index++) {
    const element = array[index];   
    }
    
  2. 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:open
  • Created 3 years ago
  • Reactions:1
  • Comments:5

github_iconTop GitHub Comments

1reaction
lorenzwalthertcommented, Jan 3, 2021

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…

0reactions
andycraigcommented, Jan 3, 2021

Thanks @lorenzwalthert. At present the VS Code command Reindent Lines uses a language’s indentation rules, not the language server. So styler supporting reindentation only wouldn’t help with Reindent Lines, although we could (for example) add our own R: Reindent Lines command. VS Code may add language server reindentation at some point: https://github.com/microsoft/vscode/issues/19847

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found