Skip to content

Commit

Permalink
CR: use record
Browse files Browse the repository at this point in the history
  • Loading branch information
StephenWeatherford committed Jul 16, 2024
1 parent 4a9ec40 commit 7a83378
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public static async Task<LanguageServerHelper> StartServer(TestContext testConte
var serverPipe = new Pipe();

var server = new Server(
new BicepLangServerOptions(),
BicepLangServerOptions.Default,
options => options
.WithInput(serverPipe.Reader)
.WithOutput(clientPipe.Writer)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using Bicep.Core.UnitTests.Utils;
using Bicep.LanguageServer;
using Bicep.LanguageServer.Handlers;
using Bicep.LanguageServer.Options;
using Bicep.LanguageServer.Providers;
using Bicep.LanguageServer.Utils;
using FluentAssertions;
Expand Down Expand Up @@ -63,7 +64,7 @@ private async Task<IEnumerable<CodeAction>> GetCodeActions(
clientCapabilitiesProvider.Setup(m => m.DoesClientSupportShowDocumentRequest()).Returns(clientSupportShowDocumentRequestAndWorkspaceFolders);
clientCapabilitiesProvider.Setup(m => m.DoesClientSupportWorkspaceFolders()).Returns(clientSupportShowDocumentRequestAndWorkspaceFolders);

var bicepEditLinterRuleHandler = new BicepCodeActionHandler(bicepCompilationManager, clientCapabilitiesProvider.Object, new DocumentSelectorFactory(null));
var bicepEditLinterRuleHandler = new BicepCodeActionHandler(bicepCompilationManager, clientCapabilitiesProvider.Object, new DocumentSelectorFactory(BicepLangServerOptions.Default));

var range = new Range()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using Bicep.LangServer.IntegrationTests.Helpers;
using Bicep.LanguageServer.Configuration;
using Bicep.LanguageServer.Handlers;
using Bicep.LanguageServer.Options;
using Bicep.LanguageServer.Telemetry;
using Bicep.LanguageServer.Utils;
using Microsoft.VisualStudio.TestTools.UnitTesting;
Expand Down Expand Up @@ -197,7 +198,7 @@ private async Task ChangeLinterRuleState(Mock<ITelemetryProvider> telemetryProvi
new Workspace());


var bicepTextDocumentSyncHandler = new BicepTextDocumentSyncHandler(compilationManager, bicepConfigChangeHandler, new DocumentSelectorFactory(null));
var bicepTextDocumentSyncHandler = new BicepTextDocumentSyncHandler(compilationManager, bicepConfigChangeHandler, new DocumentSelectorFactory(BicepLangServerOptions.Default));

await bicepTextDocumentSyncHandler.Handle(TextDocumentParamHelper.CreateDidOpenDocumentParams(bicepConfigUri, prevBicepConfigFileContents, 1), CancellationToken.None);

Expand Down
2 changes: 1 addition & 1 deletion src/Bicep.LangServer/IServiceCollectionExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public static IServiceCollection AddBicepDecompiler(this IServiceCollection serv

public static IServiceCollection AddServerDependencies(
this IServiceCollection services,
IBicepLangServerOptions bicepLangServerOptions
BicepLangServerOptions bicepLangServerOptions
) => services
.AddBicepCore()
.AddBicepDecompiler()
Expand Down
4 changes: 2 additions & 2 deletions src/Bicep.LangServer/Options/BicepLangServerOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace Bicep.LanguageServer.Options;

public class BicepLangServerOptions : IBicepLangServerOptions
public record BicepLangServerOptions(bool VsCompatibilityMode = false)
{
public bool VsCompatibilityMode { get; set; }
public static BicepLangServerOptions Default = new();
}
12 changes: 0 additions & 12 deletions src/Bicep.LangServer/Options/IBicepLangServerOptions.cs

This file was deleted.

2 changes: 1 addition & 1 deletion src/Bicep.LangServer/Server.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ namespace Bicep.LanguageServer
public class Server : IDisposable
{
private readonly OmnisharpLanguageServer server;
public Server(IBicepLangServerOptions bicepLangServerOptions, Action<LanguageServerOptions> onOptionsFunc)
public Server(BicepLangServerOptions bicepLangServerOptions, Action<LanguageServerOptions> onOptionsFunc)
{
server = OmnisharpLanguageServer.PreInit(options =>
{
Expand Down
2 changes: 1 addition & 1 deletion src/Bicep.LangServer/Utils/DocumentSelectorFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

namespace Bicep.LanguageServer.Utils
{
public class DocumentSelectorFactory(IBicepLangServerOptions? langServerOptions)
public class DocumentSelectorFactory(BicepLangServerOptions langServerOptions)
{
private static string Glob(params string[] extensions)
{
Expand Down

0 comments on commit 7a83378

Please sign in to comment.