Skip to content

Commit

Permalink
Fix issue with refreshing code viewever
Browse files Browse the repository at this point in the history
  • Loading branch information
cezarypiatek committed Jul 31, 2024
1 parent cbef603 commit b92cb5a
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/WireMockInspector/Views/CodeBlockViewer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,28 +49,18 @@ private void OnCodeChanged(MarkdownCode newValue, MarkdownCode NewValue)
}


private void SetMarkdown(ViewModels.MarkdownCode md)
private void SetMarkdown(ViewModels.MarkdownCode md)
{
if (md is not null)
{
if (this.Document is not null)
{
this.Document.Text = md.rawValue;
}
else
{
this.Document = new TextDocument(md.rawValue);
}

if (_currentLang != md.lang)
{
_currentLang = md.lang;
CodeBlockViewer _textEditor = this;

if (_registryOptions.GetLanguageByExtension("." + md.lang) is { } languageByExtension)
{
_textMateInstallation.SetGrammar(_registryOptions.GetScopeByLanguageId(languageByExtension.Id));


}


Expand All @@ -80,6 +70,16 @@ private void SetMarkdown(ViewModels.MarkdownCode md)
}
this.TextArea.TextView.LineTransformers.Add(new DiffLineBackgroundRenderer(md.oldTextLines));
}

if (this.Document is not null || _currentLang != md.lang)
{
this.Document.Text = md.rawValue;
}
else
{
this.Document = new TextDocument(md.rawValue);
}

}
else
{
Expand Down

0 comments on commit b92cb5a

Please sign in to comment.