Skip to content

Commit cf01557

Browse files
committed
initial goto impl for signature file
1 parent 77778e4 commit cf01557

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

src/FsAutoComplete.Core/Commands.fs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -516,11 +516,16 @@ module Commands =
516516
=
517517

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

525530
async {
526531
match tyRes.TryGetSymbolUseAndUsages pos lineStr with

src/FsAutoComplete.Core/Utils.fs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,12 +120,15 @@ let isAScript (fileName: string) =
120120
/// Checks if the file ends with `.fsi`
121121
/// </summary>
122122
let isSignatureFile (fileName: string) = fileName.EndsWith ".fsi"
123+
let toSignatureFile fileName = IO.Path.ChangeExtension(fileName, ".fsi")
123124

124125
/// <summary>
125126
/// Checks if the file ends with `.fs`
126127
/// </summary>
127128
let isFsharpFile (fileName: string) = fileName.EndsWith ".fs"
128129

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

0 commit comments

Comments
 (0)