Fsharp: [Feature Enhancement] Quickinfo with Navigation links

Created on 21 Mar 2017  路  19Comments  路  Source: dotnet/fsharp

Feauture added in Clickable QuickInfo with "go to type"

I really love this feature and I think we can take it a lot further than its initial implementation

  • Allow navigation to modules

  • Allow navigation to function bindings

  • Allow navigation to operator definitions (type or module)

  • Allow navigation to discriminated union and enum cases

  • Allow navigation to type members/methods/properties

  • In signatures link to other signatures, not implementation files

  • In implementation files link to other implementation files

  • (Eventually) allow navigation to external symbols via metadata signature generation

Some additional comments documenting the functionality would also be useful, especially in Quickinfo Provider.fs, just from looking at the source it's unclear how the navigation functionality works and where one should look to see it's implementation. I'd already forgotten where it was by today and had to go digging back into the PR to find it.

cc @majocha , @cartermp, @smoothdeveloper

Area-IDE Language Service Feature Specification

Most helpful comment

Improved link tip with fully qualified name, also for unreachable types:
fullname

All 19 comments

Thank you, @cloudRoutine. I have a small improvement to add so I'll write missing comments with it and also make it a bit less scattered.

The interesting stuff of the implementation is deep inside, true :) Searching all references to NavigableTaggedText helps here.

It builds on @vladima's titanic commit ed948aba. The idea is to piggyback some more info on top of the classified text in Layout that in the end is being used in quick info. I tried to identify places where types are laid out and pass navigational data there.
With this approach making more entities browsable is possible as long as the required data is available at the point the layout is created. I'll try to work on this.

Another thing that worth considering is using PreferProvisionalTab option. Currently it is buggy, causing occasional duplicate tabs :(

Navigating to .fs instead of .fsi looks hard. Currently EntityRef.DefinitionRange is used and it seems it always points to .fsi definition for referenced projects.

Improved link tip with fully qualified name, also for unreachable types:
fullname

Couldn't you move quickinfo down in the compilation order, move the tooltip generation to a class method, construct the class with an MEF import on the gotodefinition class and then use that to handle the navigation? (this way it'll automatically piggypack on top of improvements to gotodefinition)

We use PreferProvisionalTab in FSharpGoToDefinitionService and it works OK I think.

@majocha that small tooltip-for-tooltip should be colorized as well ;)

...and has links to navigate to, say, intermediate module... ;)

@vasily-kirichenko colorized and browsable, yes :)
I'm not sure what's going on with the ProvisionalTab. Should work.

@cloudRoutine I can try, but in the and GotoDefinition service also just calls TryNavigateToSpan.

@cloudRoutine Now I see that would be the correct approach. GoToDefinitionService sometimes blocks for quite some time, but that should not happen in our case. At the moment quick info shows up, the document is parsed and checked already.

Hey, right click / find all references could be useful too!

:)

@majocha I've addressed the speed issue in my generate metadata PR, so eventually that won't be a big deal

More entities allow navigation now. In the end there is no obstacle to make everything navigable, function
but it doesn't always look nice:
more

GoToDefinitionService is used now but there is some repetition here I'm not happy with. Basically we give it the position we want to go to, because we already have it. The service makes an unnecessary roundtrip to look up the symbol and then navigates.
https://github.com/Microsoft/visualfsharp/compare/master...majocha:navigable-improvements

@majocha I'll PR some of the gotodef speed improvements I made onto your branch and try to get rid of that roundtrip

@cloudRoutine I don't think we can get rid of it because it's what GoToDefinitionService do, it looks up a definition.

@majocha I totally got rid of it ;) https://github.com/majocha/visualfsharp/pull/1

Awesome! One minute because I was mucking around with it later and there's a conflict.

I think we can close it now?

@cartermp Close it?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

cartermp picture cartermp  路  3Comments

ctaggart picture ctaggart  路  3Comments

enricosada picture enricosada  路  3Comments

GennadyGS picture GennadyGS  路  3Comments

vasily-kirichenko picture vasily-kirichenko  路  3Comments