dotnet / dotnet/vscode-csharp

Indentation removed on empty lines when Format Document is used

Open
#1,980 41 comments 42 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
3.1k
Forks
737
Avg merge
18h 40m
Merged PRs (30d)
31

Description

![Imgur](https://i.imgur.com/c45Zb9f.gif)

VS Code version: Code 1.19.2 (490ef761b76b3f3b3832eff7a588aac891e5fe80, 2018-01-10T15:55:03.538Z)
C# Extension version: 1.13.1

## Steps to reproduce
Make multiple new lines in an indented code block, then

- right click the workspace and choose "Format Document"
- use FormatOnType, FormatOnPaste, etc., to automatically format the document
- press Ctrl-Shift-I to auto indent document

## Expected behavior
All lines retain their indentation

## Actual behavior
Any lines in the document without code have their indentation removed

I have narrowed this down to this plugin, as this behavior isn't seen in VSCode when extension is disabled. I have tried every combination of white space trimming, etc., with no solution.

See [Reddit thread](https://www.reddit.com/r/vscode/comments/7sifqk/indentation_problems/).

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.