From 18cf2e415eb050de4e2e8a3520a25adbfc20aafa Mon Sep 17 00:00:00 2001 From: filipw Date: Wed, 5 Jun 2019 19:51:11 +0200 Subject: [PATCH 1/5] added Humanizer reference to work around Roslyn bug --- build/Packages.props | 1 + src/OmniSharp.Roslyn.CSharp/OmniSharp.Roslyn.CSharp.csproj | 1 + 2 files changed, 2 insertions(+) diff --git a/build/Packages.props b/build/Packages.props index 17b6b8d7e8..03e5071c63 100644 --- a/build/Packages.props +++ b/build/Packages.props @@ -14,6 +14,7 @@ + diff --git a/src/OmniSharp.Roslyn.CSharp/OmniSharp.Roslyn.CSharp.csproj b/src/OmniSharp.Roslyn.CSharp/OmniSharp.Roslyn.CSharp.csproj index 7755a3546b..28ce5eea30 100644 --- a/src/OmniSharp.Roslyn.CSharp/OmniSharp.Roslyn.CSharp.csproj +++ b/src/OmniSharp.Roslyn.CSharp/OmniSharp.Roslyn.CSharp.csproj @@ -12,6 +12,7 @@ + From f5a4428f3ae31000c8406addc8392af98236c7be Mon Sep 17 00:00:00 2001 From: filipw Date: Wed, 5 Jun 2019 19:51:55 +0200 Subject: [PATCH 2/5] what? dnx? --- tests/TestUtility/OmniSharpTestHost.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/TestUtility/OmniSharpTestHost.cs b/tests/TestUtility/OmniSharpTestHost.cs index e81b14f6e6..f66ab824f2 100644 --- a/tests/TestUtility/OmniSharpTestHost.cs +++ b/tests/TestUtility/OmniSharpTestHost.cs @@ -131,8 +131,8 @@ public void AddFilesToWorkspace(params TestFile[] testFiles) { TestHelpers.AddProjectToWorkspace( this.Workspace, - "project.json", - new[] { "dnx451", "dnxcore50" }, + "project.csproj", + new[] { "net472" }, testFiles.Where(f => f.FileName.EndsWith(".cs", StringComparison.OrdinalIgnoreCase)).ToArray()); foreach (var csxFile in testFiles.Where(f => f.FileName.EndsWith(".csx", StringComparison.OrdinalIgnoreCase))) From ab72aa3f25c3d1ccdd6d8747d427e01561e7f28b Mon Sep 17 00:00:00 2001 From: filipw Date: Wed, 5 Jun 2019 19:52:19 +0200 Subject: [PATCH 3/5] added test for declaration completion --- .../IntellisenseFacts.cs | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/tests/OmniSharp.Roslyn.CSharp.Tests/IntellisenseFacts.cs b/tests/OmniSharp.Roslyn.CSharp.Tests/IntellisenseFacts.cs index f1985ebd9a..171cc74b06 100644 --- a/tests/OmniSharp.Roslyn.CSharp.Tests/IntellisenseFacts.cs +++ b/tests/OmniSharp.Roslyn.CSharp.Tests/IntellisenseFacts.cs @@ -142,7 +142,7 @@ public Class1() System.Guid.gu$$ } }"; - + var completions = await FindCompletionsAsync(filename, input); ContainsCompletions(completions.Select(c => c.CompletionText).Take(1), "NewGuid"); } @@ -285,6 +285,24 @@ public MyClass2() ContainsCompletions(completions.Select(c => c.CompletionText).Take(1), "text"); } + [Theory] + [InlineData("dummy.cs")] + [InlineData("dummy.csx")] + public async Task Returns_declaration_names(string filename) + { + const string source = + @" +public class MyClass +{ + MyClass m$$ +} + "; + + var completions = await FindCompletionsAsync(filename, source); + ContainsCompletions(completions.Select(c => c.CompletionText), "my", "myClass", "My", "MyClass"); + } + + [Theory] [InlineData("dummy.cs")] [InlineData("dummy.csx")] From 97f0b4ea55571ee26771ce0a68b803c04177e594 Mon Sep 17 00:00:00 2001 From: filipw Date: Wed, 5 Jun 2019 20:05:14 +0200 Subject: [PATCH 4/5] declaration name completion note in CHANGELOG.md --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6d8b5d71d0..6421d0ed46 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,9 @@ # Changelog All changes to the project will be documented in this file. +## [1.32.21] - not yet released +* Fixed a regression on declaration name completion (PR: [#1520](https://github.com/OmniSharp/omnisharp-roslyn/pull/1520)) + ## [1.32.20] - 2019-06-03 * Added support for `TreatWarningsAsErrors` in csproj files (PR: [#1459](https://github.com/OmniSharp/omnisharp-roslyn/pull/1459)) * Updated to Roslyn `3.2.0-beta3-19281-01` to match VS dev16.2p2 (PR: [#1511](https://github.com/OmniSharp/omnisharp-roslyn/pull/1511)) From 5a6e450761b25aa44663255f0ff22224366a31e9 Mon Sep 17 00:00:00 2001 From: filipw Date: Wed, 5 Jun 2019 21:09:29 +0200 Subject: [PATCH 5/5] fixed test --- .../OmniSharp.Roslyn.CSharp.Tests/BufferManagerFacts.cs | 9 +++------ tests/OmniSharp.Tests/UpdateBufferFilterFacts.cs | 4 ++-- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/tests/OmniSharp.Roslyn.CSharp.Tests/BufferManagerFacts.cs b/tests/OmniSharp.Roslyn.CSharp.Tests/BufferManagerFacts.cs index 2eb53cf89f..5dfdd3b9ba 100644 --- a/tests/OmniSharp.Roslyn.CSharp.Tests/BufferManagerFacts.cs +++ b/tests/OmniSharp.Roslyn.CSharp.Tests/BufferManagerFacts.cs @@ -25,19 +25,16 @@ public async Task UpdateBufferIgnoresVoidRequests() { using (var host = CreateOmniSharpHost(new TestFile("test.cs", "class C {}"))) { - Assert.Equal(2, host.Workspace.CurrentSolution.Projects.Count()); + Assert.Single(host.Workspace.CurrentSolution.Projects); Assert.Single(host.Workspace.CurrentSolution.Projects.ElementAt(0).Documents); - Assert.Single(host.Workspace.CurrentSolution.Projects.ElementAt(1).Documents); await host.Workspace.BufferManager.UpdateBufferAsync(new Request() { }); - Assert.Equal(2, host.Workspace.CurrentSolution.Projects.Count()); + Assert.Single(host.Workspace.CurrentSolution.Projects); Assert.Single(host.Workspace.CurrentSolution.Projects.ElementAt(0).Documents); - Assert.Single(host.Workspace.CurrentSolution.Projects.ElementAt(1).Documents); await host.Workspace.BufferManager.UpdateBufferAsync(new Request() { FileName = "", Buffer = "enum E {}" }); - Assert.Equal(2, host.Workspace.CurrentSolution.Projects.Count()); + Assert.Single(host.Workspace.CurrentSolution.Projects); Assert.Single(host.Workspace.CurrentSolution.Projects.ElementAt(0).Documents); - Assert.Single(host.Workspace.CurrentSolution.Projects.ElementAt(1).Documents); } } diff --git a/tests/OmniSharp.Tests/UpdateBufferFilterFacts.cs b/tests/OmniSharp.Tests/UpdateBufferFilterFacts.cs index 66d8d6fa4d..dbe86862f4 100644 --- a/tests/OmniSharp.Tests/UpdateBufferFilterFacts.cs +++ b/tests/OmniSharp.Tests/UpdateBufferFilterFacts.cs @@ -59,7 +59,7 @@ public async Task UpdateBuffer_AddsNewDocumentsIfNeeded() { await host.Workspace.BufferManager.UpdateBufferAsync(new Request() { FileName = "test2.cs", Buffer = "interface I {}" }); - Assert.Equal(2, host.Workspace.CurrentSolution.GetDocumentIdsWithFilePath("test2.cs").Length); + Assert.Single(host.Workspace.CurrentSolution.GetDocumentIdsWithFilePath("test2.cs")); var docId = host.Workspace.CurrentSolution.GetDocumentIdsWithFilePath("test2.cs").FirstOrDefault(); Assert.NotNull(docId); var sourceText = await host.Workspace.CurrentSolution.GetDocument(docId).GetTextAsync(); @@ -82,7 +82,7 @@ public async Task UpdateBuffer_TransientDocumentsDisappearWhenProjectAddsThem() await host.Workspace.BufferManager.UpdateBufferAsync(new Request() { FileName = "transient.cs", Buffer = "interface I {}" }); var docIds = host.Workspace.CurrentSolution.GetDocumentIdsWithFilePath("transient.cs"); - Assert.Equal(2, docIds.Length); + Assert.Single(docIds); // simulate a project system adding the file for real var project1 = host.Workspace.CurrentSolution.Projects.First();