Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,10 @@ public void UpdatePreview(string text)
var fallbackFormattingOptions = OptionStore.GlobalOptions.GetSyntaxFormattingOptions(document.Project.Services);
var formattingService = document.GetRequiredLanguageService<ISyntaxFormattingService>();
var formattingOptions = formattingService.GetFormattingOptions(OptionStore);
var formatted = Formatter.FormatAsync(document, formattingOptions, CancellationToken.None).WaitAndGetResult(CancellationToken.None);
var root = document.GetSyntaxRootSynchronously(CancellationToken.None);
var formatted = Formatter.Format(root, document.Project.Solution.Services, formattingOptions, CancellationToken.None);

var textBuffer = _textBufferCloneService.Clone(formatted.GetTextSynchronously(CancellationToken.None), _contentType);
var textBuffer = _textBufferCloneService.Clone(SourceText.From(formatted.ToFullString(), Encoding.UTF8), _contentType);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is UTF8 always correct here and is it even necessary to specify?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's what we were already doing about 5 lines above. So it seems fine. These are never actually persisted to disk. They're just shown in the tools options ui


var container = textBuffer.AsTextContainer();

Expand Down
Loading