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

.editorconfig not working correctly for comments with indent_style = tab

Open AfroSpartan opened this issue 1 year ago • 4 comments

Type: Bug

Issue Description

When using .editorconfig with indent_style: tab, IDE0055 warnings are displayed around comments.

Steps to Reproduce

  1. Create an editor config with the following settings
# This file is the top-most EditorConfig file
root = true

# All Files
[*]
tab_size = 4
charset = utf-8
indent_style = tab
indent_size = 4
insert_final_newline = true
trim_trailing_whitespace = true

##########################################
# Default .NET Code Style Severities
##########################################

[*.{cs,csx,cake,vb,vbx}]
# Default Severity for all .NET Code Style rules below
dotnet_analyzer_diagnostic.severity = warning
  1. Add comments to your code

Expected Behavior

Comments appear without any warnings

image

Actual Behavior

Comments have warnings before and after

image

Logs

N/A

C# log

N/A

C# LSP Trace Logs

C# LSP.log

Environment information

VSCode version: 1.85.1 C# Extension: 2.15.30 Using OmniSharp: false

Dotnet Information .NET SDK: Version: 8.0.101 Commit: 6eceda187b Workload version: 8.0.100-manifests.825c015e

Runtime Environment: OS Name: Windows OS Version: 10.0.22621 OS Platform: Windows RID: win-x64 Base Path: C:\Program Files\dotnet\sdk\8.0.101\

.NET workloads installed: Workload version: 8.0.100-manifests.825c015e There are no installed workloads to display.

Host: Version: 8.0.1 Architecture: x64 Commit: bf5e279d92

.NET SDKs installed: 7.0.405 [C:\Program Files\dotnet\sdk] 8.0.101 [C:\Program Files\dotnet\sdk]

.NET runtimes installed: Microsoft.AspNetCore.App 6.0.26 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 7.0.15 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 8.0.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 6.0.26 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 7.0.15 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 8.0.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 6.0.26 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 7.0.15 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 8.0.1 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Other architectures found: x86 [C:\Program Files (x86)\dotnet] registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]

Environment variables: Not set

global.json file: Not found

Learn more: https://aka.ms/dotnet/info

Download .NET: https://aka.ms/dotnet/download

Visual Studio Code Extensions
Extension Author Version Folder Name
csharp ms-dotnettools 2.15.30 ms-dotnettools.csharp-2.15.30-win32-x64
gitlens eamodio 14.7.0 eamodio.gitlens-14.7.0
godot-files alfish 0.0.7 alfish.godot-files-0.0.7
jfrog-vscode-extension JFrog 2.9.5 jfrog.jfrog-vscode-extension-2.9.5
nugetpackagemanagergui aliasadidev 2.0.6 aliasadidev.nugetpackagemanagergui-2.0.6
path-intellisense christian-kohler 2.8.5 christian-kohler.path-intellisense-2.8.5
powershell ms-vscode 2024.0.0 ms-vscode.powershell-2024.0.0
selected-lines-count gurumukhi 1.4.0 gurumukhi.selected-lines-count-1.4.0
twee3-language-tools cyrusfirheir 0.25.3 cyrusfirheir.twee3-language-tools-0.25.3
vs-keybindings ms-vscode 0.2.1 ms-vscode.vs-keybindings-0.2.1
vscode-dotnet-runtime ms-dotnettools 2.0.0 ms-dotnettools.vscode-dotnet-runtime-2.0.0
vscode-eslint dbaeumer 2.4.2 dbaeumer.vscode-eslint-2.4.2
vscode-markdownlint DavidAnson 0.53.0 davidanson.vscode-markdownlint-0.53.0

Extension version: 2.15.30 VS Code version: Code 1.85.1 (0ee08df0cf4527e40edc9aa28f4b5bd38bbff2b2, 2023-12-13T09:49:37.021Z) OS version: Windows_NT x64 10.0.22621 Modes:

System Info
Item Value
CPUs 13th Gen Intel(R) Core(TM) i9-13900HX (32 x 2419)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
Load (avg) undefined
Memory (System) 63.71GB (45.36GB free)
Process Argv --crash-reporter-id a4cabcd1-de4a-48dd-852b-01b36268ccd9
Screen Reader no
VM 0%
A/B Experiments
vsliv368cf:30146710
vspor879:30202332
vspor708:30202333
vspor363:30204092
vscoreces:30445986
vscod805:30301674
binariesv615:30325510
vsaa593:30376534
py29gd2263:30899288
vscaac:30438847
vsclangdc:30486549
c4g48928:30535728
azure-dev_surveyone:30548225
0bi6i642:30933247
pythongtdpath:30769146
welcomedialogc:30910334
pythonidxpt:30866567
pythonnoceb:30805159
asynctok:30898717
pythontestfixt:30902429
pythonregdiag2:30936856
pyreplss1:30897532
pythonmypyd1:30879173
pythoncet0:30885854
pythontbext0:30879054
accentitlementsc:30887149
dsvsc016:30899300
dsvsc017:30899301
dsvsc018:30899302

AfroSpartan avatar Jan 18 '24 05:01 AfroSpartan

Just to check, does this resolve for you if you install https://marketplace.visualstudio.com/items?itemName=EditorConfig.EditorConfig?

If that's not installed, VS Code itself doesn't really know about .editorconfig files; I can imagine you might be in a case where the .editorconfig says it should be a tab, but VS Code thinks it should still be a space, and we might be giving preference to VS Code's opinion in that case (not realizing it doesn't know better.)

jasonmalinowski avatar Jan 27 '24 00:01 jasonmalinowski

No, I already have that installed. Also I have VS Code configured for tabs

AfroSpartan avatar Jan 27 '24 12:01 AfroSpartan

@AfroSpartan Strange -- the information filed with your bug doesn't list it which should have been filed in automatically.

jasonmalinowski avatar Jan 29 '24 19:01 jasonmalinowski

(although if you also have it configured for tabs it's moot anyways)

jasonmalinowski avatar Jan 29 '24 19:01 jasonmalinowski