提交 7933a4a7 编写于 作者: R Ravi Chande

Shared IntelliSense should treat symbols with the same names as equivalent.

上级 b5252219
......@@ -7080,6 +7080,68 @@ public class Methods2
VerifyItemInLinkedFiles(markup, "Do", expectedDescription);
}
[Fact, Trait(Traits.Feature, Traits.Features.Completion)]
public void SharedProjectFieldAndPropertiesTreatedAsIdentical()
{
var markup = @"<Workspace>
<Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj1"" PreprocessorSymbols=""ONE"">
<Document FilePath=""CurrentDocument.cs""><![CDATA[
class C
{
#if ONE
public int x;
#endif
#if TWO
public int x {get; set;}
#endif
void foo()
{
x$$
}
}
]]>
</Document>
</Project>
<Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj2"" PreprocessorSymbols=""TWO"">
<Document IsLinkFile=""true"" LinkAssemblyName=""Proj1"" LinkFilePath=""CurrentDocument.cs""/>
</Project>
</Workspace>";
var expectedDescription = $"(field) int C.x";
VerifyItemInLinkedFiles(markup, "x", expectedDescription);
}
[Fact, Trait(Traits.Feature, Traits.Features.Completion)]
public void SharedProjectFieldAndPropertiesTreatedAsIdentical2()
{
var markup = @"<Workspace>
<Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj1"" PreprocessorSymbols=""ONE"">
<Document FilePath=""CurrentDocument.cs""><![CDATA[
class C
{
#if TWO
public int x;
#endif
#if ONE
public int x {get; set;}
#endif
void foo()
{
x$$
}
}
]]>
</Document>
</Project>
<Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj2"" PreprocessorSymbols=""TWO"">
<Document IsLinkFile=""true"" LinkAssemblyName=""Proj1"" LinkFilePath=""CurrentDocument.cs""/>
</Project>
</Workspace>";
var expectedDescription = $"(property) int C.x";
VerifyItemInLinkedFiles(markup, "x", expectedDescription);
}
[Fact, Trait(Traits.Feature, Traits.Features.Completion)]
public void ConditionalAccessWalkUp()
{
......
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Collections.Generic;
using Microsoft.CodeAnalysis.Shared.Extensions;
......@@ -16,7 +17,7 @@ internal sealed class LinkedFilesSymbolEquivalenceComparer : IEqualityComparer<I
bool IEqualityComparer<ISymbol>.Equals(ISymbol x, ISymbol y)
{
return x.Kind == y.Kind && x.Name == y.Name;
return x.Name == y.Name;
}
int IEqualityComparer<ISymbol>.GetHashCode(ISymbol symbol)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册