-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Only qualify the first symbol in Quick Info #27946
base: main
Are you sure you want to change the base?
Conversation
@@ -745,7 +745,7 @@ public class GenericList<T> { Generic$$List<int> t; }"; | |||
{ | |||
await TestInClassAsync( | |||
@"event $$EventHandler e;", | |||
MainDescription("delegate void System.EventHandler(object sender, System.EventArgs e)")); | |||
MainDescription("delegate void System.EventHandler(object sender, EventArgs e)")); |
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.
I'm a little concerned about this. Currently, in TypeScript, i often get very minimally-qualified names (basically, i think their quick-info is always 'just the name'). And i'm in a codebase with several duplicate names across modules. Not being qualified is actually a big hindrance because it's not clear what the type actually is...
--
Note: it's a small concern. I think this is worth trying out.
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.
📝 The type is still qualified if the name would not resolve in the current scope.
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.
Echoing @CyrusNajmabadi's concern: this might be a good candidate for a quick design discussion first.
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.
Sure, but remember the new design matches what we already do for all other members. It also goes a long way towards fixing #5 for users who have using
declarations in the file. The old behavior is a side effect of the inability to enable context-specific minimization while also including the namespace for the first type.
@@ -55,5 +55,13 @@ public enum SymbolDisplayMiscellaneousOptions | |||
/// the special question mark syntax. | |||
/// </summary> | |||
ExpandNullable = 1 << 5, | |||
|
|||
/// <summary> | |||
/// Suppresses minimization of the first visited symbol. |
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.
I have to admit, it's not clear to me what "first visited symbol" means in this case as an external consumer of the API. The visitor is an implementation detail of this API, no? It seems the term shouldn't appear here then.
|
||
return new SymbolDisplayVisitor( | ||
this.builder, | ||
this.format.WithKindOptions(SymbolDisplayKindOptions.None), |
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.
Why the forcing to .None?
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.
The kind is already being printed as part of the nested type. We don't want to include the type kind for the containing type or you could end up with a display like this:
// namespace X
namespace X {
// class X.A
class A {
// struct class X.A.B
struct B { }
}
}
@@ -745,7 +745,7 @@ public class GenericList<T> { Generic$$List<int> t; }"; | |||
{ | |||
await TestInClassAsync( | |||
@"event $$EventHandler e;", | |||
MainDescription("delegate void System.EventHandler(object sender, System.EventArgs e)")); | |||
MainDescription("delegate void System.EventHandler(object sender, EventArgs e)")); |
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.
Echoing @CyrusNajmabadi's concern: this might be a good candidate for a quick design discussion first.
Previously, containing types of a nested type were not treated as the "first type" by the symbol display visitor, so generic type constraints were omitted from the displayed result even when SymbolDisplayGenericsOptions.IncludeTypeConstraints was specified in the format. In the new code, containing types of a nested type are still treated as part of the "first type", so the generic constraints are included in the symbol display text.
@dotnet/roslyn-compiler The alternative to commit e282986 appears to be updating the |
@@ -1864,10 +1864,10 @@ End Class | |||
|
|||
CompilationUtils.AssertTheseDiagnostics(compilation, | |||
<expected> | |||
BC30508: 'B' cannot expose type 'A.B(Of T).C' in class 'A' through class 'B'. | |||
BC30508: 'B' cannot expose type 'A.B(Of T As A.B(Of T).C).C' in class 'A' through class 'B'. |
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.
Is this change expected? The resulting error message is harder to read.
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.
Please see my comment above explaining why this happens and a possible alternative. I can go either way but wasn't sure about the broader impact of changing a predefined format.
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.
After discussing this offline, I think we should consider changing the VB diagnostic format to report A(Of T As X).B(Of U As Y)
as A(Of T).B(Of U)
. That change could be handled separately from this PR, although it might block this PR. If you agree, please log a bug, thanks.
Please add a test to |
@cston is there a specific code path you'd like to see tested? The changes I made to existing tests seemed to cover most if not all aspects. |
@sharwell, ideally compiler changes should be covered by targeted compiler tests rather than relying on IDE tests. Please add specific tests to |
can we potentially move forward with this. The current behavior does seem quite inconsistent and annoying at times (esp. constraints of type-parameters of type-decls). |
Fixes #547
Ask Mode template not completed
Customer scenario
What does the customer do to get into this situation, and why do we think this
is common enough to address for this release. (Granted, sometimes this will be
obvious "Open project, VS crashes" but in general, I need to understand how
common a scenario is)
Bugs this fixes
(either VSO or GitHub links)
Workarounds, if any
Also, why we think they are insufficient for RC vs. RC2, RC3, or RTW
Risk
This is generally a measure our how central the affected code is to adjacent
scenarios and thus how likely your fix is to destabilize a broader area of code
Performance impact
(with a brief justification for that assessment (e.g. "Low perf impact because no extra allocations/no complexity changes" vs. "Low")
Is this a regression from a previous update?
Root cause analysis
How did we miss it? What tests are we adding to guard against it in the future?
How was the bug found?
(E.g. customer reported it vs. ad hoc testing)
Test documentation updated?
If this is a new non-compiler feature or a significant improvement to an existing feature, update https://github.com/dotnet/roslyn/wiki/Manual-Testing once you know which release it is targeting.