Skip to content

Commit

Permalink
Completion: fix qualified completion in sequence expressions (dotnet#…
Browse files Browse the repository at this point in the history
  • Loading branch information
auduchinok authored Dec 19, 2024
1 parent bae73d3 commit c13108d
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 6 deletions.
1 change: 1 addition & 0 deletions docs/release-notes/.FSharp.Compiler.Service/9.0.200.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
* Add missing nullable-metadata for C# consumers of records,exceptions and DU subtypes generated from F# code. [PR #18079](https://github.com/dotnet/fsharp/pull/18079)
* Fix a race condition in file book keeping in the compiler service ([#18008](https://github.com/dotnet/fsharp/pull/18008))
* Fix trimming '%' characters when lowering interpolated string to a concat call [PR #18123](https://github.com/dotnet/fsharp/pull/18123)
* Completion: fix qualified completion in sequence expressions [PR #18111](https://github.com/dotnet/fsharp/pull/18111)
* Symbols: try to use ValReprInfoForDisplay in Mfv.CurriedParameterGroups ([PR #18124](https://github.com/dotnet/fsharp/pull/18124))
* Shim/file system: fix leaks of the shim [PR #18144](https://github.com/dotnet/fsharp/pull/18144)

Expand Down
6 changes: 0 additions & 6 deletions src/Compiler/Service/ServiceParseTreeWalk.fs
Original file line number Diff line number Diff line change
Expand Up @@ -388,12 +388,6 @@ module SyntaxTraversal =
seq {
match expr with
| SynExpr.Sequential(expr1 = expr1; expr2 = SynExpr.Sequential _ as expr2) ->
// It's a nested sequential expression.
// Visit it, but make defaultTraverse do nothing,
// since we're going to traverse its descendants ourselves.
yield dive expr expr.Range (fun expr -> visitor.VisitExpr(path, traverseSynExpr path, (fun _ -> None), expr))

// Now traverse its descendants.
let path = SyntaxNode.SynExpr expr :: path
yield dive expr1 expr1.Range (traverseSynExpr path)
yield! traverseSequentials path expr2
Expand Down
37 changes: 37 additions & 0 deletions tests/FSharp.Compiler.Service.Tests/CompletionTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -97,3 +97,40 @@ let ``Type decl - Record - Field type 01`` () =
type Record = { Field: }
"""
assertHasItemWithNames ["string"] info


[<Fact>]
let ``Expr - Qualifier 01`` () =
let info =
getCompletionInfo "s.Trim(). " (3, 13) """
let f (s: string) =
s.Trim().
s.Trim()
s.Trim()
()
"""
assertHasItemWithNames ["Length"] info

[<Fact>]
let ``Expr - Qualifier 02`` () =
let info =
getCompletionInfo "s.Trim(). " (4, 13) """
let f (s: string) =
s.Trim()
s.Trim().
s.Trim()
()
"""
assertHasItemWithNames ["Length"] info

[<Fact>]
let ``Expr - Qualifier 03`` () =
let info =
getCompletionInfo "s.Trim(). " (5, 13) """
let f (s: string) =
s.Trim()
s.Trim()
s.Trim().
()
"""
assertHasItemWithNames ["Length"] info

0 comments on commit c13108d

Please sign in to comment.