Repository navigation
Some restrictions for Parameter Hints - #935
Merged
Merged
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.
Contributor
|
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. |
baronfel
reviewed
Apr 30, 2022
baronfel
reviewed
Apr 30, 2022
Note: moved out of function: no attributes on local function/value allowed
Contributor
|
Thank you! This is again excellent work :) I'll re-release FSAC and include this in the new Ionide release today. |
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
(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->bazin center_from param for comparison'from argument for comparisonfoois prefix offooBarbut notfoobar)range = Range = RANGEstoo?exactRangeOfExprparam=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&voptioninOption.xxxandValueOption.xxxfunctionsformatin printf functionswellKnownNames: I think that's quite often a very valuable info -- just not for the commonly used printf-functionsmappingin 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
TODOs 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/inlayHintsstays (currently used in Ionide) (-> version oftextDocument/inlayHintwith simpler return data)