Sorting "using" statements puts `System` namespaces first
See original GitHub issueIssue Description
When saving a file in VS Code, it is formatted to place the System
namespaces first. I don’t want this, and can’t find where to turn it off.
In Visual Studio (not Code), this can be turned off in the settings, but I can’t find where to disable this “feature” in VS Code.
Steps to Reproduce
Make a file and put these using statements at the top:
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Text;
Expected Behavior
They are untouched because they are being used. I like my using statements alphabetical with nothing more.
Actual Behavior
They are reordered to place the System
namespaces first:
using System;
using System.Text;
using Microsoft.VisualStudio.TestTools.UnitTesting;
Logs
OmniSharp log
C# log
Environment information
VSCode version: 1.62.3 C# Extension: 1.23.16
Dotnet Information
.NET SDK (reflecting any global.json): Version: 6.0.100 Commit: 9e8b04bbffRuntime Environment: OS Name: Windows OS Version: 10.0.22000 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\6.0.100\
Host (useful for support): Version: 6.0.0 Commit: 4822e3c3aa
.NET SDKs installed: 3.1.415 [C:\Program Files\dotnet\sdk] 5.0.403 [C:\Program Files\dotnet\sdk] 6.0.100-rc.1.21458.32 [C:\Program Files\dotnet\sdk] 6.0.100-rc.1.21463.6 [C:\Program Files\dotnet\sdk] 6.0.100-rc.2.21505.57 [C:\Program Files\dotnet\sdk] 6.0.100 [C:\Program Files\dotnet\sdk]
.NET runtimes installed: Microsoft.AspNetCore.App 3.1.19 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.1.21 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 5.0.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 5.0.10 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 5.0.12 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 6.0.0-rc.1.21452.15 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 6.0.0-rc.2.21480.10 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 6.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 3.1.19 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 3.1.21 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 5.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 5.0.10 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 5.0.12 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.0-rc.1.21451.13 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.0-rc.2.21480.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 3.1.19 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 3.1.21 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 5.0.9 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 5.0.10 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 5.0.12 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 6.0.0-rc.1.21451.3 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 6.0.0-rc.2.21501.6 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 6.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
To install additional .NET runtimes or SDKs: https://aka.ms/dotnet-download
Visual Studio Code Extensions
Extension | Author | Version |
---|---|---|
better-cpp-syntax | jeff-hykin | 1.15.10 |
better-toml | bungcip | 0.3.2 |
code-spell-checker | streetsidesoftware | 2.0.13 |
cpptools | ms-vscode | 1.7.1 |
cpptools-extension-pack | ms-vscode | 1.1.0 |
crates | serayuzgur | 0.5.10 |
csharp | ms-dotnettools | 1.23.16 |
gitlens | eamodio | 11.7.0 |
godot-tools | geequlim | 1.1.2 |
hexeditor | ms-vscode | 1.8.2 |
indent-rainbow | oderwat | 8.2.2 |
language-x86-64-assembly | 13xforever | 3.0.0 |
markdown-preview-enhanced | shd101wyy | 0.6.1 |
material-icon-theme | PKief | 4.11.0 |
midl-webidl-syntax | dave-deletethis | 0.0.1 |
mono-debug | ms-vscode | 0.16.2 |
npm-intellisense | christian-kohler | 1.4.0 |
nugetpackagemanagergui | aliasadidev | 1.1.9 |
platformio-ide | platformio | 2.4.0 |
python | ms-python | 2021.11.1422169775 |
remote-ssh | ms-vscode-remote | 0.66.1 |
remote-ssh-edit | ms-vscode-remote | 0.66.1 |
remote-wsl | ms-vscode-remote | 0.58.5 |
rust-analyzer | matklad | 0.2.826 |
sort-imports | amatiasq | 6.2.6 |
tabnine-vscode | TabNine | 3.5.1 |
v4pvhdlforprofessionals | ViDE-Software | 1.1.2 |
vscode-eslint | dbaeumer | 2.2.2 |
vscode-firefox-debug | firefox-devtools | 2.9.5 |
vscode-npm-script | eg2 | 0.3.23 |
vscode-nuget-package-manager | jmrog | 1.1.6 |
vscode-print | pdconsec | 0.9.14 |
vscode-pull-request-github | GitHub | 0.32.0 |
vscode-pylance | ms-python | 2021.11.2 |
vscode-tailwindcss | bradlc | 0.7.2 |
vscode-typescript-next | ms-vscode | 4.6.20211126 |
vscode-yaml | redhat | 1.2.1 |
vscodeintellicode | VisualStudioExptTeam | 1.2.14 |
vsliveshare | ms-vsliveshare | 1.0.5090 |
vsliveshare-audio | ms-vsliveshare | 0.1.91 |
wavetrace | wavetrace | 1.1.2 |
Issue Analytics
- State:
- Created 2 years ago
- Comments:10 (5 by maintainers)
Top GitHub Comments
@colejohnson66 You can configure the behavior of Organize Imports by changing settings within your .editorconfig file. See https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/formatting-rules#organize-using-directives for more details.
Below is an example which will disable sorting system directives to the top.
Mmhm. You are correct. That was the issue! My apologies for the non-issue.