You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
OnTypeFormattingPass still uses the old formatting engine, and recompiles Razor files multiple times.
It should be possible for that to use the new generated document, and therefore not have to do all of the "cleanup" work after an on-type formatting operation.
We'll have to allow the new document generation to track a position in the original document, and map it to the generated document. Regular source mappings won't help here
Code actions, snippets and OnAutoInsert have to use the Razor compiler generated document, because they start with edits to that document.
Perhaps they could have their own formatting pass, rather than use the OnTypeFormattingPass and all of its cleanup code.
Alternatively: Should we implement a full visitor, that visits every node, and simple ignores the ones it doesn't care about (ie, the ones not at the start of a line)
There are quirks around explicit expressions, and multi-line html attributes that cause us to have to look back a line, and traverse the tree up, to handle. A proper visitor could perhaps deal with these on the way down, and deal with the "additional formatting" at the same time.
Perf:
StringBuilder.ToString()
: New Razor document formatting engine #11364 (comment)The text was updated successfully, but these errors were encountered: