-
Notifications
You must be signed in to change notification settings - Fork 790
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
Use doccoms from signature and implementation files for quickinfo tooltips #2662
Conversation
Awesome. What about showing a warning of some sort if documentation in sig and implementation files differ (and a quick fix to synchronize them in either way ;) ? |
The doccoms in the implementation files are more like "design time" notes, things you want to show up in other implementer's tooltips but prefer not to expose publicly like the doccoms in the signature file. I don't think synchronization adds anything useful as the doccoms from the signature will always show in the tooltips. If anything you'd want to delete the doccoms in the implementation file. Making them the same would just duplicate the content. |
|
||
type Async with | ||
/// Better implementation of Async.AwaitTask that correctly passes the exception of a failed task to the async mechanism | ||
static member AwaitTaskCorrect (task:Task) : unit Async = |
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.
Async<unit>
please.
|> ignore) | ||
|
||
/// Better implementation of Async.AwaitTask that correctly passes the exception of a failed task to the async mechanism | ||
static member AwaitTaskCorrect (task:'T Task) : 'T Async = |
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.
Task<'T>
and Async<'T>
please
type Async with | ||
/// Better implementation of Async.AwaitTask that correctly passes the exception of a failed task to the async mechanism | ||
static member AwaitTaskCorrect (task:Task) : unit Async = | ||
Async.FromContinuations (fun (successCont,exceptionCont,_cancelCont) -> |
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.
If this AwaitTask
is better, then we should start an RFC to provide a version of it in FSharp.Core please?
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.
@eiriktsarpalis wrote it
let tooltipInfoPair = asyncMaybe { | ||
match findSigDeclarationResult with | ||
| FSharpFindDeclResult.DeclNotFound _failReason -> | ||
return (None , Some backupTooltipInfo) |
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.
No space before comma please
let! findImplDefinitionResult = | ||
checkFileResults.GetDeclarationLocationAlternate | ||
( idRange.StartLine, idRange.EndColumn, lineText | ||
, lexerSymbol.FullIsland, preferFlag=false) |> liftAsync |
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.
Put comma at end-of-line please, not start of line
|
||
/// Load times used to reset type checking properly on script/project load/unload. It just has to be unique for each project load/reload. | ||
/// Not yet sure if this works for scripts. | ||
let fakeDateTimeRepresentingTimeLoaded x = DateTime(abs (int64 (match x with null -> 0 | _ -> x.GetHashCode())) % 103231L) |
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.
Why is this added in this PR? It doesn't seem to be mentioned elsewhere in the PR?
@cloudRoutine An alternative is to fix this within the compiler itself, so that the specification of documentation generation for the language itself changes to combine documentation from signature and implementation. That is preferable in many ways because it solves the problem consistently across all F# tooling including Ionide and Fable. If implementation documentation is empty then it is uncontroversial to use signature documentation. However frequently documentation is duplicated in signature and implementation, which raises questions about what to do in that case. |
build error:
|
3c269d4
to
fe5ac92
Compare
@KevinRansom an issue I've run into with testing new features built around the Roslyn functionality is that there's no easy way to create a workspace to test it out with. Since the default workspace implementations reject all code that isn't C# or vb funtions/methods that rely on |
@dsyme maybe that can come later, but I'm trying to address a more immediate concern I've had while working on this repo in particular due to the extensive use of
this is a crude workaround due to inadequate tooling support and I think trying to account for it is going to end up in a lot of generated documentation suddenly becoming very messy. Trying to establish a good heuristic for when doccoms are similar enough to be duplicates seems like an invitation for kludges. |
Is there anything else I need to do for this? |
this might even encourage people to spend more time writing documentation in signature files since they'd actually get the benefit of it in their implementation files. the giant gross xml doccoms won't have to pollute their code. |
@cloudRoutine agreed |
@KevinRansom this'll be pretty useful when working on the parts of the compiler where there's extensive documentation in the signatures but barely any in the implementation files. So hopefully it can get merged soon. |
@KevinRansom all green and resolved here too |
integrated into #2683 |
The current way that documentation comments behave with quickinfo tooltips is rather odd and has been a pet peeve of mine for a long time.
When you add doccoms in the signature they don't show up in the corresponding implementation
If you open a different implementation file it uses the doccoms from the sig and overwrites any doccoms you may have added in the implementation file
Now it shows doccoms from the sig in its corresponding implementation file, and if you add additional doccoms in the implementation the tooltip will show both of them.
The doccoms from the implementation files are on the bottom because these are merely supplementary and will not be included in the xml documentation created for the project.