Skip to content

Commit 7cd0fb2

Browse files
authored
Fix go to definition when it's not the first occurence in file (#15962)
1 parent 1492e70 commit 7cd0fb2

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

vsintegration/src/FSharp.Editor/Navigation/GoToDefinition.fs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,12 @@ type internal GoToDefinition(metadataAsSource: FSharpMetadataAsSourceService) =
252252
|> liftAsync
253253

254254
let symbolUses = checkFileResults.GetUsesOfSymbolInFile targetSymbolUse.Symbol
255-
let! implSymbol = symbolUses |> Array.tryHead
255+
256+
let! implSymbol =
257+
symbolUses
258+
|> Array.sortByDescending (fun x -> x.IsFromDefinition)
259+
|> Array.tryHead
260+
256261
return implSymbol.Range
257262
}
258263

0 commit comments

Comments
 (0)