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.

Explore using formatters for indentation adjustment when formatters are available

See original GitHub issue

VSCode 1.9 introduced initial support for line indenting as per the release notes, I think it’s this commit: https://github.com/Microsoft/vscode/commit/be1b5f75161a30dd63316b832067b41d2caec0b3. I’m very interested in this feature, big 👍 for bringing it into VSCode.

Here is some initial feedback:

  • I tried for a couple of file formats, it only worked for TypeScript and not e.g., for JSON or PHP.
  • Formatting (Alt+Shift+F) can already do indentation better than the new implementation, maybe it could be used as a fallback if the language doesn’t have proper indentation rules.
  • If I read the code correctly, it re-indents the whole file. It should respect my selection. For example, if I have only 10 lines selected, it should re-indent those. If I don’t have any selection, it should do the whole file.
  • The command is currently editor.action.reindentlines, proper casing would be editor.action.reindentLines.

Issue Analytics

  • State:open
  • Created 7 years ago
  • Reactions:10
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
dobriaicommented, May 14, 2017

FWIW: This feature is a life-saver for me. As much as I appreciate js-beautify, it seems that it cannot be told not to mess with my white-space. Trying to format something like this:

let aha          = 7;
let badahabadaha = 9;

mangles it, by trimming the white space in front of ‘= 7;’ and thus looses the ‘=’ alignment! Big deal and I just don’t see a way to turn this behavior off.

Reindent Lines seems to do whatever most other editors do, so this is the cure for me. But it is very important to have a version that works on the current selection only!

3reactions
rebornixcommented, May 12, 2017

@borekb sorry I don’t have time working on this issue this iteration but it’s on my radar, I received similar issues or feedback on this every other day

Read more comments on GitHub >

github_iconTop Results From Across the Web

Visual Studio Code Flutter Format is Not Working with My ...
When i use format code (Shift + alt + p) Codes indent space or tab size turn 2 and it will make me...
Read more >
When performing 'Format Document' on a XAML file, adjust ...
In your Visual Studio installation, please go to: Tools -> Options -> Text Editor -> XAML -> Formatting -> Spacing and select the...
Read more >
Manage SQL code formatting using SQL formatter options
By default, this option is used. It determines the appropriate indenting style to use. In the Tabs tab, it can be specified how...
Read more >
Customize or create new styles - Microsoft Support
If you want formatting choices that are not available from the built-in styles ... the formatting (such as font size, color, and text...
Read more >
Indentation style | ReSharper Documentation - JetBrains
Format code with spaces, tabs, and line breaks ... As there are many ways to configure indentation settings, you may want to learn...
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