Skip to content

Explore moving source parsing to async open file operation #57553

@tmat

Description

@tmat

The idea is that when a file is open using new asynchronous open file API that the VS platform is working on we hook up syntax parser into the open file handler so that when the file is opened and user can start typing we already have the syntax tree available.

This would allow us to implement complex formatting command handlers entirely synchronously since they would operate on already parsed tree.

If our parser is not fast enough (TODO: measure) we could consider starting the parsing asynchronously as soon as the file opens but only enable the commands that require syntax trees when the tree becomes available. Until then the UI would indicate that the document is not ready yet and only basic text editing operations will be available (e.g. basic indentation but not smart indentation).

Since the formatting operations also require access to editorconfig options we would also need them to be available from the text snapshot. The editor already has them, so it just needs to expose them via an API:

  • Make IVsTextView.IndentStyle available through ITextView.Options: VS #1412138
  • Custom editorconfig properties are not exposed through editor options: VS #1429383
  • Add free-threaded API that replaces IVsTextManager4.GetUserPreferences4: VS #1307188

Related: #57554

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions