dotnet / vscode-csharp

Official C# support for Visual Studio Code
MIT License
2.87k stars 675 forks source link

space after comma in array initializer #4376

Open devel0 opened 3 years ago

devel0 commented 3 years ago

Issue Description

unable to format code for numbers in array initializer because space not inserted after comma

Steps to Reproduce

var rValues = new List<double>()
{
    1, 1.2, 1.5, 1.8, 2.2, 2.7, 3.3, 3.9,
    4.7, 5.6, 6.8, 10, 12, 15, 18, 22,
    27, 33, 39, 47, 56, 68, 82, 100,
    120, 150, 180, 220,270,330,390,470,
    560,680,820,1e3,1.2e3, 1.5e3, 1.8e3, 2.2e3,
    3.3e3,3.9e3,4.7e3,5.5e3, 6.8e3, 8.2e3, 10e3, 12e3,
    15e3,18e3,22e3, 27e3
};

then command palette Format Document

Expected Behavior

var rValues = new List<double>()
{
    1, 1.2, 1.5, 1.8, 2.2, 2.7, 3.3, 3.9,
    4.7, 5.6, 6.8, 10, 12, 15, 18, 22,
    27, 33, 39, 47, 56, 68, 82, 100,
    120, 150, 180, 220, 270, 330, 390, 470,
    560, 680, 820, 1e3, 1.2e3, 1.5e3, 1.8e3, 2.2e3,
    3.3e3, 3.9e3, 4.7e3, 5.5e3, 6.8e3, 8.2e3, 10e3, 12e3,
    15e3, 18e3, 22e3, 27e3
};

Actual Behavior

see for example 220,270,330,390,470, keeps tightly instead of with spaces 220, 270, 330, 390, 470,

Logs

OmniSharp log

Post the output from Output-->OmniSharp log here

C# log

Post the output from Output-->C# here

Environment information

VSCode version: 1.52.1 C# Extension: 1.23.8

Mono Information OmniSharp using built-in mono
Dotnet Information .NET SDK (reflecting any global.json): Version: 5.0.100 Commit: 5044b93829 Runtime Environment: OS Name: ubuntu OS Version: 20.04 OS Platform: Linux RID: ubuntu.20.04-x64 Base Path: /opt/dotnet/sdk/5.0.100/ Host (useful for support): Version: 5.0.0 Commit: cf258a14b7 .NET SDKs installed: 3.1.302 [/opt/dotnet/sdk] 5.0.100 [/opt/dotnet/sdk] .NET runtimes installed: Microsoft.AspNetCore.App 3.1.6 [/opt/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 5.0.0 [/opt/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.NETCore.App 3.1.6 [/opt/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 5.0.0 [/opt/dotnet/shared/Microsoft.NETCore.App] To install additional .NET runtimes or SDKs: https://aka.ms/dotnet-download
Visual Studio Code Extensions |Extension|Author|Version| |---|---|---| |arm|dan-c-underwood|1.5.0| |bash-beautify|shakram02|0.1.1| |better-comments|aaron-bond|2.1.0| |better-cpp-syntax|jeff-hykin|1.15.5| |Bookmarks|alefragnani|12.1.4| |centroid-gcode-language|DanielBerlin|0.3.0| |cmake|twxs|0.0.17| |cmake-tools|ms-vscode|1.5.3| |code-gnu-global|austin|0.2.2| |cortex-debug|marus25|0.3.11| |cortex-debug-dp-stm32f4|marus25|1.0.0| |cpptools|ms-vscode|1.2.0| |cpptools-extension-pack|ms-vscode|1.0.0| |cpptools-themes|ms-vscode|1.0.0| |csharp|ms-dotnettools|1.23.8| |debug|webfreak|0.25.0| |docomment|k--kato|0.1.20| |doxdocgen|cschlosser|1.1.0| |easy-snippet|inu1255|0.6.2| |gitlens|eamodio|11.2.0| |js-debug-nightly|ms-vscode|2021.2.117| |jupyter|ms-toolsai|2020.12.414227025| |markdown-pdf|yzane|1.4.4| |octave|leafvmaple|0.1.1| |platformio-ide|platformio|2.2.1| |python|ms-python|2021.1.502429796| |python|tht13|0.2.3| |reload|natqe|0.0.6| |remote-containers|ms-vscode-remote|0.155.1| |remote-ssh|ms-vscode-remote|0.63.0| |remote-ssh-edit|ms-vscode-remote|0.63.0| |remote-wsl|ms-vscode-remote|0.52.0| |ruby|rebornix|0.28.1| |selected-character-count|mousetraps|0.0.1| |setting-toggle|Ho-Wan|1.3.1| |show-offset|ramyaraoa|0.0.4| |solargraph|castwide|0.21.1| |stm32-for-vscode|bmd|2.2.4| |todo-tree|Gruntfuggly|0.0.196| |vscode-arduino|vsciot-vscode|0.3.4| |vscode-docker|ms-azuretools|1.9.1| |vscode-eslint|dbaeumer|2.1.14| |vscode-icalendar|af4jm|1.0.1| |vscode-markdown-table-sort|simonguo|1.0.4| |vscode-math-to-image|MeowTeam|0.1.1| |vscode-nuget-package-manager|jmrog|1.1.6| |vscode-pylance|ms-python|2021.1.3| |vscode-remote-extensionpack|ms-vscode-remote|0.20.0| |vscode-ruby|wingrunr21|0.28.0| |vscode-xml-complete|rogalmic|0.2.15| |vsonline|ms-vsonline|1.0.3076| |xml-format|mikeburgh|1.1.2|;
momvart commented 3 years ago

I think it's the same old issue in the Roslyn which is not fixed for years! https://github.com/dotnet/roslyn/issues/8269

filipw commented 3 years ago

yes it is, it's not controllable by OmniSharp as we use Roslyn to format the code