Skip to content

Suggestion for unnamed symbols completion: Offer completion for await #52289

@MaStr11

Description

@MaStr11

Brief description:

#47511 added support for completion of unnamed symbols. During the implementation it was suggested to add completion support for await and await someTask.ConfigureAwait(false).

This idea was postponed to not further complicate the PR:
#47511 (comment)

This feature would mimic dotnet/csharplang#4076 to some extent without actually implementing it as a language feature.

Languages applicable:

C#

Code example for the completion:

someTask.aw$$ // this triggers completion which contains "await" and "awaitf".
// committed suggestions ("await"):
await someTask$$
// or ("awaitf")
await someTask.ConfigureAwait(false)$$

Additional information:

The following characteristics would apply:

  • Triggered after dot on the left side of the cursor (this includes null conditional member access)
  • Expression on the left side of the dot must be task like
  • Containing method must be marked with async
  • Completion list contains await and awaitf
  • Completion items are sorted alphabetical in between other members
  • The completion item is an operator (operator glyph and filtered by the operator selection)
  • The SymbolCompletionItem needs an underlying symbol. I think, Task.ContinueWith is a good choice, but causes some trouble with quick info (XMLDoc comment does not fit, overload count is just wrong and it will be difficult to prevent the completion list from merging the symbol with the real ContinueWith method symbols). It's propably better to synthesize a symbol, like it was done for the built-in conversions in Intellisense for cast, indexers and operators #47511.
  • On completion, await is placed in front of the expression. The dot, that triggered completion and any partially written await is removed.
  • On null conditional member access, the ? is left. This is in line with the behavior of conversion completion.
  • On completion of awaitf, .ConfigureAwait(false) is additionally appended to the dot left of the cursor position
  • Completion for null conditional member access and awaitf (someTask?.$$) completes to await someTask.ConfigureAwait(false)?$$
  • Completion does not surround the resulting expression with parenthesis like so (await someTask)$$

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-IDEFeature Requesthelp wantedThe issue is "up for grabs" - add a comment if you are interested in working on it

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions