Skip to content
This repository was archived by the owner on Jan 12, 2024. It is now read-only.
This repository was archived by the owner on Jan 12, 2024. It is now read-only.

Code completion doesn't recognize attributes #659

Open
@bamarsha

Description

@bamarsha

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:

  1. Open a Q# file in Visual Studio Code.

  2. Type @r in a namespace:

    namespace Example {
        @r
    }
  3. 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

grafik

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.

/// Parses a declaration modifier list.
let private modifiers =
expectedKeyword qsInternal

Metadata

Metadata

Assignees

No one assigned

    Labels

    HacktoberfestCandidate issues for Hacktoberfest 2021area: editorExtensions for Visual Studio and Visual Studio CodebugSomething isn't workinggood first issueGood for newcomers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions