提交 430910cd 编写于 作者: R Ravi Chande

Order documents correctly

Need to ensure that items from the current context are preferred over
ones from other contexts.
上级 25b5abd8
......@@ -6910,7 +6910,7 @@ void Shared()
</Project>
</Workspace>";
var expectedDescription = $"void C.Do(string x)";
var expectedDescription = $"void C.Do(int x)";
VerifyItemInLinkedFiles(markup, "Do", expectedDescription);
}
......@@ -6944,7 +6944,7 @@ void Shared()
</Project>
</Workspace>";
var expectedDescription = $"({FeaturesResources.Field}) int C.Do\r\n\r\n{string.Format(FeaturesResources.ProjectAvailability, "Proj1", FeaturesResources.NotAvailable)}\r\n{string.Format(FeaturesResources.ProjectAvailability, "Proj2", FeaturesResources.Available)}\r\n\r\n{FeaturesResources.UseTheNavigationBarToSwitchContext}";
var expectedDescription = $"void C.Do(int x) (+ 1 {FeaturesResources.Overload})\r\n\r\n{string.Format(FeaturesResources.ProjectAvailability, "Proj1", FeaturesResources.Available)}\r\n{string.Format(FeaturesResources.ProjectAvailability, "Proj2", FeaturesResources.NotAvailable)}\r\n\r\n{FeaturesResources.UseTheNavigationBarToSwitchContext}";
VerifyItemInLinkedFiles(markup, "Do", expectedDescription);
}
......@@ -6983,6 +6983,45 @@ public static void Do (this C c, string x)
</Project>
</Workspace>";
var expectedDescription = $"void C.Do(int x)";
VerifyItemInLinkedFiles(markup, "Do", expectedDescription);
}
[Fact, Trait(Traits.Feature, Traits.Features.Completion)]
public void MethodOverloadDifferencesIgnored_ExtensionMethod2()
{
var markup = @"<Workspace>
<Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj1"" PreprocessorSymbols=""TWO"">
<Document FilePath=""CurrentDocument.cs""><![CDATA[
class C
{
#if ONE
void Do(int x){}
#endif
void Shared()
{
this.$$
}
}
public static class Extensions
{
#if TWO
public static void Do (this C c, string x)
{
}
#endif
}
]]>
</Document>
</Project>
<Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj2"" PreprocessorSymbols=""ONE"">
<Document IsLinkFile=""true"" LinkAssemblyName=""Proj1"" LinkFilePath=""CurrentDocument.cs""/>
</Project>
</Workspace>";
var expectedDescription = $"(extension) void C.Do(string x)";
VerifyItemInLinkedFiles(markup, "Do", expectedDescription);
}
......@@ -7037,7 +7076,7 @@ public class Methods2
</Project>
</Workspace>";
var expectedDescription = $"void Methods2.Do(string x)";
var expectedDescription = $"void Methods1.Do(string x)";
VerifyItemInLinkedFiles(markup, "Do", expectedDescription);
}
......
......@@ -207,7 +207,7 @@ private async Task<IEnumerable<CompletionItem>> GetItemsWorkerAsync(Document doc
return await CreateItemsAsync(position, itemsForCurrentDocument, context, null, null, preselect, cancellationToken).ConfigureAwait(false);
}
var contextAndSymbolLists = await GetPerContextSymbols(document, position, options, relatedDocumentIds.Concat(document.Id), preselect, cancellationToken).ConfigureAwait(false);
var contextAndSymbolLists = await GetPerContextSymbols(document, position, options, new[] { document.Id }.Concat(relatedDocumentIds), preselect, cancellationToken).ConfigureAwait(false);
Dictionary<ISymbol, AbstractSyntaxContext> orignatingContextMap = null;
var unionedSymbolsList = UnionSymbols(contextAndSymbolLists, out orignatingContextMap);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册