Skip to content

Commit

Permalink
initial goto impl for signature file
Browse files Browse the repository at this point in the history
  • Loading branch information
TheAngryByrd committed Jul 9, 2023
1 parent 732ccc8 commit ea9a1db
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/FsAutoComplete.Core/Commands.fs
Original file line number Diff line number Diff line change
Expand Up @@ -515,11 +515,15 @@ module Commands =
=

let filterSymbols symbols =
symbols
|> Array.where (fun (su: FSharpSymbolUse) ->
su.IsFromDispatchSlotImplementation
|| (su.IsFromType
&& not (tyRes.GetParseResults.IsTypeAnnotationGivenAtPosition(su.Range.Start))))
if Utils.isSignatureFile (UMX.untag tyRes.FileName) then
let implFile = Utils.toFSharpFile (UMX.untag tyRes.FileName)
symbols |> Array.filter (fun (su: FSharpSymbolUse) -> su.FileName = implFile)
else
symbols
|> Array.where (fun (su: FSharpSymbolUse) ->
su.IsFromDispatchSlotImplementation
|| (su.IsFromType
&& not (tyRes.GetParseResults.IsTypeAnnotationGivenAtPosition(su.Range.Start))))

async {
match tyRes.TryGetSymbolUseAndUsages pos lineStr with
Expand Down
6 changes: 6 additions & 0 deletions src/FsAutoComplete.Core/Utils.fs
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,17 @@ let isAScript (fileName: string) =
/// </summary>
let isSignatureFile (fileName: string) = fileName.EndsWith ".fsi"

let toSignatureFile fileName =
IO.Path.ChangeExtension(fileName, ".fsi")

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

let toFSharpFile fileName =
IO.Path.ChangeExtension(fileName, ".fs")

/// <summary>
/// This is a combination of `isAScript`, `isSignatureFile`, and `isFsharpFile`
/// </summary>
Expand Down

0 comments on commit ea9a1db

Please sign in to comment.