Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[request] Ability to sort CompletionItem by type inheritance #16685

Open
Thaina opened this issue Jan 23, 2017 · 9 comments
Open

[request] Ability to sort CompletionItem by type inheritance #16685

Thaina opened this issue Jan 23, 2017 · 9 comments
Labels
Area-IDE Feature Request Need Design Review The end user experience design needs to be reviewed and approved.
Milestone

Comments

@Thaina
Copy link

Thaina commented Jan 23, 2017

Just like monodevelop feature. I think it useful when we have large class with many inheritance like unity3D's MonoBehaviour. We should have a way to switch between sorting mode

And, if possible, should be like monodevelop that could always switch anytimes

@Pilchie
Copy link
Member

Pilchie commented Feb 7, 2017

We have so far resisted allowing sorting by anything other than alphabetical, but I definitely understand wanting to see things from a particular layer in the hierarchy.

Tagging @kuhlenh @rchande @CyrusNajmabadi for thoughts here.

@Pilchie Pilchie added this to the Unknown milestone Feb 7, 2017
@Thaina
Copy link
Author

Thaina commented Feb 7, 2017

@Pilchie I was investigate myself and it seem it should be done on roslyn derivative for IDE, such as omnisharp. roslyn could be as is

But the problem I found is, It seem like CompletionItem return from roslyn does not contains type that item came from. So I can't sort it in omnisharp (I try to mod omnisharp)

So, is there a type, or at least typename that I could do reflection easier that came along with CompletionItem? If it not exist could it possible to add it into roslyn?

@Thaina
Copy link
Author

Thaina commented Feb 8, 2017

@DustinCampbell I mean the ability to sort completion should not be implemented in roslyn directly. Instead we should get completion list unsorted and sort it or manipulate it in the host process

Ability to manipulate collection should be independent to collection in my opinion

Or at least, sorting should be implemented as comparison callback function

@DustinCampbell
Copy link
Member

@Thaina: I don't think that's feasible. The data that comes back for the CompletionService wouldn't have enough information to sort in such a manner. Adding a type name is possible but following up with reflection on those type names would be extremely expensive.

In general, we try to avoid forcing hosts to do that level of sorting because it is error prone. If we want to unify the core C# editing experience across many hosts, we need to take burden off the hosts, not add it.

@Thaina
Copy link
Author

Thaina commented Feb 8, 2017

@DustinCampbell If so then, that why I was request that CompletionItem return from roslyn should add more information, but let omnisharp manipulate that collection

Also the host I mean is omnisharp.exe, not omnisharp-vscode. So omnisharp.exe would be able to provided across all omnisharp-xxx am I right?

I think CompletionService should return CompletionItem with TypeInfo. Then omnisharp has config to sort it, then return to omnisharp-vscode or other host request it

@Thaina
Copy link
Author

Thaina commented Feb 8, 2017

ps. Also this feature is what I talk about there >>> #15974 (comment)

@DustinCampbell
Copy link
Member

When we say "host", we mean anything hosting a Roslyn workspace. That includes OmniSharp, Visual Studio, Visual Studio for Mac, and many others. That "host" could do many things, such as populate editor presentation APIs (such as in Visual Studio), or service up language service information over a protocol like OmniSharp.

Note: I think you're getting a little bogged down by implementation. Why would CompleitionSerivce return a CompletionItem with TypeInfo? There's no need to use reflection here. Remember that this is Roslyn, which already has a rich symbol API for representing types, methods and any other symbols handled by the C# language.

@Thaina
Copy link
Author

Thaina commented Feb 8, 2017

@DustinCampbell I wish roslyn would return typeinfo with CompletionItem so omnisharp (and other host) would be able to group/sort/hidden or make any decision on its own. In this case is sorting and grouping by its declaration type

As I said, I think list in general should be able to sort by custom logic anytimes. Should not implement fixed sorting logic on its own. But should provide information for outside logic instead

@xCyborg
Copy link

xCyborg commented Mar 29, 2019

I hope someone is on this

@sharwell sharwell added the Need Design Review The end user experience design needs to be reviewed and approved. label Mar 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-IDE Feature Request Need Design Review The end user experience design needs to be reviewed and approved.
Projects
Status: In Queue
Development

No branches or pull requests

5 participants