diff --git a/docs/release-notes/.FSharp.Compiler.Service/9.0.200.md b/docs/release-notes/.FSharp.Compiler.Service/9.0.200.md index cab4ac0fd9d..b2aed017570 100644 --- a/docs/release-notes/.FSharp.Compiler.Service/9.0.200.md +++ b/docs/release-notes/.FSharp.Compiler.Service/9.0.200.md @@ -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) diff --git a/src/Compiler/Service/ServiceParseTreeWalk.fs b/src/Compiler/Service/ServiceParseTreeWalk.fs index 4c55c78a437..b55844e51ae 100644 --- a/src/Compiler/Service/ServiceParseTreeWalk.fs +++ b/src/Compiler/Service/ServiceParseTreeWalk.fs @@ -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 diff --git a/tests/FSharp.Compiler.Service.Tests/CompletionTests.fs b/tests/FSharp.Compiler.Service.Tests/CompletionTests.fs index 7666fb005a1..38c6812728d 100644 --- a/tests/FSharp.Compiler.Service.Tests/CompletionTests.fs +++ b/tests/FSharp.Compiler.Service.Tests/CompletionTests.fs @@ -97,3 +97,40 @@ let ``Type decl - Record - Field type 01`` () = type Record = { Field: } """ assertHasItemWithNames ["string"] info + + +[] +let ``Expr - Qualifier 01`` () = + let info = + getCompletionInfo "s.Trim(). " (3, 13) """ +let f (s: string) = + s.Trim(). + s.Trim() + s.Trim() + () +""" + assertHasItemWithNames ["Length"] info + +[] +let ``Expr - Qualifier 02`` () = + let info = + getCompletionInfo "s.Trim(). " (4, 13) """ +let f (s: string) = + s.Trim() + s.Trim(). + s.Trim() + () +""" + assertHasItemWithNames ["Length"] info + +[] +let ``Expr - Qualifier 03`` () = + let info = + getCompletionInfo "s.Trim(). " (5, 13) """ +let f (s: string) = + s.Trim() + s.Trim() + s.Trim(). + () +""" + assertHasItemWithNames ["Length"] info