Open davkean opened 8 years ago
@davkean I agree with you, only be showing AttributeOnlyValidInAssembly.
For the first point, yes, and wouldn't it be even better to give a list when you typed [
?
For the second point, I would argue that if the attribute is from source instead of metadata, one could always change it's usage, rather than not seeing it in the completion list and scratch the head wondering why, squiggle with error message after inserting is better IMHO.
I think I can create a PR for the first request later, then we can discuss.
Having tried this locally, I was able to get the behavior I want, but the change introduce redundant work:
[
is typed, attribute target keyword recommenders would run twice[
is typed and in attribute name context, SymbolCompletionProvider.GetSymbolsWorker
would run twiceMain reason of those redundant work needed is that, [
can be indexer context, currently no completion list will be triggered when you type someArray[
. If I simply add [
to the trigger character to KeywordCompletionProvider
and SymbolCompletionProvider
, they WILL recommend something in indexer context, like nameof
, local variables, or namespace symbols. To keep the current behavior, separate completion providers are necessary.
So, what do you think? Add [
as trigger character in all case, or add separate completion providers that introduce redundant work?
Pausing, because I notice some huge changes are in review #10666
There are two behaviors that I think should change with IntelliSense when in attribute context
1) We should open IntelliSense immediately:
Above I need to CTRL+SPACE to open IntelliSense window, what else is valid in that case?
2) We should filter it to just the attributes that are applied in that case:
At $, we should only be showing AttributeOnlyValidInAssembly, instead we show both attributes.