-
Notifications
You must be signed in to change notification settings - Fork 790
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
Tag items in tooltips consistenly with respect to document classification (such colors, much wow) #9563
Conversation
Ugh, aligning QuickInfo data with classification data is going to be challenging. But it would fix at least one additional bug in this repo. The QuickInfo data is ultimately computed here: https://github.com/dotnet/fsharp/blob/master/src/fsharp/symbols/SymbolHelpers.fs#L1041 So this could be adjusted (and what it calls) to be similar to Semantic Classification. Or a bigger refactoring could be done where everything ultimately points to the same "classification" routine. Will need to think about this one a bit, since the needs of "classifying" things in a tooltip could be different from the needs of classifying a document. Aligning these things would mean a pretty significant enhancement to the layout type, which is used in FSharp.Core pretty printing and FSI pretty printing. I'm definitely not interested in a complete revamp like how Roslyn does things though, since that would be an enormous change. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@@ -64,7 +64,25 @@ module internal PrintUtilities = | |||
| (x :: rest) -> [ resultFunction x (layoutFunction x -- leftL (tagText (match rest.Length with 1 -> FSComp.SR.nicePrintOtherOverloads1() | n -> FSComp.SR.nicePrintOtherOverloadsN(n)))) ] | |||
| _ -> [] | |||
|
|||
let layoutTyconRefImpl isAttribute (denv: DisplayEnv) (tcref: TyconRef) = | |||
let layoutTyconRefImpl isAttribute (denv: DisplayEnv) (tcref: TyconRef) = | |||
let tagEntityRefName (xref: EntityRef) name = |
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.
necessary?
This comment has been minimized.
This comment has been minimized.
Further checklist:
|
#6160 is also fixed here |
I didn't test my bug report against a build with the changes of this PR, so it's possible it has already been tackled here. Be as it may, I think it's at least related: #9771 (in short: certain constraints like |
Left a comment there; this PR doesn't do anything to help the situation. Name resolution lacks the ability to properly distinguish or at least emit data that distinguishes the cases you've noted there. |
90e29ac
to
e54f9f1
Compare
Would appreciate a review at some point @KevinRansom @TIHan @dsyme |
4364551
to
9ad7f48
Compare
I can't update baselines on my machine the "proper" way, since my machine will BSOD if I run tests in release. pls halp |
Looking at #9511 and this I thought I'd write up my opinions on the distinctions being made in colorization and classifications. These are "just my opinions" but I'll try to explain them. This is mostly written with regard to the colorization of code though similar things can apply to tooltips Regarding methodology - in the absence of user testing (very very hard), one methodology is to consider what distinctions matter in the mind of the F# user and when, and how intrusive the distinction is to the act of coding. Three principles seem to be
Now, there are literally zillions of distinctions we could make, e.g. struct v. reference, union v. record, big v. small, delegate v. function, disposable v. non-disposable, static v. non-static, public v. non-public, types with a Count property and without, etc. etc. For F#, we shouldn't just suck up C#'s distinctions. However, the F# language design is rooted in the idea that you have values (let) and types (type). Different types and values have different characteristics, but much is done to emphasise similarity between these, rather than distinction. For example, a union type is different to a record type but both can have members. Iin most code, most the time, the user doesn't care if something is implemented as a record or a union. Because of this, emphasising the difference in implementation would be wrong. At the extreme, in F# a signature file can just say "type X" and be essentially non-commital about what "X" is - it doesn't matter if its an interface, class, delegate or whatever (though for technical reasons its structness must be known). Those are implementation details - what matters in functional programming is the set of operations you can do with "X". That said, a type's representation can make some particular operations available (e.g. pattern matching) Anyway, let's take some examples and I'll give my opinions. These can be read as either arguing for an elimination of a distinction or the reducing of the "size" of the distinction.
@cartermp Are there other distinctions planned I could give my 2c worth on? |
c59ad5e
to
4ad02be
Compare
This is ready for review @dsyme @TIHan @KevinRansom @auduchinok |
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.
Looks great! Looking forward to seeing the consistency.
Only thing is the isFunctionTy
should be a different name so we don't get confused by isFunTy
.
Please disregard my previous comment, it's fine in 5.0 |
…tion (such colors, much wow) (dotnet#9563)
…tion (such colors, much wow) (dotnet#9563)
…tion (such colors, much wow) (dotnet#9563)
Fixes #5385 and various other inconsistencies. Also fixes #9561 and fixes #6160
WE GOT US SOME MORE COLORS FOLKS
Value types are now colored in tooltips (as they are in source). Parameters and properties (and record labels) are colored just like parameters in source:
Methods have the same coloring as methods in source:
Functions have the same coloring as functions in source:
Methods and constructors follow the
+ N overloads
paradigm and properties with get/set aren't shown twice anymore:Generic type instantiations in tooltips show the correct color for their type kind:
.NET-defined types now also have the same fidelity as F#-defined types w.r.t colorization:
Another example: