Skip to content

Commit ea9a1db

Browse files
committed
initial goto impl for signature file
1 parent 732ccc8 commit ea9a1db

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

src/FsAutoComplete.Core/Commands.fs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -515,11 +515,15 @@ module Commands =
515515
=
516516

517517
let filterSymbols symbols =
518-
symbols
519-
|> Array.where (fun (su: FSharpSymbolUse) ->
520-
su.IsFromDispatchSlotImplementation
521-
|| (su.IsFromType
522-
&& not (tyRes.GetParseResults.IsTypeAnnotationGivenAtPosition(su.Range.Start))))
518+
if Utils.isSignatureFile (UMX.untag tyRes.FileName) then
519+
let implFile = Utils.toFSharpFile (UMX.untag tyRes.FileName)
520+
symbols |> Array.filter (fun (su: FSharpSymbolUse) -> su.FileName = implFile)
521+
else
522+
symbols
523+
|> Array.where (fun (su: FSharpSymbolUse) ->
524+
su.IsFromDispatchSlotImplementation
525+
|| (su.IsFromType
526+
&& not (tyRes.GetParseResults.IsTypeAnnotationGivenAtPosition(su.Range.Start))))
523527

524528
async {
525529
match tyRes.TryGetSymbolUseAndUsages pos lineStr with

src/FsAutoComplete.Core/Utils.fs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,11 +119,17 @@ let isAScript (fileName: string) =
119119
/// </summary>
120120
let isSignatureFile (fileName: string) = fileName.EndsWith ".fsi"
121121

122+
let toSignatureFile fileName =
123+
IO.Path.ChangeExtension(fileName, ".fsi")
124+
122125
/// <summary>
123126
/// Checks if the file ends with `.fs`
124127
/// </summary>
125128
let isFsharpFile (fileName: string) = fileName.EndsWith ".fs"
126129

130+
let toFSharpFile fileName =
131+
IO.Path.ChangeExtension(fileName, ".fs")
132+
127133
/// <summary>
128134
/// This is a combination of `isAScript`, `isSignatureFile`, and `isFsharpFile`
129135
/// </summary>

0 commit comments

Comments
 (0)