diff --git a/src/FsAutoComplete.Core/Commands.fs b/src/FsAutoComplete.Core/Commands.fs index 3a8b155d5..007fdb76c 100644 --- a/src/FsAutoComplete.Core/Commands.fs +++ b/src/FsAutoComplete.Core/Commands.fs @@ -1361,8 +1361,10 @@ type Commands() = member _.VisitModuleOrNamespace(_, synModuleOrNamespace) = match synModuleOrNamespace with - | SynModuleOrNamespace(attribs = attributes; longId = longId; xmlDoc = xmlDoc) when - longIdentContainsPos longId pos && xmlDoc.IsEmpty + | SynModuleOrNamespace(attribs = attributes; longId = longId; xmlDoc = xmlDoc; kind = kind) when + kind = SynModuleOrNamespaceKind.NamedModule + && longIdentContainsPos longId pos + && xmlDoc.IsEmpty -> Some(false, tryGetFirstAttributeLine attributes) | SynModuleOrNamespace(decls = decls) -> diff --git a/test/FsAutoComplete.Tests.Lsp/CodeFixTests/Tests.fs b/test/FsAutoComplete.Tests.Lsp/CodeFixTests/Tests.fs index 55b8c8f2a..08b8c3ed8 100644 --- a/test/FsAutoComplete.Tests.Lsp/CodeFixTests/Tests.fs +++ b/test/FsAutoComplete.Tests.Lsp/CodeFixTests/Tests.fs @@ -1852,7 +1852,18 @@ let private generateXmlDocumentationTests state = /// module MyNestedModule = let x = 3 - """ ]) + """ + + testCaseAsync "not applicable for namespace" + <| CodeFix.checkNotApplicable + server + """ + namespace N$0 + module MyNestedModule = + let x = 3 + """ + Diagnostics.acceptAll + selectCodeFix ]) let private addMissingXmlDocumentationTests state = serverTestList (nameof AddMissingXmlDocumentation) state defaultConfigDto None (fun server ->