Skip to content

Commit 85573f5

Browse files
committed
Fix Editor
1 parent f93aa6c commit 85573f5

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

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

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,12 @@ type internal GoToDefinition(metadataAsSource: FSharpMetadataAsSourceService) =
204204
match targetSymbolUse.Symbol with
205205
| :? FSharpEntity as symbol -> symbol.TryGetMetadataText() |> Option.map (fun text -> text, symbol.DisplayName)
206206
| :? FSharpMemberOrFunctionOrValue as symbol ->
207-
symbol.ApparentEnclosingEntity.TryGetMetadataText()
208-
|> Option.map (fun text -> text, symbol.ApparentEnclosingEntity.DisplayName)
207+
symbol.ApparentEnclosingEntity
208+
|> Option.bind (fun entity ->
209+
entity.TryGetMetadataText()
210+
|> Option.map (fun text -> text, entity.DisplayName)
211+
)
212+
209213
| :? FSharpField as symbol ->
210214
match symbol.DeclaringEntity with
211215
| Some entity ->
@@ -652,8 +656,11 @@ type internal GoToDefinition(metadataAsSource: FSharpMetadataAsSourceService) =
652656
match targetSymbolUse.Symbol with
653657
| :? FSharpEntity as symbol -> symbol.TryGetMetadataText() |> Option.map (fun text -> text, symbol.DisplayName)
654658
| :? FSharpMemberOrFunctionOrValue as symbol ->
655-
symbol.ApparentEnclosingEntity.TryGetMetadataText()
656-
|> Option.map (fun text -> text, symbol.ApparentEnclosingEntity.DisplayName)
659+
symbol.ApparentEnclosingEntity
660+
|> Option.bind (fun entity ->
661+
entity.TryGetMetadataText()
662+
|> Option.map (fun text -> text, entity.DisplayName)
663+
)
657664
| :? FSharpField as symbol ->
658665
match symbol.DeclaringEntity with
659666
| Some entity ->

0 commit comments

Comments
 (0)