Skip to content

Separate formatting of text edits made to a document from formatting all or part of a document #6120

@davidwengier

Description

@davidwengier

There is a quirk in how our on type formatting engine is used.

Before a recent change our on type formatting worked by having the on type formatting endpoint call Roslyn to do on type formatting, and then passing those edits into our formatting engine, to run through all of the formatting passes.

After the change, things are more consisten: the call to Roslyn is in the CSharpOnTypeFormattingPass itself, because that is where logically it should belong (the call to Roslyn for whole document formatting is in CSharpFormattingPass and the call to WebTools for Html formatting is in HtmlFormattingPass). Unfortunately there are other things (snippets, completion etc.) which construct a set of edits and then call our formatting engine pretending to be on type formatting.

The formatting engine has an allowance for this, to not break those scenarios, and can either format edits passed in to it, or it can go and ask Roslyn for some edits. Obviously this is crazy, and should be separated out.

Originally posted by @davidwengier in #6064 (comment)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions