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
Klarth3y 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
333fred3y 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 TacozOP3y ago
Thanks Fred
Metasyntactic
Metasyntactic3y ago
Not sure what I'm being asked
333fred
333fred3y 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 TacozOP3y 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
Metasyntactic3y 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 TacozOP3y ago
Yeah I figured this would be a VS thing. Do you know if there is any VS people on the discord?
333fred
333fred3y 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
Klarth3y 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
333fred3y ago
That's not the problem: they can The problem is removing hints
Klarth
Klarth3y 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
333fred3y ago
It doesn't matter if you aren't the one making the suggestion
AdmSnyder
AdmSnyder3y 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 TacozOP3y 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
333fred3y ago
No, sorry
Tacti Tacoz
Tacti TacozOP3y ago
:’(
Want results from more Discord servers?
Add your server