Repository navigation
Shorten type annotation for Code Lens + small fixes - #5145
Conversation
Signed-off-by: realvictorprm <mueller.vpr@gmail.com>
|
This is kind of a hotfix for the Code Lens. It fixes the appearance of them (shorten) and fixes the caching algorithm so we don't loose any Code Lens. I've created those fixes already months ago but due to that @cartermp or someone else commited changes to my branch I didn't found them anymore. Anyways I was able to extract the important changes and checked that they still work. I'm aware of the missalignment of the Code Lens if scrolled too fast e.g. with mouse but I have not enough time right now to investigate that. @cartermp this is ready! |
|
@dotnet-bot test this please |
|
@realvictorprm. We are now in escrow, so the turn around time, for the dev15.8 branch is going to be much higher for a while. |
|
@KevinRansom can we please merge this. Those fixes are crucial for the caching and will solve at least part of the existing issues. |
|
This counts as a bug fix, but it will need to be validated/reviewed and bundled with other bug fixes that will require approval to merge and insert into the product. Because of that, we cannot say for sure that it will be merged in time, but we'll strive to make it happen. |
Signed-off-by: realvictorprm <mueller.vpr@gmail.com>
|
@KevinRansom the layout but was introduced by the tweaks. A single wrong field access caused that adornments on non visibile lines aren't hidden, only those on the last recent visible line. |
|
@dotnet-bot test this please |
|
@cartermp can we at least merge this for the next version? Would be great! |
Signed-off-by: realvictorprm <mueller.vpr@gmail.com>
Signed-off-by: realvictorprm <mueller.vpr@gmail.com>
|
@dsyme @KevinRansom @cartermp applied review and suggestions from both the issue and here. This is ready, please do another last review and if it's fine please merge soon. |
Signed-off-by: realvictorprm <mueller.vpr@gmail.com>
correcting wrong parameter for layoutOfPrettyMember
|
@dotnet-bot test Windows_NT Release_ci_part1 Build please |
|
@cartermp fixed |
cartermp
left a comment
There was a problem hiding this comment.
Looks good on a first pass. Some requests and questions below.
Signed-off-by: realvictorprm <mueller.vpr@gmail.com>
|
OK thank you for letting me know. @dsyme, @KevinRansom is this now fine to merge? |
|
ping, request confirmation |
|
@chadunit we need to wait another year :p |
|
OK just forget about this PR. I'll close it myself as nobody important cares :) |
|
one time again, maybe you now have some time to recheck this and finally decide to merge it. Would be great :) |
|
Geez I'll have a look into those merge conflicts :/ |
|
@KevinRansom Let's try to get this one reviewed and in |
|
Yeah, try for literally a month... |
|
@happypig being passive aggressive is neither appreciated nor will it achieve your goals. |
|
Lots of nice comments by @realvictorprm as seen above also didn't achieve goals. What kind of comment would push this forward, if I may ask? |
|
Awaiting @KevinRansom's review |
|
Thank you |
|
All checks have passed :) |
| let fullTypeSignature = func.FullType.ToString() | ||
| // Try to re-use the last results | ||
| if lastResults.ContainsKey fullDeclarationText then | ||
| if lastResults.ContainsKey funcID then |
There was a problem hiding this comment.
Since you're hashing the text, should lastResults have its key be an int rather than a string? This would avoid an extra allocation.
There was a problem hiding this comment.
If we want to minimize allocations I need to look into this again.
Maybe it would be enough to make a dictionary which maps from function name to the hash of the full type (last time it was used) and then only compare the value/hash of the last type to change only the code lens above functions which type has really changed. Would that allocate less?
There was a problem hiding this comment.
Generally no, it's preferable not to use a string as a key if you can get away with it. Although it's still all small allocations, if you're already hashing something then that would be adequate for a key.
Though generally it's recommended to use more information than just a hash for a key, since there can be hash collisions.
Alternatively, does this caching provide any notable benefits? That is, if nothing was cached, does it meaningfully affect UX when used?
There was a problem hiding this comment.
Of course, I wouldn't apply it if it wouldn't be of benefit :D
The current problem is that the key isn't unqiue which results in code lenses which aren't removed.
I think about removing the |> hash as it's better to hash the whole string anyways (so no hash collisions, thanks for the reminder btw). Currently I cannot see any possibility to remove the usage of a string as key. The small allocation is still much better than what would result in not using the cache (because that's what you get if you don't want it :D).
| let private prettyLayoutOfMember denv typarInst (v: Val) = | ||
| module private PrintTastMemberOrVals = | ||
| open PrintTypes | ||
| let private prettyLayoutOfMemberShortOption denv typarInst (v:Val) short = |
There was a problem hiding this comment.
Since this is a private function I think it's fine to leave the name as-is and just have the additional flag. Perhaps rename the flag to shortMemberDisplay?
There was a problem hiding this comment.
Ok will do. Thanks :)
KevinRansom
left a comment
There was a problem hiding this comment.
I only re-discovered this last night, I am soooo sorry it dropped off my radar.
Thanks for doing this
Kevin
|
@KevinRansom thank you very much for merging 👍 I guess meanwhile the UI related stuff could be replaced with the official code lens API. That should at least prevent any position issues and scrolling. However right now that is super off my limits. |
* Short type annotation. * fix caching to avoid any duplicates. Signed-off-by: realvictorprm <mueller.vpr@gmail.com> * Fixing layout bug. Signed-off-by: realvictorprm <mueller.vpr@gmail.com> * Wrapping all warning logging messages with #if Debug Signed-off-by: realvictorprm <mueller.vpr@gmail.com> * Removed code duplication / applied review. Signed-off-by: realvictorprm <mueller.vpr@gmail.com> * fixing build Signed-off-by: realvictorprm <mueller.vpr@gmail.com> * Update NicePrint.fs correcting wrong parameter for layoutOfPrettyMember * fixing build * Applying review. Signed-off-by: realvictorprm <mueller.vpr@gmail.com> * Applied review. Signed-off-by: realvictorprm <mueller.vpr@gmail.com> * Fix merge * Fix fsharpcodelensservice.fs * Syntax fix for release mode Co-authored-by: Phillip Carter <pcarter@fastmail.com>
* Short type annotation. * fix caching to avoid any duplicates. Signed-off-by: realvictorprm <mueller.vpr@gmail.com> * Fixing layout bug. Signed-off-by: realvictorprm <mueller.vpr@gmail.com> * Wrapping all warning logging messages with #if Debug Signed-off-by: realvictorprm <mueller.vpr@gmail.com> * Removed code duplication / applied review. Signed-off-by: realvictorprm <mueller.vpr@gmail.com> * fixing build Signed-off-by: realvictorprm <mueller.vpr@gmail.com> * Update NicePrint.fs correcting wrong parameter for layoutOfPrettyMember * fixing build * Applying review. Signed-off-by: realvictorprm <mueller.vpr@gmail.com> * Applied review. Signed-off-by: realvictorprm <mueller.vpr@gmail.com> * Fix merge * Fix fsharpcodelensservice.fs * Syntax fix for release mode Co-authored-by: Phillip Carter <pcarter@fastmail.com>
* Short type annotation. * fix caching to avoid any duplicates. Signed-off-by: realvictorprm <mueller.vpr@gmail.com> * Fixing layout bug. Signed-off-by: realvictorprm <mueller.vpr@gmail.com> * Wrapping all warning logging messages with #if Debug Signed-off-by: realvictorprm <mueller.vpr@gmail.com> * Removed code duplication / applied review. Signed-off-by: realvictorprm <mueller.vpr@gmail.com> * fixing build Signed-off-by: realvictorprm <mueller.vpr@gmail.com> * Update NicePrint.fs correcting wrong parameter for layoutOfPrettyMember * fixing build * Applying review. Signed-off-by: realvictorprm <mueller.vpr@gmail.com> * Applied review. Signed-off-by: realvictorprm <mueller.vpr@gmail.com> * Fix merge * Fix fsharpcodelensservice.fs * Syntax fix for release mode Co-authored-by: Phillip Carter <pcarter@fastmail.com>
This shorts the type annotation so that prior e.g.
overrideormemberornewisn't shown anymore for member functions.