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.05k stars 4.03k forks source link

Settings > Text Editor > C# > Code style > Formatting > Spacing - Not all previews work #53332

Open vsfeedback opened 3 years ago

vsfeedback commented 3 years ago

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


[severity:It's more difficult to complete my work] [regression] [worked-in:16.9] Repro steps:

  1. Open a C# project.
  2. Open Text Editor > C# > Code style > Formatting > Spacing
  3. The following settings don't update the preview pane when toggled with the space-bar or mouse-click on the checkbox:
    • "Insert space within parentheses of expessions"
    • "Insert space within parentheses of type casts"
    • "Insert space after cast"
    • "Insert space before open square bracket"
    • And many others. Many options' previews do work, but not others. I can't see a pattern as to why some work and others don't.

Original Comments

Feedback Bot on 5/10/2021, 07:40 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.


Original Solutions

(no solutions)

Youssef1313 commented 3 years ago

I can't reproduce. It works for me.

daiplusplus commented 3 years ago

@Youssef1313 I can reproduce it consistently. VS16.9.5.

ElimGarak commented 2 years ago

I can reproduce this bug with C++ code, in VS2019 (16.11.12), VS2022 (17.2.0), and VSCode (1.66.2).

The previews work but the formatting of the code does not change after you select Format Document. Spaces within parenthesis of function calls are not being inserted.

CyrusNajmabadi commented 2 years ago

@ElimGarak did you mean to say C++? Roslyn definitely doesn't have anything to do with that.

bravequickcleverfibreyarn commented 2 months ago

Microsoft Visual Studio Enterprise 2022 Version 17.11.2 VisualStudio.17.Release/17.11.2+35222.181

Still exists. Behavior:

preview not switch after selection, checkbox change only triggers preview

preview not switch but change works (implies preview trigger)

preview switches but change does nothing

Spacing

CyrusNajmabadi commented 2 months ago

Still exists

The issue is on the backlog. So it will likely only be fixed if it gets moved to a particular release, or if a community member contributes a fix. Thanks!

daiplusplus commented 2 months ago

or if a community member contributes a fix

...only if the responsible program-code for this issue is 100% in the Roslyn codebase in this repo and not the Visual Studio codebase.

Are you confident that it is in Roslyn (and not the non-Roslyn parts of VS) - if so, is there any documentation about the code-formatting-preview feature so we can try to fix it ourselves?

CyrusNajmabadi commented 2 months ago

This code is in the Roslyn codebase. :-)

daiplusplus commented 1 month ago

(This reply is more of a note-to-self than a reply, but anyway)

This code is in the Roslyn codebase. :-)

...so for the past umpteen years I thought this repo was just the C# compiler and LSP - and nothing to do with VS integration.

Nope! - I was wrong 😳: turns out the C# VS gubbins are all here: https://github.com/dotnet/roslyn/tree/a69841b8ca9751bee0fe9fdeedc705e198e195d9/src/VisualStudio/CSharp/Impl


Slight problem: I use the LTSC Branch of Visual Studio (so am on 17.10.6), presumably I'll need a Current-branch install (side-by-side OK?) with 17.11.2 to ensure the latest code in the repo actually runs - or should I use the Preview branch?

CyrusNajmabadi commented 1 month ago

You can install the latest vs preview side by side with your other versions of VS. You can develop and test Roslyn's main branch against this version of VS. There should be instructions on the main Roslyn page. Thanks!