-
Notifications
You must be signed in to change notification settings - Fork 156
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
Some restrictions for Parameter Hints #935
Conversation
Add additional Test function to use positions marked in source
Prev: error when collecting expecto tests -> outside of tests Now: error when running corresponding test -> inside a test
Example: func: `validateRange`; param: `range`
Unlike `isNotWellKnownName`, not just by param name, but function (and its module/namespace) too. I removed params `mapping` & `format` from common well known names, and just hide them when used with a collection (`List.xxx`, `Array.xxx` functions) or one of the printf functions.
I haven't done a full review, but I did start porting the 3.17 types over at my fork of the LSP repo. That needs to be rebased now. I did this in part to get the InlayHint structures :D I don't see a reason not to start + implement both here in prep for the 3.17 release, though :) I agree about the need for the textEdit[] for sure! Then once VSCode supports 3.17 we can remove the fsharp/inlayHints endpoint entirely. |
Note: moved out of function: no attributes on local function/value allowed
Thank you! This is again excellent work :) I'll re-release FSAC and include this in the new Ionide release today. |
(mostly inspired by rust-analyzer)
Parameter Hints are now additional hidden when:
prev: only same or arg starts with param
now: a bit more elaborated:
(foo |> bar)
orfoo.ToString()
)(foo)
->foo
)foo.bar.baz
->baz
)config.baz.value
->baz
in center_
from param for comparison'
from argument for comparisonfoo
is prefix offooBar
but notfoobar
)range = Range = RANGE
s
too?exactRangeOfExpr
param=range
-> might be nice to not show hintf abstractSyntaxTree
-> paramast
-> no param hint?But: far to many possibilities when looking for something similar -> here now just some and not too hard to detect
wellKnownNames
(which just checks param name), I'll look at the function (and its module) too:-> only hide certain parameter names in certain functions:
option
&voption
inOption.xxx
andValueOption.xxx
functionsformat
in printf functionswellKnownNames
: I think that's quite often a very valuable info -- just not for the commonly used printf-functionsmapping
in Collection functions (List.xxx
,Array.xxx
, ...)About "excludes expressions":
Might actually be worth recognizing some expressions (like param name is
foo
, arg:bar.Foo()
,bar |> toFoo
, ...) -- but there are so many possibilities -> I just completely ignore anything not-identifier.Note: There are quite a few
TODO
s in tests for cases I'm not sure the current way is best. Any opinions?Next:
I think we should move to Inlay Hints from LSP (coming in
3.17.0
). Besides being an official LSP feature instead of custom one, this provides some additional things:TextEdit[]
instead ofNewText: string option
(inserted atPos
): A single insert at one position might not be enough to insert a type hint (might need parens)Tooltip
: Displaying a parameter's type and/or its XML Doc would be niceIf OK, I would add LSP types and corresponding request to FSAC
ionide/LanguageServerProtocol
: Inlay Hints still in preview -> easier to manage everything directly here instead of syncing with other repo (-> move once it's released)fsharp/inlayHints
stays (currently used in Ionide) (-> version oftextDocument/inlayHint
with simpler return data)