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:
Related: #57554
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:
IVsTextView.IndentStyleavailable throughITextView.Options: VS #1412138Related: #57554