diff --git a/Directory.Packages.props b/Directory.Packages.props index b28d8f9903..ad8eb944d9 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -9,7 +9,7 @@ 17.6.0 17.3.2 6.8.0-preview.1.69 - 4.8.0-1.23419.1 + 4.9.0-1.23504.3 2.4.1 diff --git a/src/OmniSharp.Abstractions/Configuration.cs b/src/OmniSharp.Abstractions/Configuration.cs index 8ef631ac07..1c5355f25a 100644 --- a/src/OmniSharp.Abstractions/Configuration.cs +++ b/src/OmniSharp.Abstractions/Configuration.cs @@ -4,7 +4,7 @@ internal static class Configuration { public static bool ZeroBasedIndices = false; - public const string RoslynVersion = "4.8.0.0"; + public const string RoslynVersion = "4.9.0.0"; public const string RoslynPublicKeyToken = "31bf3856ad364e35"; public readonly static string RoslynFeatures = GetRoslynAssemblyFullName("Microsoft.CodeAnalysis.Features"); diff --git a/src/OmniSharp.Http.Driver/app.config b/src/OmniSharp.Http.Driver/app.config index 65ca09de64..0d4b36420e 100644 --- a/src/OmniSharp.Http.Driver/app.config +++ b/src/OmniSharp.Http.Driver/app.config @@ -7,31 +7,31 @@ - + - + - + - + - + - + - + diff --git a/src/OmniSharp.LanguageServerProtocol/app.config b/src/OmniSharp.LanguageServerProtocol/app.config index e448e04605..a7df8afbcb 100644 --- a/src/OmniSharp.LanguageServerProtocol/app.config +++ b/src/OmniSharp.LanguageServerProtocol/app.config @@ -7,31 +7,31 @@ - + - + - + - + - + - + - + diff --git a/src/OmniSharp.Roslyn.CSharp/Services/Navigation/SourceGeneratedFileService.cs b/src/OmniSharp.Roslyn.CSharp/Services/Navigation/SourceGeneratedFileService.cs index e3bfb6b8b5..96716ee0fa 100644 --- a/src/OmniSharp.Roslyn.CSharp/Services/Navigation/SourceGeneratedFileService.cs +++ b/src/OmniSharp.Roslyn.CSharp/Services/Navigation/SourceGeneratedFileService.cs @@ -1,13 +1,14 @@ #nullable enable -using Microsoft.CodeAnalysis; -using Microsoft.Extensions.Logging; -using OmniSharp.Mef; -using OmniSharp.Models.v1.SourceGeneratedFile; using System.Collections.Generic; using System.Composition; using System.Threading; using System.Threading.Tasks; +using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.ExternalAccess.OmniSharp.Workspace; +using Microsoft.Extensions.Logging; +using OmniSharp.Mef; +using OmniSharp.Models.v1.SourceGeneratedFile; namespace OmniSharp.Roslyn.CSharp.Services.Navigation { @@ -100,6 +101,10 @@ public Task Handle(SourceGeneratedFileClosedR return SourceGeneratedFileClosedResponse.Instance; } - private DocumentId GetId(SourceGeneratedFileInfo info) => DocumentId.CreateFromSerialized(ProjectId.CreateFromSerialized(info.ProjectGuid), info.DocumentGuid); + private static DocumentId GetId(SourceGeneratedFileInfo info) => OmniSharpDocumentId.CreateFromSerialized( + ProjectId.CreateFromSerialized(info.ProjectGuid), + info.DocumentGuid, + isSourceGenerated: true, + debugName: null); } } diff --git a/src/OmniSharp.Stdio.Driver/app.config b/src/OmniSharp.Stdio.Driver/app.config index 65ca09de64..0d4b36420e 100644 --- a/src/OmniSharp.Stdio.Driver/app.config +++ b/src/OmniSharp.Stdio.Driver/app.config @@ -7,31 +7,31 @@ - + - + - + - + - + - + - + diff --git a/tests/OmniSharp.Lsp.Tests/OmnisharpCompletionHandlerFacts.cs b/tests/OmniSharp.Lsp.Tests/OmnisharpCompletionHandlerFacts.cs index 4d5133dd80..9070d84707 100644 --- a/tests/OmniSharp.Lsp.Tests/OmnisharpCompletionHandlerFacts.cs +++ b/tests/OmniSharp.Lsp.Tests/OmnisharpCompletionHandlerFacts.cs @@ -1,13 +1,13 @@ -using Microsoft.CodeAnalysis; -using Microsoft.CodeAnalysis.Text; -using OmniSharp.Extensions.LanguageServer.Protocol.Document; -using OmniSharp.Extensions.LanguageServer.Protocol.Models; -using System; +using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Threading; using System.Threading.Tasks; +using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.Text; +using OmniSharp.Extensions.LanguageServer.Protocol.Document; +using OmniSharp.Extensions.LanguageServer.Protocol.Models; using TestUtility; using Xunit; using Xunit.Abstractions; @@ -288,7 +288,7 @@ public async Task ImportCompletion_OnLine0(string filename) Assert.Single(resolved.AdditionalTextEdits); var additionalEdit = resolved.AdditionalTextEdits.First(); Assert.Equal(NormalizeNewlines("using System;\n\n"), - additionalEdit.NewText); + NormalizeNewlines(additionalEdit.NewText)); Assert.Equal(0, additionalEdit.Range.Start.Line); Assert.Equal(0, additionalEdit.Range.Start.Character); Assert.Equal(0, additionalEdit.Range.End.Line); @@ -375,12 +375,12 @@ public class C3 Assert.Single(resolved.AdditionalTextEdits); var additionalEdit = resolved.AdditionalTextEdits.First(); - Assert.Equal(NormalizeNewlines("N2;\nusing "), + Assert.Equal(NormalizeNewlines("using N2;\n"), additionalEdit.NewText); Assert.Equal(1, additionalEdit.Range.Start.Line); - Assert.Equal(6, additionalEdit.Range.Start.Character); + Assert.Equal(0, additionalEdit.Range.Start.Character); Assert.Equal(1, additionalEdit.Range.End.Line); - Assert.Equal(6, additionalEdit.Range.End.Character); + Assert.Equal(0, additionalEdit.Range.End.Character); VerifySortOrders(completions.Items); } @@ -1530,7 +1530,7 @@ public void M() protected async Task FindCompletionsAsync(string filename, string source, char? triggerChar = null, TestFile[] additionalFiles = null) { var bufferPath = $"{Directory.GetCurrentDirectory()}{Path.DirectorySeparatorChar}somepath{Path.DirectorySeparatorChar}{filename}"; - var testFile = new TestFile(bufferPath, source); + var testFile = new TestFile(bufferPath, NormalizeNewlines(source)); var files = new[] { testFile }; if (additionalFiles is object) @@ -1588,7 +1588,7 @@ private async Task EnableImportCompletion() } private static string NormalizeNewlines(string str) - => str.Replace("\r\n", Environment.NewLine); + => str.Replace("\r\n", "\n"); private static void VerifySortOrders(IEnumerable items) { diff --git a/tests/OmniSharp.Roslyn.CSharp.Tests/CompletionFacts.cs b/tests/OmniSharp.Roslyn.CSharp.Tests/CompletionFacts.cs index 5c19d059dc..b503f5bfff 100644 --- a/tests/OmniSharp.Roslyn.CSharp.Tests/CompletionFacts.cs +++ b/tests/OmniSharp.Roslyn.CSharp.Tests/CompletionFacts.cs @@ -304,7 +304,7 @@ public async Task ImportCompletion_OnLine0(string filename, bool useAsyncComplet Assert.Single(resolved.Item.AdditionalTextEdits); var additionalEdit = resolved.Item.AdditionalTextEdits[0]; Assert.Equal(NormalizeNewlines("using System;\n\n"), - additionalEdit.NewText); + NormalizeNewlines(additionalEdit.NewText)); Assert.Equal(0, additionalEdit.StartLine); Assert.Equal(0, additionalEdit.StartColumn); Assert.Equal(0, additionalEdit.EndLine); @@ -395,12 +395,12 @@ public class C3 Assert.Single(resolved.Item.AdditionalTextEdits); var additionalEdit = resolved.Item.AdditionalTextEdits[0]; - Assert.Equal(NormalizeNewlines("N2;\nusing "), + Assert.Equal(NormalizeNewlines("using N2;\n"), additionalEdit.NewText); Assert.Equal(1, additionalEdit.StartLine); - Assert.Equal(6, additionalEdit.StartColumn); + Assert.Equal(0, additionalEdit.StartColumn); Assert.Equal(1, additionalEdit.EndLine); - Assert.Equal(6, additionalEdit.EndColumn); + Assert.Equal(0, additionalEdit.EndColumn); VerifySortOrders(completions.Items); } @@ -2273,7 +2273,7 @@ private CompletionService GetCompletionService(OmniSharpTestHost host) protected async Task FindCompletionsAsync(string filename, string source, OmniSharpTestHost testHost, char? triggerChar = null, TestFile[] additionalFiles = null, bool forceExpandedCompletionIndexCreation = false) { - var testFile = new TestFile(filename, source); + var testFile = new TestFile(filename, NormalizeNewlines(source)); var files = new[] { testFile }; if (additionalFiles is object) @@ -2331,7 +2331,7 @@ private Task AfterInsertResponse(CompletionItem c } private static string NormalizeNewlines(string str) - => str.Replace("\r\n", Environment.NewLine); + => str.Replace("\r\n", "\n"); private static void VerifySortOrders(IReadOnlyList items) { diff --git a/tests/app.config b/tests/app.config index 0a799ea77b..3572a346cc 100644 --- a/tests/app.config +++ b/tests/app.config @@ -7,31 +7,31 @@ - + - + - + - + - + - + - +