Change Visual Studio suggetions with custom analysers

Hiya.. ohh discords new "forum" channels are super useful for this huh?. anyway. So I managed to implement a C# proposal https://github.com/dotnet/csharplang/discussions/6394 (that is I implemented it using an analyser extension) for my own use. there is 1 problem though I can't seem to figure out how I tell visual studios "suggestions" feature (where when you start typing suggestions for member names, type names, etc show up.) what members and types it should and shouldn't suggest. I would have thought that is a common use of analysers and that the extension and or analyser api has some kind of build in method to do it, or atleast I hope(ed). Let me know what I'm missing. Thanks everyone.
18 Replies
Klarth
Klarth2y ago
You may want to ask in #roslyn if you don't get help here in the next few hours. It's more focused towards analyzers. Just don't leave both questions up at the same time.
333fred
333fred2y ago
@Metasyntactic, this is a you question Not sure whether you can remove things from completion, only add them, but Cyrus will know for sure
Tacti Tacoz
Tacti Tacoz2y ago
Thanks Fred
Metasyntactic
Metasyntactic2y ago
Not sure what I'm being asked
333fred
333fred2y ago
Can you implement anything to remove existing completions from the list? Presumably to remove suggestions that should not be in this partial part from the list
Tacti Tacoz
Tacti Tacoz2y ago
I want to remove specific suggestions from the auto completion list via an analyser. As I said above I”ve already successfully implemented an analyser that comply with the C# feature proposal, what I need now is to prevent those members from showing up in auto completion too
Metasyntactic
Metasyntactic2y ago
there is no way to do this. we do not allow anyone to remove items. (using roslyn) there may be a VS mechanism for this
Tacti Tacoz
Tacti Tacoz2y ago
Yeah I figured this would be a VS thing. Do you know if there is any VS people on the discord?
333fred
333fred2y ago
I believe they're generally on gitter, not discord. There's some examples of the SDK and a link to the gitter here: https://github.com/Microsoft/VSSDK-Extensibility-Samples
GitHub
GitHub - microsoft/VSSDK-Extensibility-Samples: Samples for buildin...
Samples for building your own Visual Studio extensions - GitHub - microsoft/VSSDK-Extensibility-Samples: Samples for building your own Visual Studio extensions
Klarth
Klarth2y ago
Maybe @AdmSnyder can give some insight if a VS extension can remove suggested suggestions from autocompletion. He's made a few VS extensions, so might know. Would probably be nicer if Roslyn Analyzers would allow you to provide priority hints that VS could act upon.
333fred
333fred2y ago
That's not the problem: they can The problem is removing hints
Klarth
Klarth2y ago
Can you not hint that a suggestion should be hidden ("zero" priority)? Or can you only specify "minimum" priority? I really need to get involved in the tooling side sometime. catsweat
333fred
333fred2y ago
It doesn't matter if you aren't the one making the suggestion
AdmSnyder
AdmSnyder2y ago
i wonder... there are a couple attributes like DebuggersStepThrough, DesignerVisible, ... that tell specific tooling to ignore specific stuff. - maybe one of these should be invented? maybe an ObsoleteAttribute would already discourage that? doesn't help with scoped restrictions, though. nah, never did anything in that area.
Tacti Tacoz
Tacti Tacoz2y ago
Why there is not something like a [EditorHidden] attribute that work within the same project (unlike EditorBrowsable or whatever it is called) is indeed 1 of lives biggest questions huh? So no ideas about this?
333fred
333fred2y ago
No, sorry
Tacti Tacoz
Tacti Tacoz2y ago
:’(
Want results from more Discord servers?
Add your server
More Posts
Program won’t run with just .net runtime [Answered]So my program that I published and is targeting .net 6 won’t run when the pc has just .net 6 runtimeNullReferenceException Object reference not set to an instance of an object```cs List<Effects> effectsList = activePlayerEffects[targetPlayer] ?? new List<Effects>(); ``` someDbContext.SaveChangesAsync has no effect on the collection of changed objectsHi. I get products collection from dbContext, change some values and want to save it in the databaseWindowsIdentity claims don't include all AD attributes, how do I fix that?I'm using windows authentication and want to display a user's full name, however on inspection the ihow to create a jwt for an existing user in identityI am looking to create a new JWT and validate it... for using tiwht signalr. so i want to know how tNeed help finding memory leak [Answered]We have a solution with a mix of VB and C# projects. Most of them in VB. We have a logger factory wrEF 6 - Creating entity with n-n```cs PostDtoWrite_2 newpost = new PostDtoWrite_2(); newpost.Title = request.Title; newpHow can I make invisible Console NOT winformI have a project but i need to make invisible, but i can not to make it.namespace missing imports after copying class [Answered]Hi guys, I am struggling with a problem for a few weeks. So I have a ASP.NET Website project (Not wHow to combine null coascence and ternary operator?Hello, I have a string variable A. And I want to fill thid string A with value Yes if a bool is true