Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fixed declaration name completion regression #1520

Merged
merged 5 commits into from
Jun 6, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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))
Expand Down
1 change: 1 addition & 0 deletions build/Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<PackageReference Update="Dotnet.Script.DependencyModel" Version="0.6.1" />
<PackageReference Update="Dotnet.Script.DependencyModel.NuGet" Version="0.6.2" />

<PackageReference Update="Humanizer" Version="2.2.0" />
<PackageReference Update="McMaster.Extensions.CommandLineUtils" Version="2.2.4" />

<PackageReference Update="Microsoft.AspNetCore.Diagnostics" Version="2.1.1" />
Expand Down
1 change: 1 addition & 0 deletions src/OmniSharp.Roslyn.CSharp/OmniSharp.Roslyn.CSharp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Humanizer" />
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" PrivateAssets="All" />
<PackageReference Include="System.Reactive" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" />
Expand Down
9 changes: 3 additions & 6 deletions tests/OmniSharp.Roslyn.CSharp.Tests/BufferManagerFacts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down
20 changes: 19 additions & 1 deletion tests/OmniSharp.Roslyn.CSharp.Tests/IntellisenseFacts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ public Class1()
System.Guid.gu$$
}
}";

var completions = await FindCompletionsAsync(filename, input);
ContainsCompletions(completions.Select(c => c.CompletionText).Take(1), "NewGuid");
}
Expand Down Expand Up @@ -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")]
Expand Down
4 changes: 2 additions & 2 deletions tests/OmniSharp.Tests/UpdateBufferFilterFacts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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();
Expand Down
4 changes: 2 additions & 2 deletions tests/TestUtility/OmniSharpTestHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
Expand Down