-
Notifications
You must be signed in to change notification settings - Fork 674
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
Populate document outline with all symbols, not just top level #4624
Conversation
var res = analysis.GetAllAvailableMembersFromScope(scope, opts).Concat(GetChildScopesVariables(analysis, scope, opts)); | ||
foreach (var m in res) { | ||
yield return m; | ||
} |
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.
return res
?
foreach (var childScope in scope.Children) { | ||
var res = GetScopeVariables(analysis, childScope, opts); | ||
foreach (var m in res) { | ||
yield return m; | ||
} | ||
} |
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.
return scope.Children.SelectMany(c => GetScopeVariables(analysis, c, opts))
?
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.
Yep :-)
kvp.Key, | ||
null, | ||
kvp.Value.Definitions.Select(e => e.GetLocationInfo()) | ||
)); |
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.
Do we need this if there have been variables added? Or do we need it if the value has no definitions?
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.
It was existing code that applied to a single scope and now called for each scope recursively.
@@ -133,6 +133,6 @@ class BuiltinNamespace<MemberContainerType> : AnalysisValue where MemberContaine | |||
return false; | |||
} | |||
|
|||
public override int GetHashCode() => new { hc1 = GetType().GetHashCode(), hc2 = _type.GetHashCode() }.GetHashCode(); | |||
public override int GetHashCode() => new { hc1 = GetType()?.GetHashCode() ?? 0, hc2 = _type?.GetHashCode() ?? 0 }.GetHashCode(); |
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.
Think I just saw a slightly different fix in another PR, but now I look at it, we shouldn't have to call GetHashCode()
on the members here. The anonymous type GetHashCode
will do it (and handle nulls properly)
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.
Yes, will merge
microsoft/vscode-python#2334
microsoft/vscode-python#2050