Open NatoBoram opened 4 years ago
the extension respects the VS Code settings, do you have tabs setin VS Code settings?
I see. I have the following in my user settings :
{
"editor.detectIndentation": true,
"editor.formatOnSave": true,
"editor.insertSpaces": false,
}
I also have the following .editorconfig
inside the projet, with the editorconfig.editorconfig
extension :
root = true
[*]
indent_style = space
indent_size = 4
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = false
Ideally, this should work. However, I found that the only way to make it work was to add a .vscode/settings.json
that explicitly sets insertSpaces
.
{
"editor.insertSpaces": true
}
So, I guess it kinda works but differently from other extensions.
editorconfig is also supported but it's off by default - you need to enable it by adding "omnisharp.enableEditorConfigSupport": true setting.
This one is by design because editorConfig isn't on by default. Though we should probably just have it be on by default whenever there is an editorconfig detected.
Please note that I have "editor.detectIndentation": true
. The project had spaces in it, and I used format-on-save. It should've detected spaces and used that; and that setting should've been overwritten by .editorconfig
-related settings.
Thanks for confirming @NatoBoram, indeed the .editorconfig should overwrite things. If it's not, then that is a bug.
...only if editorconfig support was activated.
Issue Description
I'm trying to join an already existing project with already established standards. One of those is using 4 spaces instead of tabs. However, when I format using this extension, it re-formats the whole file using tabs.
Steps to Reproduce
Expected Behavior
I should be able to follow the project's standards regardless of my environment.
Actual Behavior
The extension forces tabs upon the project.
Logs
OmniSharp log
C# log
Environment information
VSCode version: 1.45.0-insider C# Extension: 1.21.17
Dotnet Information
.NET Core SDK (reflecting any global.json): Version: 3.1.200 Commit: c5123d973b Runtime Environment: OS Name: Windows OS Version: 10.0.19025 OS Platform: Windows RID: win10-x64 Base Path: C:\ProgramData\scoop\apps\dotnet-sdk\current\sdk\3.1.200\ Host (useful for support): Version: 3.1.2 Commit: 916b5cba26 .NET Core SDKs installed: 3.1.200 [C:\ProgramData\scoop\apps\dotnet-sdk\current\sdk] .NET Core runtimes installed: Microsoft.AspNetCore.App 3.1.2 [C:\ProgramData\scoop\apps\dotnet-sdk\current\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 3.1.2 [C:\ProgramData\scoop\apps\dotnet-sdk\current\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 3.1.2 [C:\ProgramData\scoop\apps\dotnet-sdk\current\shared\Microsoft.WindowsDesktop.App] To install additional .NET Core runtimes or SDKs: https://aka.ms/dotnet-downloadVisual Studio Code Extensions
|Extension|Author|Version| |---|---|---| |Angular2|johnpapa|9.1.2| |beautify|HookyQR|1.5.0| |csharp|ms-dotnettools|1.21.17| |dart-code|Dart-Code|3.9.1| |debugger-for-chrome|msjsdiag|4.12.6| |docs-yaml|docsmsft|0.2.5| |dotenv|mikestead|1.0.1| |EditorConfig|EditorConfig|0.14.5| |flutter|Dart-Code|3.9.1| |git-project-manager|felipecaputo|1.7.1| |githistory|donjayamanne|0.6.3| |gitlens|eamodio|10.2.1| |Go|ms-vscode|0.14.1| |hungry-delete|jasonlhy|1.6.0| |jbockle-format-files|jbockle|3.0.0| |jshint|dbaeumer|0.10.21| |markdown-pdf|yzane|1.4.4| |ng-template|Angular|0.901.3| |npm-intellisense|christian-kohler|1.3.0| |output-colorizer|IBM|0.1.2| |path-intellisense|christian-kohler|1.4.2| |polacode|pnp|0.3.4| |python|ms-python|2020.4.74986| |quicktype|quicktype|12.0.46| |read-time|johnpapa|0.2.0| |systemd-unit-file|coolbear|1.0.6| |typescript-javascript-grammar|ms-vscode|0.0.53| |vscode-apollo|apollographql|1.15.3| |vscode-eslint|dbaeumer|2.1.5| |vscode-firefox-debug|firefox-devtools|2.7.2| |vscode-markdownlint|DavidAnson|0.35.0| |vscode-npm-script|eg2|0.3.11| |vscode-react-native|msjsdiag|0.14.2| |vscode-table-formatter|shuworks|1.2.1| |vscode-typescript-next|ms-vscode|3.9.20200422| |vscode-typescript-tslint-plugin|ms-vscode|1.2.3| |vscode-yaml|redhat|0.7.2| |vscodeintellicode|VisualStudioExptTeam|1.2.6| |vsliveshare|ms-vsliveshare|1.0.2048| |xml|DotJoshJohnson|2.5.0|;