Skip to content

Commit 10028c4

Browse files
committed
initial goto impl for signature file
1 parent 506fdec commit 10028c4

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
@@ -514,11 +514,15 @@ module Commands =
514514
=
515515

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

523527
async {
524528
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
@@ -124,6 +124,9 @@ let inline isAScript (fileName: ReadOnlySpan<char>) =
124124
/// </summary>
125125
let inline isSignatureFile (fileName: ReadOnlySpan<char>) = fileName.EndsWith ".fsi"
126126

127+
let toSignatureFile fileName =
128+
IO.Path.ChangeExtension(fileName, ".fsi")
129+
127130
/// <summary>
128131
/// Checks if the file ends with `.fs`
129132
/// </summary>
@@ -132,6 +135,9 @@ let isFsharpFile (fileName: ReadOnlySpan<char>) = fileName.EndsWith ".fs"
132135
let inline internal isFileWithFSharpI fileName = isAScript fileName || isSignatureFile fileName || isFsharpFile fileName
133136

134137

138+
let toFSharpFile fileName =
139+
IO.Path.ChangeExtension(fileName, ".fs")
140+
135141
/// <summary>
136142
/// This is a combination of `isAScript`, `isSignatureFile`, and `isFsharpFile`
137143
/// </summary>

0 commit comments

Comments
 (0)