-
Notifications
You must be signed in to change notification settings - Fork 830
Allow passing additional symbol info in GetDeclarationListInfo #3909
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
Conversation
0fd1f51 to
0dcf2d5
Compare
KevinRansom
left a comment
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.
Nice.
Thank you
Kevin
src/fsharp/vs/service.fs
Outdated
| let getAdditionalInfo item = | ||
| try getAdditionalInfo(FSharpSymbol.Create(g, thisCcu, tcImports, item), displayContext) | ||
| with _ -> | ||
| Trace.TraceInformation(sprintf "FCS: could not get additional info for %A" item) |
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.
It might be useful for diagnostics to trace the exception here.
|
@auduchinok The use of generics like this is odd for FCS and I'd like to explore alternatives ways of getting the same result. e.g. why not just include the |
|
@dsyme I like this idea. Initially I've tried to make this an in-place replacement for |
:) You mean you like the PR as is, or with the suggestion above? Thx :) |
|
The suggestion. :) |
|
:) thx |
|
@dsyme Do you know if there was a particular reason FSharpDeclarationListInfo was written as a class? I'd like to rewrite it as a discriminated union (and keep the Create method there) as there are three situations (Empty, Error and (let's say) Info) that need completely different sets of fields. |
I think it just grew up that way. If you feel as a consumer that you would have have avoided an error or need to evolve the three cases separately then yes, please do send the PR That said I'm not totally sure it's worth churning the API at this point. There will be consumers in various tooling like FSharp.Formatting and Ionide. But send the PR and we can discuss (In general using unions and records in evolving APIs is not always encouraged. There's a tradeoff here - unions and records are great accurate programming devices since they cause rigidity - and thus force accuracy on consumers as types evolve. In contrast, classes cause less rigidity - since you can just add new properties - but likewise new information can creep in that the consumer ignores. ) |
|
@dsyme this looks ready to go to me. Are you satisfied? |
|
@KevinRansom I'd like to change it the way we discussed it before it goes in. |
dsyme
left a comment
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.
marking as changes requested as discussed
|
@auduchinok, do you think you will be able to get to the requested changes? Thanks Kevin |
|
@KevinRansom Yes, I was going to work on it next week. |
|
Yay ... a Christmas present then :-) |
@dsyme I think we can simplify APIs a lot in the way it was stated in this Vasily's comment. Looking at the comment reactions I suppose most extensive API users would be happy with such changes, so may we assume that people will be OK with adopting changed APIs then? Speaking of this PR I'd like to continue working on completion features on top of simplified APIs if the change is welcomed. |
|
@auduchinok VS for Mac doesn't use See fsharp/fsharp-compiler-docs#841 for the API change I wanted to make. I think it's important that the two APIs share the same features. |
|
@nosami Yeah, I've checked if there're real uses of |
|
@auduchinok: If the symbol was added to the completion info, then I think I would stop using |
|
+1 on changing the API names as you suggested @auduchinok |
|
+1 from me, on both API changed in the PR, and changing the names of the functions across the API. If we were looking into any breaking changes we could seriously review all the API and change it even more - for example, I'm not a big fan of passing idents to most functions, I kinda feel it could be hidden from the consumer (especially that we have now QuickParse module already in place) |
|
@Krzysztof-Cieslak I've already removed idents passing in public APIs (in a branch) and do it in implementations. |
|
Ping |
dsyme
left a comment
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.
@auduchinok I'm ok with these changes but they need to be merged with master
|
@auduchinok, the PR has approval, if you resolve the merge issues it can be merged. Thanks Kevin |
|
These look like good changes to have in the product. Please reactivate when you get some time to devote to this. Thank you Kevin |
We don't use Accessibility field in
FSharpDeclarationListItemand want to pass other symbol info instead.I added two optional parameters to
GetDeclarationListInfo:getAdditionalInfo: function to replacegetAccessibilitywhich takesFSharpSymbolandFSharpDisplayContextand allows passing arbitrary symbol info.shortTypeNames: use short type names in the display context