Go to C# symbols - #3357
Conversation
|
Oh wow. A while back I promised a bounty (ok, a beer, a book, whatever) to whoever did this :) But do you get it or @saul!? :) |
|
this is seriously nice, but the other direction is even more important since many projects want to write domain logic in F# and UI in C#. AFAIK this would require mapping the F# TAST to roslyn TAST. Is this something the F# team or the roslyn team is working on? |
I don't think I've seen anyone on any team prototype this |
|
sad since this was one of the promised things when the roslyn topic came up in VF# ;-) "we could benefit from the infrastructure and the roslyn team would help ..." ;-) Anyway nice to see one direction is at least possible! Kudos! |
|
I don't think this is much different to what I committed months ago - you can see by the number of 'todos' this isn't nearly complete! Thanks to @vasily-kirichenko for bringing it up to date |
|
It's actually not too difficult to implement it "the other way" without us having to move everything over to the Roslyn symbol API. There's a legacy interface that is used as a fallback if Roslyn can't find a symbol - I can't find the exact name but it should be simple for us to implement. |
|
@saul any chance you remember that interface name? |
|
@Pilchie can you help? |
|
I can't - it was @CyrusNajmabadi who told me. |
|
@vasily-kirichenko I've found Cyrus's comment detailing how to go the other way: dotnet/roslyn#16511 (comment) |
|
@saul I added a @CyrusNajmabadi any ideas? I've failed to find an example of how to expose this interface anywhere. |
|
Ah, looks like Roslyn query |
|
I tried to implement it in our |
|
Google is your friend :) You have to register it: https://msdn.microsoft.com/en-us/library/microsoft.visualstudio.shell.interop.vssymbolicnavigationmanagerclass.registersymbolicnavigationnotify.aspx |
|
|
|
According to docs.microsoft.com, "This interface is available via QueryService(Type, Object)." It looks like there's a difference between |
|
@saul I've tried |
|
Looks like the manager isn't used in Roslyn - it's pulled off the IVsHierarchy of the open document? Or something similar: |
|
However, according to Roslyn sources, it does not use the manager, it gets Project from Document: then tries to cast it to |
|
:) Yes. See my comment #3357 (comment) I implemented |
|
To whoever reviews this (@dsyme/@KevinRansom), it's worth pointing out that I want to add a test suite to this. I want to use the code that I've been demoing in the gifs, as it's a complete real-world use of this functionality. How best can I integrate it into our test suite? |
|
Go to props works great 👍 |
|
Awesome!
Am 20.08.2017 9:13 PM schrieb "Vasily Kirichenko" <notifications@github.com
…:
Go to props works great 👍
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#3357 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AYPM8Hs64hn-77rFScEWBc7fRVRnIIVHks5saIVGgaJpZM4OfFig>
.
|
Add ExternalSymbol to FSharp.Compiler.Service.fsproj
|
@dotnet-bot test Release_ci_part3 please |
|
@dotnet-bot test this please |
Fix FSharp.Compiler.Private.BuildFromSource.fsproj
| | Array of inner: ExternalType | ||
| | Pointer of inner: ExternalType | ||
| | TypeVar of typeName: string | ||
| with |
| None | ||
|
|
||
| [<RequireQualifiedAccess>] | ||
| type ExternalType = |
There was a problem hiding this comment.
Add a /// comment please, also to each union case
| type ParamTypeSymbol = | ||
| | Param of ExternalType | ||
| | Byref of ExternalType | ||
| with |
| | Field of typeName: string * name: string | ||
| | Event of typeName: string * name: string | ||
| | Property of typeName: string * name: string | ||
| with |
| | Array of inner: ExternalType | ||
| | Pointer of inner: ExternalType | ||
| | TypeVar of typeName: string | ||
| with |
|
|
||
| let fail defaultReason = | ||
| match item with | ||
| | Item.CtorGroup (_, (ILMeth (_,ilinfo,_)) :: _) -> |
There was a problem hiding this comment.
Typically, we should use property accessors on ILMeth rather than pattern matching on its contents. It's not curcial though - we can clean up the code later
| let task = tcs.Task | ||
| let disposeReg() = barrier.Stop(); if not task.IsCanceled then reg.Dispose() | ||
| Async.StartWithContinuations( | ||
| async { do! Async.SwitchToThreadPool() |
There was a problem hiding this comment.
Is this a cosmetic whitespace change?
|
@dsyme Do you have a recommended place where unit tests could go here? It feels like a good opportunity to create a new test project specifically for the language service, rather than adding on to the older tests which happen to test the language service alongside other changes. |
|
@dsyme done. |
I believe adding tests to Alternatively |
|
:) |
|
Nice
Am 21.08.2017 7:32 PM schrieb "Vasily Kirichenko" <notifications@github.com
…:
:)
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#3357 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AYPM8GoxGcoUIkV34gDSZXkkS6SoJCzXks5sab86gaJpZM4OfFig>
.
|
| | :? OperationCanceledException -> | ||
| tcs.TrySetCanceled(cancellationToken) |> ignore | ||
| | exn -> | ||
| System.Diagnostics.Trace.WriteLine("Visual F# Tools: exception swallowed and not passed to Roslyn: {0}", exn.Message) |
There was a problem hiding this comment.
Nooooo 😱 This wasn't a whitespace change - the old code (that you've reverted to) didn't assert on failure, and Trace.WriteLine doesn't take a format string! This bit me for a while. I'll open another PR fixing this.
There was a problem hiding this comment.
Oh, sorry, man :(
* go to C# symbols * fix tests * cleanup * fix tests * support field, events and constructors * fix tests * implement IVsSymbolicNavigationNotify * cleanup * fix * cleanup * Improve package definition specs fro F# VS Package * Fixed some bugs with nested types with fields/events * fix compilation * use AppTy AP * Add support for overloaded methods, generic methods, generic (nested) classes, constructors * Jump to property definition instead of getter/setter * Add ExternalSymbol to FSharp.Compiler.Service.fsproj * Fix FSharp.Compiler.Private.BuildFromSource.fsproj * address code review

This is saul@dad4934
@majocha any ideas how to make the tooltip links work as well for C# symbols?