-
Notifications
You must be signed in to change notification settings - Fork 418
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Intellisense not showing methods from the Base class in Signature Help #1030
Changes from 2 commits
30c5092
de3de6a
ef0352a
eff068d
cf8f790
6362fda
997d104
41d4d2c
2c0bc6f
9cb58b4
07cee28
29b3803
2e1e0a0
cda2c28
a13a6b0
17f52cf
fbc4c5f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -133,7 +133,15 @@ private IEnumerable<IMethodSymbol> GetMethodOverloads(SemanticModel semanticMode | |
return new IMethodSymbol[] { }; | ||
} | ||
|
||
return symbol.ContainingType.GetMembers(symbol.Name).OfType<IMethodSymbol>(); | ||
var MethodOverloads = symbol.ContainingType.GetMembers(symbol.Name).OfType<IMethodSymbol>(); | ||
var BaseType = symbol.ContainingType.BaseType; | ||
while(BaseType!=null && BaseType.ContainingNamespace.Name!= "System") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. spacing is off here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The above mentioned change is failing for the case of attribute constructor as the System.Attribute class doesn't have the SpecialType as System_Object, hence for that case we will also get an Attribute.Attribute method which is not required.This is the reason the System Namespace has been used. |
||
{ | ||
MethodOverloads = MethodOverloads.Concat(BaseType.GetMembers(symbol.Name).OfType<IMethodSymbol>()); | ||
BaseType = BaseType.BaseType; | ||
} | ||
|
||
return MethodOverloads; | ||
} | ||
|
||
private int InvocationScore(IMethodSymbol symbol, IEnumerable<TypeInfo> types) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -474,13 +474,40 @@ public Program(Program p, int n) | |
{ | ||
} | ||
}"; | ||
|
||
var actual = await GetSignatureHelp(source); | ||
Assert.Equal(3, actual.Signatures.Count()); | ||
Assert.Equal(1, actual.ActiveParameter); | ||
Assert.Contains("ctor2", actual.Signatures.ElementAt(actual.ActiveSignature).Documentation); | ||
} | ||
|
||
[Fact] | ||
public async Task SignatureHelpForOverloadedMethodsInheritance() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you add a case for methods with the same name that shouldn't be accessible? Eg: class Program
{
static void Main(string[] args)
{
}
private void Foo() { }
}
class G : Program
{
protected void Foo() { }
} |
||
{ | ||
const string source = | ||
@"public class MyBase | ||
{ | ||
public void MyMethod(int a) { } | ||
public void MyMethod(int a, int b) { } | ||
} | ||
public class Class1 : MyBase | ||
{ | ||
public void MyMethod(int a, int b, int c) { } | ||
public void MyMethod(int a, int b, int c, int d) { } | ||
} | ||
public class Class2 | ||
{ | ||
public void foo() | ||
{ | ||
Class1 c1 = new Class1(); | ||
c1.MyMethod($$); | ||
} | ||
}"; | ||
var actual = await GetSignatureHelp(source); | ||
Assert.Equal(4, actual.Signatures.Count()); | ||
} | ||
[Fact] | ||
public async Task SkipReceiverOfExtensionMethods() | ||
{ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
local variables should start with lowercase