Omnisharp-vscode: Sort Usings

Created on 27 Sep 2016  路  8Comments  路  Source: OmniSharp/omnisharp-vscode

Environment data

dotnet --info output:

.NET Command Line Tools (1.0.0-preview2-003121)

Product Information:
 Version:            1.0.0-preview2-003121
 Commit SHA-1 hash:  1e9d529bc5

Runtime Environment:
 OS Name:     Mac OS X
 OS Version:  10.11
 OS Platform: Darwin
 RID:         osx.10.11-x64

VS Code version:1.5.3
C# Extension version:1.4.1

Steps to reproduce

Create a file with lots of usings statement

Expected behavior

Intellisense to offer "Sort Usings"

Actual behavior

Nothing

Feature Request

Most helpful comment

This is already implemented as part of formatting, see release notes here https://github.com/OmniSharp/omnisharp-roslyn/blob/master/CHANGELOG.md#13410---2020-01-27

it's not enabled by default so needs to be enabled with omnisharp.json file (global or local https://github.com/OmniSharp/omnisharp-roslyn/wiki/Configuration-Options#global-omnisharpjson)

see also the blog post for more info https://www.strathweb.com/2020/02/hidden-features-of-omnisharp-and-c-extension-for-vs-code/#toc_4

All 8 comments

For temporaty workaround you can use Uncrustify plugin with proper config option for using sorting.

@akshita31 Can figure out if sorting usings is a public API of Roslyn? If it is, we could go ahead and add a command to do this. (I bet we could also add a command that removes the unused ones)

@rchande : I don't believe we've exposed these as public APIs yet.

+1

+1

This is already implemented as part of formatting, see release notes here https://github.com/OmniSharp/omnisharp-roslyn/blob/master/CHANGELOG.md#13410---2020-01-27

it's not enabled by default so needs to be enabled with omnisharp.json file (global or local https://github.com/OmniSharp/omnisharp-roslyn/wiki/Configuration-Options#global-omnisharpjson)

see also the blog post for more info https://www.strathweb.com/2020/02/hidden-features-of-omnisharp-and-c-extension-for-vs-code/#toc_4

I will close this based on the above comment ^

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jrmcdona picture jrmcdona  路  3Comments

yufeih picture yufeih  路  3Comments

slevengood picture slevengood  路  3Comments

jwbay picture jwbay  路  3Comments

mattwoberts picture mattwoberts  路  3Comments