Skip to content

Commit a3ff4eb

Browse files
Fix sync over async blocking in tools|options
1 parent 4234893 commit a3ff4eb

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/VisualStudio/Core/Impl/Options/AbstractOptionPreviewViewModel.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,10 @@ public void UpdatePreview(string text)
138138
var fallbackFormattingOptions = OptionStore.GlobalOptions.GetSyntaxFormattingOptions(document.Project.Services);
139139
var formattingService = document.GetRequiredLanguageService<ISyntaxFormattingService>();
140140
var formattingOptions = formattingService.GetFormattingOptions(OptionStore);
141-
var formatted = Formatter.FormatAsync(document, formattingOptions, CancellationToken.None).WaitAndGetResult(CancellationToken.None);
141+
var root = document.GetSyntaxRootSynchronously(CancellationToken.None);
142+
var formatted = Formatter.Format(root, document.Project.Solution.Services, formattingOptions, CancellationToken.None);
142143

143-
var textBuffer = _textBufferCloneService.Clone(formatted.GetTextSynchronously(CancellationToken.None), _contentType);
144+
var textBuffer = _textBufferCloneService.Clone(SourceText.From(formatted.ToFullString(), Encoding.UTF8), _contentType);
144145

145146
var container = textBuffer.AsTextContainer();
146147

0 commit comments

Comments
 (0)