From 563011922dadbd2d80ac225b543a2f6b8a6b86da Mon Sep 17 00:00:00 2001 From: Anthony Martin Date: Thu, 3 Jun 2021 20:12:09 -0400 Subject: [PATCH] Fix span calculation in ValidateSnippetCompletionAfterPlaceholderReplacements --- src/Bicep.LangServer.IntegrationTests/CompletionTests.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Bicep.LangServer.IntegrationTests/CompletionTests.cs b/src/Bicep.LangServer.IntegrationTests/CompletionTests.cs index 59fb88f8bb6..a212fed8f76 100644 --- a/src/Bicep.LangServer.IntegrationTests/CompletionTests.cs +++ b/src/Bicep.LangServer.IntegrationTests/CompletionTests.cs @@ -94,7 +94,10 @@ public async Task ValidateSnippetCompletionAfterPlaceholderReplacements(Completi var combinedSourceFileName = Path.Combine("src", "Bicep.LangServer.IntegrationTests", pathPrefix, Path.GetRelativePath(outputDirectory, combinedFileName)); File.Exists(combinedFileName).Should().BeTrue($"Combined snippet file \"{combinedSourceFileName}\" should be checked in"); - var syntaxTreeGrouping = SyntaxTreeGroupingBuilder.Build(new FileResolver(), new Workspace(), PathHelper.FilePathToFileUrl(combinedFileName)); + var combinedFileUri = PathHelper.FilePathToFileUrl(combinedFileName); + var syntaxTreeGrouping = SyntaxTreeGroupingFactory.CreateForFiles(new Dictionary { + [combinedFileUri] = replacementContents, + }, combinedFileUri); var compilation = new Compilation(TypeProvider, syntaxTreeGrouping); var diagnostics = compilation.GetEntrypointSemanticModel().GetAllDiagnostics();