Skip to content

Commit

Permalink
FIx
Browse files Browse the repository at this point in the history
  • Loading branch information
tmat committed Feb 25, 2022
1 parent 741ea40 commit 07ebf47
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions tests/OmniSharp.Roslyn.CSharp.Tests/FormatAfterKeystrokeTests.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#nullable enable

using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Formatting;
Expand Down Expand Up @@ -364,6 +365,13 @@ public void M()
}");
}

protected override OmniSharpTestHost CreateSharedOmniSharpTestHost()
=> CreateOmniSharpHost(configurationData: new Dictionary<string, string>()
{
["FormattingOptions:NewLine"] = System.Environment.NewLine
});


private async Task VerifyNoChange(string fileName, string typedCharacter, string originalMarkup)
{
var (response, _) = await GetResponse(originalMarkup, typedCharacter, fileName);
Expand Down Expand Up @@ -391,11 +399,6 @@ private async Task VerifyChange(string fileName, string typedCharacter, string o

private async Task<(FormatRangeResponse, TestFile)> GetResponse(string text, string character, string fileName)
{
// Ensure system newlines are used when editorconfig is used but the config does not specify new line settings.
// This will be removed in future once Roslyn formatting APIs allow to specify defaults for editorconfig settings explicitly.
var options = SharedOmniSharpTestHost.Workspace.Options.WithChangedOption(FormattingOptions.NewLine, LanguageNames.CSharp, System.Environment.NewLine);
SharedOmniSharpTestHost.Workspace.TryApplyChanges(SharedOmniSharpTestHost.Workspace.CurrentSolution.WithOptions(options));

var file = new TestFile(fileName, text);
SharedOmniSharpTestHost.AddFilesToWorkspace(file);
var point = file.Content.GetPointFromPosition();
Expand Down

0 comments on commit 07ebf47

Please sign in to comment.