-
Notifications
You must be signed in to change notification settings - Fork 789
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
Add symbol creation for an operator with a constraint #6307
Conversation
This addresses a situaltion where if you request a tooltip for an operator with a constraint no symbol is returned due to: Item.ImplicitOp(_, { contents = Some(TraitConstraintSln.FSMethSln(_, vref, _)) }) Being turned into a vanilla FSharpSymbol which has no real information about the symbol that the IDE can use. An corresponding issue was logged for ionide here: ionide/ionide-vscode-fsharp#1025 Corresponding PR at FCS: fsharp/fsharp-compiler-docs#896
As for recreating a tiny-tot issue for this, I did try but it was really difficult to replicate the issue, as described here: ionide/ionide-vscode-fsharp#1025 To replicate the issue hover the And a |
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.
Thanks @7sharp9 - could you add a quick test, perhaps here? https://github.com/Microsoft/visualfsharp/blob/master/tests/service/Symbols.fs
@7sharp9 thanks for this Kevin |
@@ -290,6 +290,9 @@ type FSharpSymbol(cenv: SymbolEnv, item: (unit -> Item), access: (FSharpSymbol - | |||
| Item.ArgName(id, ty, _) -> | |||
FSharpParameter(cenv, ty, {Attribs=[]; Name=Some id}, Some id.idRange, isParamArrayArg=false, isInArg=false, isOutArg=false, isOptionalArg=false) :> _ | |||
|
|||
| Item.ImplicitOp(_, { contents = Some(TraitConstraintSln.FSMethSln(_, vref, _)) }) -> |
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.
This is a good fix, though we should also cover the case where the solution is a .NET Method or an F# record field (the other possibliies for TestConstraintSln)
@7sharp9 Would you be able to submit a new PR for those cases?
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.
@dsyme , yeah I can add the others too.
Testing these is really tough though as Ive only been able to replicate the issue within Falanx referencing a Fleece operator, which references FSharpPlus operator. i.e.No simple minimal repo. There may be other symbols that we could surface too...
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.
Incidentally @dsyme Do you know why ItemWithInst.TyparInst
is always empty for custom operators?
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.
Custom operators (in computation expressions) or implicit operators?
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.
Implicit operators, they seem to match always get created with ItemWithNoInst
This addresses a situaltion where if you request a tooltip for an operator with a constraint no symbol is returned due to:
Item.ImplicitOp(, { contents = Some(TraitConstraintSln.FSMethSln(, vref, _)) })
Being turned into a vanilla FSharpSymbol which has no real information about the symbol that the IDE can use.
An corresponding issue was logged for ionide here: ionide/ionide-vscode-fsharp#1025
Corresponding PR at FCS: fsharp/fsharp-compiler-docs#896