dotnet / roslyn

The Roslyn .NET compiler provides C# and Visual Basic languages with rich code analysis APIs.
https://docs.microsoft.com/dotnet/csharp/roslyn-sdk/
MIT License
19.07k stars 4.04k forks source link

Code completion doesn't adhere to indentation settings #58032

Open vsfeedback opened 2 years ago

vsfeedback commented 2 years ago

This issue has been moved from a ticket on Developer Community.


[severity:It's more difficult to complete my work] The normal¹ code completion doesn't adhere to the currently set indentation settings for the open document. Each code completion results in mixed indentation requiring additional actions to get consistent indentation again. Format document or selection also seem to ignore the previously set indentation option for the current document (tabs) and format the document/selection using spaces.

Disabling adaptive formatting showcases the same behavior.

VS Version: Microsoft Visual Studio Professional 2022 (64-bit) 17.0.1

¹ IntelliCode extension is disabled, no .editorconfig file in current workspace


image

image

image

image


Original Comments

Feedback Bot on 11/25/2021, 06:58 PM:

We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.

Feedback Bot on 11/29/2021, 09:57 AM:

Thank you for sharing your feedback! Our teams prioritize action on product issues with broad customer impact. See details at: https://docs.microsoft.com/en-us/visualstudio/ide/report-a-problem?view=vs-2019#faq. In case you need answers to common questions or need assisted support, be sure to use https://visualstudio.microsoft.com/vs/support/. We’ll keep you posted on any updates to this feedback.


Original Solutions

(no solutions)

sharwell commented 2 years ago

The ideal fix for this would involve ensuring the document options provided by GetDocumentOptionsAsync in code uses the explicit tabs/spaces values from the editor when none is specified in .editorconfig (or for cases where the value is explicitly changed, perhaps use that value instead of the one from .editorconfig).

CyrusNajmabadi commented 5 days ago

@akhera99 snippets not respecting tabs vs spaces?