zzarchive-VisualFSharpPowerTools icon indicating copy to clipboard operation
zzarchive-VisualFSharpPowerTools copied to clipboard

[Go to definition] Should work on signature files nicely

Open vasily-kirichenko opened this issue 8 years ago • 8 comments

  • F12 should always jump to implementation (currently it jumps to function implementation and to type signature (fsi))
  • If we are in FSI file, than F12 should not jump to any FS file if corresponding FSI file presents (in other words, if we are in "signature kingdom", don't leave it if possible)
  • F12 on a definition should switch between FS and FSI files circularly

vasily-kirichenko avatar Mar 22 '16 18:03 vasily-kirichenko

I think it's easy to implement because FCS seems to return all symbol uses and FSharpSymbolUse.IsFromDeclaration is properly set to true for declaration in both fsi and fs files:

image

vasily-kirichenko avatar Mar 22 '16 20:03 vasily-kirichenko

F12 should always jump to implementation (currently it jumps to function implementation and to type signature (fsi))

Could you elaborate on this?

  1. If we are in FSI file, than F12 should not jump to any FS file if corresponding FSI file presents (in other words, if we are in "signature kingdom", don't leave it if possible)
  2. F12 on a definition should switch between FS and FSI files circularly

Don't the two requirement conflict with each other? Do you have an example to illustrate them?

dungpa avatar Mar 23 '16 06:03 dungpa

You are right :)

OK, what about this:

  • If we are in an FSI file, we always jump to FSI file (if available)
  • If we are in an FS file, we always jump to FS file
  • If we are on a definition, then we jump FSI <-> FS recursively

vasily-kirichenko avatar Mar 23 '16 06:03 vasily-kirichenko

Sounds reasonable.

Implementing this means overriding Visual F# tool's F12 completely. Are you fine with that? An alternative is to have a new command (e.g. Alt Shift F12) to switch between declarations on implementation and signature files.

dungpa avatar Mar 23 '16 07:03 dungpa

I think "F12 for everything" approach is more straightforward and easier to use.

vasily-kirichenko avatar Mar 23 '16 07:03 vasily-kirichenko

OK, I found a bug in FCS, so cannot proceed with the feature until it's fixed.

vasily-kirichenko avatar Mar 23 '16 10:03 vasily-kirichenko

You're right. I made an attempt here https://github.com/dungpa/PowerTools/tree/f12, but it obviously doesn't work since ImplementationLocation and SignatureLocation often point the same location.

dungpa avatar Mar 23 '16 11:03 dungpa

@dungpa I've made similar changes here https://github.com/fsprojects/VisualFSharpPowerTools/pull/1352 :)

vasily-kirichenko avatar Mar 23 '16 11:03 vasily-kirichenko