Explore using formatters for indentation adjustment when formatters are available
See original GitHub issueVSCode 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 beeditor.action.reindentLines
.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:10
- Comments:8 (4 by maintainers)
Top 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 >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 FreeTop 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
Top GitHub Comments
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:
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!
@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