@@ -170,14 +170,18 @@ type FSharpParseFileResults(errors: FSharpDiagnostic[], input: ParsedInput optio
170170 member _. VisitExpr(_, _, defaultTraverse, expr) =
171171 match expr with
172172 | SynExpr.App (_, _, SynExpr.App(_, true , SynExpr.Ident ident, _, _), argExpr, _) when rangeContainsPos argExpr.Range pos ->
173- if ident.idText = " op_PipeRight" then
174- Some ( ident, 1 )
175- elif ident.idText = " op_PipeRight2" then
176- Some ( ident, 2 )
177- elif ident.idText = " op_PipeRight3" then
178- Some ( ident, 3 )
179- else
173+ match argExpr with
174+ | SynExpr.App(_, _, _, SynExpr.Paren( expr, _, _, _), _) when rangeContainsPos expr.Range pos ->
180175 None
176+ | _ ->
177+ if ident.idText = " op_PipeRight" then
178+ Some ( ident, 1 )
179+ elif ident.idText = " op_PipeRight2" then
180+ Some ( ident, 2 )
181+ elif ident.idText = " op_PipeRight3" then
182+ Some ( ident, 3 )
183+ else
184+ None
181185 | _ -> defaultTraverse expr
182186 })
183187 | None -> None
@@ -216,6 +220,10 @@ type FSharpParseFileResults(errors: FSharpDiagnostic[], input: ParsedInput optio
216220 match argExpr with
217221 | SynExpr.App (_, _, _, _, range) when rangeContainsPos range pos ->
218222 getIdentRangeForFuncExprInApp traverseSynExpr argExpr pos
223+
224+ | SynExpr.Paren( SynExpr.Lambda(_, _, _ args, body, _, _), _, _, _) when rangeContainsPos body.Range pos ->
225+ getIdentRangeForFuncExprInApp traverseSynExpr body pos
226+
219227 | _ ->
220228 match funcExpr with
221229 | SynExpr.App (_, true , _, _, _) when rangeContainsPos argExpr.Range pos ->
@@ -227,6 +235,17 @@ type FSharpParseFileResults(errors: FSharpDiagnostic[], input: ParsedInput optio
227235 // Generally, we want to dive into the func expr to get the range
228236 // of the identifier of the function we're after
229237 getIdentRangeForFuncExprInApp traverseSynExpr funcExpr pos
238+
239+ | SynExpr.LetOrUse(_, _, bindings, body, range) when rangeContainsPos range pos ->
240+ let binding =
241+ bindings
242+ |> List.tryFind ( fun x -> rangeContainsPos x.RangeOfBindingAndRhs pos)
243+ match binding with
244+ | Some( SynBinding.Binding(_, _, _, _, _, _, _, _, _, expr, _, _)) ->
245+ getIdentRangeForFuncExprInApp traverseSynExpr expr pos
246+ | None ->
247+ getIdentRangeForFuncExprInApp traverseSynExpr body pos
248+
230249 | expr ->
231250 traverseSynExpr expr
232251 |> Option.map ( fun expr -> expr)
0 commit comments