Code completion doesn't recognize attributes #659
Description
Describe the bug
After typing @
, typing a letter or pressing Ctrl+Space shows completions for all identifiers and keywords, not just attribute names.
To Reproduce
Steps to reproduce the behavior:
-
Open a Q# file in Visual Studio Code.
-
Type
@r
in a namespace:namespace Example { @r }
-
Code completion shows identifiers that aren't valid as attributes, like the
repeat
keyword.
Expected behavior
Code completion should only valid attribute names. It is probably easier to show all user-defined types instead of only user-defined types with the @Attribute()
attribute, since I don't think code completion is capable of filtering by attributes right now.
Screenshots
System information
- QDK extension v0.12.20092803
- Windows 10, .NET Core 3.1.401
- Visual Studio Code version 1.49.2
Additional context
CodeCompletion\FragmentParsing.fs
is probably a good place to start. The modifiers
parser can parse things that appear before a declaration, like the internal
keyword. It should be possible to also parse the @
symbol here followed by a user-defined type name.