You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
'IntelliSense on Functions' tooltip does not appear when in parentheses related to other construct #10941
changed the title [-]'IntelliSense on Functions' tooltip does not appear in certain contexts[/-][+]'IntelliSense on Functions' tooltip does not appear when in parentheses related to other construct[/+]on Jan 25, 2021
Just to add a screenshot, this is what's going on:
This is because TryRangeOfFunctionOrMethodBeingApplied has a bug where it picks List.map rather than sum.
Additionally, TryIdentOfPipelineContainingPosAndNumArgsApplied is making an assumption causing the number of reported curried arguments to be incorrect.
Thanks for the report. The issue as-reported is fixed here: #10954
We're nearing a code freeze for VS 16.9 so I'll see if I can cherry pick the fix into the release. If not, then this would be in the 16.10 previews.
There are a few other quirks tracked in #10957 - if you notice additional issues, please file new ones or comment on that thread. I can move things around/create issues as needed.
Hmm, I'm actually going to re-open this because the "old" tooltip will still trigger for me. I noticed this happening again and it's less common, but still triggers. It's actually due to something else. Consider the following:
typeC()=member_.M(x)=()letc= C()
c.M(sqrt)// <<- caret is after 't'!
When you hit the space key, signature help for M is given instead of for sqrt. What's happening is that the syntax tree APIs are working from the outside in and noticing that M(... is considered valid for a tooltip and then shows that. We really need to dive further in and only show the most relevant one
Hmm, I'm actually going to re-open this because the "old" tooltip will still trigger for me.
Here's another scenario: the tooltip doesn't show -- it appears to be related to the generic argument being present:
/// Tries to cast an object to a given type; throws with the given error message if it fails.
let tryConvert<'T> (descriptor: string) (value: obj) : 'T =
try
Convert.ChangeType(value, typeof<'T>) :?> 'T
with ex ->
let msg = sprintf "Unable to convert '%s' with value %A" descriptor value
raise (new Exception(msg, ex))
// Tooltip does NOT show when the generic argument is present:
let result= (box 123) |> tryConvert<string> "numbers"
// Tooltip does show properly here:
let result : string = (box 123) |> tryConvert "numbers"
I have another one for you: tooltip doesn't appear for composed functions.
let prependStar (txt: string) = "*" + txt
let appendStar (txt: string) = txt + "*"
let addStars = prependStar >> appendStar
// Good
let result1 = prependStar "ABC"
// Good
let result2 = appendStar "ABC"
// Bad - No Intellisense tooltip
let result3 = addStars "ABC"
The last case is unfortunately not inherent to the language feature. The problem is that addStars is a function value and the information about that is lossy. The compiler doesn't assign parameters to it since it's a function value.
One possible approach here is to remove the check for parameters and artificially construct one. I'll play around with that and see if it's the appropriate tweak.
Yeah, that's not going to be reasonable to do compared with the other cases. I'll file an issue for this but it'll probably just be low priority since it's not a common occurrence + much more difficult to pull off.
Another one that I noticed that's maybe not worth messing with, but I might as well mention it now:
it doesn't show the tooltip if there is a character directly after the cursor, like an end paren.
let doStuff (txt: string) = printfn txt
let doStuffLazy = lazy (doStuff ) // <-- hitting space here while the cursor is touching the end paren prevents tooltip
The workaround is pretty easy though -- just make sure to add a space before the closing paren.
Activity
cartermp commentedon Jan 25, 2021
Computation expressions is covered here: #10835
Should be in the 16.9 full release, unsure about a specific preview
Within parens in a lambda is an interesting issue that I anticipated would arise but wasn't sure of the impact. Should be fun to take a look
[-]'IntelliSense on Functions' tooltip does not appear in certain contexts[/-][+]'IntelliSense on Functions' tooltip does not appear when in parentheses related to other construct[/+]cartermp commentedon Jan 26, 2021
Just to add a screenshot, this is what's going on:
This is because
TryRangeOfFunctionOrMethodBeingAppliedhas a bug where it picksList.maprather thansum.Additionally,
TryIdentOfPipelineContainingPosAndNumArgsAppliedis making an assumption causing the number of reported curried arguments to be incorrect.cartermp commentedon Jan 27, 2021
Marking this here for now, a quirk I noticed when editing code int he compiler. I can't say if it's related yet:
cartermp commentedon Jan 27, 2021
Using #10957 to track the issue I noticed and another.
cartermp commentedon Jan 27, 2021
Thanks for the report. The issue as-reported is fixed here: #10954
We're nearing a code freeze for VS 16.9 so I'll see if I can cherry pick the fix into the release. If not, then this would be in the 16.10 previews.
There are a few other quirks tracked in #10957 - if you notice additional issues, please file new ones or comment on that thread. I can move things around/create issues as needed.
cartermp commentedon Mar 10, 2021
Hmm, I'm actually going to re-open this because the "old" tooltip will still trigger for me. I noticed this happening again and it's less common, but still triggers. It's actually due to something else. Consider the following:
When you hit the space key, signature help for
Mis given instead of forsqrt. What's happening is that the syntax tree APIs are working from the outside in and noticing thatM(...is considered valid for a tooltip and then shows that. We really need to dive further in and only show the most relevant oneJordanMarr commentedon Mar 10, 2021
Here's another scenario: the tooltip doesn't show -- it appears to be related to the generic argument being present:
Edit: This is using VS 16.9.0
JordanMarr commentedon Mar 10, 2021
I have another one for you: tooltip doesn't appear for composed functions.
cartermp commentedon Mar 10, 2021
The last case is unfortunately not inherent to the language feature. The problem is that
addStarsis a function value and the information about that is lossy. The compiler doesn't assign parameters to it since it's a function value.One possible approach here is to remove the check for parameters and artificially construct one. I'll play around with that and see if it's the appropriate tweak.
cartermp commentedon Mar 10, 2021
Yeah, that's not going to be reasonable to do compared with the other cases. I'll file an issue for this but it'll probably just be low priority since it's not a common occurrence + much more difficult to pull off.
JordanMarr commentedon Mar 10, 2021
Another one that I noticed that's maybe not worth messing with, but I might as well mention it now:
it doesn't show the tooltip if there is a character directly after the cursor, like an end paren.
The workaround is pretty easy though -- just make sure to add a space before the closing paren.
cartermp commentedon Mar 10, 2021
This is also fixed in #11200:
JordanMarr commentedon Mar 10, 2021
Yessss!
cartermp commentedon Mar 10, 2021
Closing out again since #11200 is merged