@@ -473,6 +473,18 @@ type internal GoToDefinition(metadataAsSource: FSharpMetadataAsSourceService) =
473473 | :? FSharpMemberOrFunctionOrValue as symbol ->
474474 symbol.ApparentEnclosingEntity.TryGetMetadataText()
475475 |> Option.map ( fun text -> text, symbol.ApparentEnclosingEntity.DisplayName)
476+ | :? FSharpField as symbol ->
477+ match symbol.DeclaringEntity with
478+ | Some entity ->
479+ let text = entity.TryGetMetadataText()
480+
481+ match text with
482+ | Some text -> Some( text, entity.DisplayName)
483+ | None -> None
484+ | None -> None
485+ | :? FSharpUnionCase as symbol ->
486+ symbol.DeclaringEntity.TryGetMetadataText()
487+ |> Option.map ( fun text -> text, symbol.DisplayName)
476488 | _ -> None
477489
478490 let result =
@@ -523,13 +535,24 @@ type internal GoToDefinition(metadataAsSource: FSharpMetadataAsSourceService) =
523535 symbol1.DisplayName = symbol2.DisplayName
524536 | (: ? FSharpMemberOrFunctionOrValue as symbol1 ), (:? FSharpMemberOrFunctionOrValue as symbol2 ) ->
525537 symbol1.DisplayName = symbol2.DisplayName
538+ && ( match symbol1.DeclaringEntity, symbol2.DeclaringEntity with
539+ | Some e1, Some e2 -> e1.CompiledName = e2.CompiledName
540+ | _ -> false )
526541 && symbol1.GenericParameters.Count = symbol2.GenericParameters.Count
527542 && symbol1.CurriedParameterGroups.Count = symbol2.CurriedParameterGroups.Count
528543 && (( symbol1.CurriedParameterGroups, symbol2.CurriedParameterGroups)
529544 ||> Seq.forall2 ( fun pg1 pg2 ->
530545 pg1.Count = pg2.Count
531546 && (( pg1, pg2) ||> Seq.forall2 ( fun p1 p2 -> areTypesEqual p1.Type p2.Type))))
532547 && areTypesEqual symbol1.ReturnParameter.Type symbol2.ReturnParameter.Type
548+ | (: ? FSharpField as symbol1 ), (:? FSharpField as symbol2 ) when x .IsFromDefinition ->
549+ symbol1.DisplayName = symbol2.DisplayName
550+ && ( match symbol1.DeclaringEntity, symbol2.DeclaringEntity with
551+ | Some e1, Some e2 -> e1.CompiledName = e2.CompiledName
552+ | _ -> false )
553+ | (: ? FSharpUnionCase as symbol1 ), (:? FSharpUnionCase as symbol2 ) ->
554+ symbol1.DisplayName = symbol2.DisplayName
555+ && symbol1.DeclaringEntity.CompiledName = symbol2.DeclaringEntity.CompiledName
533556 | _ -> false )
534557 |> Option.map ( fun x -> x.Range)
535558
0 commit comments