Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't show completions on nested module identifier #13089

Merged
merged 23 commits into from
Mar 10, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/fsharp/service/ServiceParsedInputOps.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1127,6 +1127,12 @@ module ParsedInput =
Some (CompletionContext.OpenDeclaration isOpenType)
else
None

// module Namespace.Top
// module Neste|
| SynModuleDecl.NestedModule (moduleInfo = SynComponentInfo (longId = [ ident ])) when rangeContainsPos ident.idRange pos ->
Some CompletionContext.Invalid

| _ -> defaultTraverse decl

member _.VisitType(_path, defaultTraverse, ty) =
Expand Down
19 changes: 19 additions & 0 deletions vsintegration/tests/UnitTests/CompletionProviderTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,25 @@ open type System.Ma
let expected = ["Management"; "Math"] // both namespace and static type
VerifyCompletionList(fileContents, "System.Ma", expected, [])

[<Test>]
let ``No completion on nested module identifier``() =
let fileContents = """
module Namespace.Top

module Nest
"""
VerifyNoCompletionList(fileContents, "Nest")

[<Test>]
let ``No completion on nested module identifier2``() =
let fileContents = """
namespace N

module Nested =
do ()
"""
VerifyNoCompletionList(fileContents, "Nested")

[<Test>]
let ``No completion on type name at declaration site``() =
let fileContents = """
Expand Down