-
Notifications
You must be signed in to change notification settings - Fork 123
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
GetToolTipText gets the same XML signature for several member overloads #800
Comments
But are these the same as the case? I am talking about a problem in my app using FCS. It is reduced to the code provided. This code is not working as expected. |
Look at VFT or Ionide source code to see if you use the api properly. |
For Ionide, it's around here https://github.com/ionide/FsAutoComplete/blob/master/src/FsAutoComplete.Core/Commands.fs#L210 You can build FSAC in debug mode, put it into the Ionide plugin folder, open your scrips in Code, attach to the FSAC Suave process and debug. /cc @k_cieslak |
Ahhhhhhhhhhhhhh. Sorry, I didn't notice that the problem is not in the XML doc comment (which is entirely missing, BTW), but in the 'M:System.IO.File.WriteAllText(System.String,System.String)' part. |
The above screenshots are taken on this line https://github.com/Microsoft/visualfsharp/blob/master/vsintegration/src/FSharp.Editor/QuickInfo/QuickInfoProvider.fs#L111 |
I am on holiday now, will check in a week or two. If my code is wrong, could you suggest what wrong is? |
I am back. Thank you for the links. They are useful, especially the second with But I am still interested in the original case working correctly. It gets all If I use the API correctly (I used some testing code from FCS for inspiration) Thus, the issue still looks valid. (Meanwhile, I'll play with the new alternative |
I played with both suggestions. (1) FSAC - The suggested code calls
though the sample code still gets info for two existing overloads, one with (2) The suggested code uses a different function All in all, the only known somehow documented way is here. |
The original example uses #r @"..\packages\FSharp.Compiler.Service\lib\net45\FSharp.Compiler.Service.dll"
open System
open Microsoft.FSharp.Compiler.SourceCodeServices
let checker = FSharpChecker.Create()
let input = """
open System.IO
File.WriteAllText ("", "")
"""
let inputLines = input.Split('\n')
let file = "/Test.fsx"
let projOptions, errors = checker.GetProjectOptionsFromScript(file, input) |> Async.RunSynchronously
let parseResults, checkAnswer = checker.ParseAndCheckFileInProject(file, 0, input, projOptions) |> Async.RunSynchronously
let checkFileResults =
match checkAnswer with
| FSharpCheckFileAnswer.Succeeded(res) -> res
| res -> failwithf "Parsing did not finish... (%A)" res
let (FSharpToolTipText tips) =
checkFileResults.GetToolTipText(3, 18, inputLines.[2], ["File"; "WriteAllText"], FSharpTokenTag.Identifier) |> Async.RunSynchronously
tips
|> List.iter (function
| FSharpToolTipElement.Group items ->
for item in items do
printfn "MainDescription: %s" item.MainDescription
printfn "XmlDoc: %A" item.XmlDoc
| _ -> ()
) |
Is there any chance this issue is addressed in some "reasonable" future? |
Just to verify, but have you tested with the latest release of FSharp.Compiler.Service? Version 26.0.1 was released recently and contains many fixes from upstream, which may have incidentally fixed this issue. |
Yes, I did. I use FSharp.Compiler.Service a lot, stay updated, and check this issue with every update :( |
I've just run your script, the output is: MainDescription: File.WriteAllText(path: string, contents: string) : unit
XmlDoc: XmlDocFileSignature
("/Library/Frameworks/Mono.framework/Versions/5.10.1/lib/mono/4.5/mscorlib.dll",
"M:System.IO.File.WriteAllText(System.String,System.String)")
MainDescription: File.WriteAllText(path: string, contents: string, encoding: System.Text.Encoding) : unit
XmlDoc: XmlDocFileSignature
("/Library/Frameworks/Mono.framework/Versions/5.10.1/lib/mono/4.5/mscorlib.dll",
"M:System.IO.File.WriteAllText(System.String,System.String)") Is it still wrong? |
Yes, it is wrong. The XML signature P.S. I would live with this bug "fine". But I am working on FSharpFar and rather worry about its users. |
I see. I think the problem is at https://github.com/Microsoft/visualfsharp/blob/54c22cdea6e069db28d8dd16723e402e364aab44/src/fsharp/symbols/SymbolHelpers.fs#L622 where the first overload is always got ( |
Maybe the problem is upstream because |
The issue is definitely upstream, and it's around where @vasily-kirichenko pointed out. The tooltip resolution of a member in a method group(ie a member with overloads) needs to take into account which specific overload (the |
I created the issue. Thank you All for your attention and some good progress. |
The bug was fixed in visualfsharp. |
All works fine in FCS 28.0, closing. |
Repro steps
UPDATE: see the adjusted to the newer API in FSCS (still with the bug) is here:
#800 (comment)
Expected behavior
For two overloads of
WriteAllText
,GetToolTipText
gets two items with differentMainDescription
and different XML doc signatures.Actual behavior
GetToolTipText
gets two items with differentMainDescription
(expected) and the same XML doc signatures (unexpected).See the output below, the second XML doc signature is expected to be different, with
System.Text.Encoding
.Output:
MainDescription
correctly provides different signatures of two overloads.But
XmlDoc.Item2
provides the same XML doc signature for both entries.Related information
The text was updated successfully, but these errors were encountered: