vscode-csharp icon indicating copy to clipboard operation
vscode-csharp copied to clipboard

Indentation doesn't seem to take the braces into account

Open davidfowl opened this issue 1 year ago • 4 comments

https://github.com/dotnet/vscode-csharp/assets/95136/0a026967-f62d-44f9-9808-645fa050538a

davidfowl avatar May 27 '24 05:05 davidfowl

Thanks for reporting this. There’s more to be added, please let me know if this is the same issue: when you click on a blank line let’s say within a method, in between two lines of code in the method, the IDE mistakenly puts your cursor at zero indentation, forcing you to manually enter a couple tabs (etc) to get to proper indentation level (if you format doc, where it would place your cursor with proper number of tabs). Visual Studio obviously gets this right. While this may not seem like much of an inconvenience, where this is a massive frustration is on your first or second tab, intellisense / intellicode / gitlens (etc, any of these) suggests a code snippet and on one of the tabs inserts it! It’s enough to make you want to leave this IDE.

Perhaps a separate issue here is if there were a setting to not insert / suggest a line of code when only tab has been entered (as opposed to a character or underscore).

copernicus365 avatar May 27 '24 15:05 copernicus365

@copernicus365 not sure but videos are worth 1000 words in this context.

davidfowl avatar May 27 '24 15:05 davidfowl

Interestingly, I cannot reproduce this, it seems to indent the line as I would expect: indentation

Can you still reproduce this? If so, what is VSCode detecting as the indentation kind in the bottom right bar?

Note that indentation is controlled by VSCode itself. We have some amount of customization we can do via language-configuration.json but we don't actually perform the action on the extension side.

dibarbet avatar Jun 20 '24 01:06 dibarbet

Looks like there is a 3 space indentation in the original example source. The code is being moved to the next indentation level, which is only 1 space away. I am not sure if the LSP is doing the indentation in Code or if Code is working it out based on the language definition.

JoeRobich avatar Aug 02 '24 22:08 JoeRobich