diff --git a/src/fsharp/service/ServiceUntypedParse.fs b/src/fsharp/service/ServiceUntypedParse.fs index a9f1fcbb21e..4c6bbe8f9cf 100755 --- a/src/fsharp/service/ServiceUntypedParse.fs +++ b/src/fsharp/service/ServiceUntypedParse.fs @@ -1248,6 +1248,9 @@ module UntypedParseImpl = | _ -> defaultTraverse synBinding match headPat with + | SynPat.LongIdent(longDotId = lidwd) when rangeContainsPos lidwd.Range pos -> + // let fo|o x = () + Some CompletionContext.Invalid | SynPat.LongIdent(_,_,_,ctorArgs,_,_) -> match ctorArgs with | SynConstructorArgs.Pats(pats) -> @@ -1264,6 +1267,9 @@ module UntypedParseImpl = | _ -> visitParam pat ) | _ -> defaultTraverse synBinding + | SynPat.Named(range = range) when rangeContainsPos range pos -> + // let fo|o = 1 + Some CompletionContext.Invalid | _ -> defaultTraverse synBinding member __.VisitHashDirective(range) = diff --git a/vsintegration/tests/UnitTests/CompletionProviderTests.fs b/vsintegration/tests/UnitTests/CompletionProviderTests.fs index a5c6e7d31f8..ac9502edc61 100644 --- a/vsintegration/tests/UnitTests/CompletionProviderTests.fs +++ b/vsintegration/tests/UnitTests/CompletionProviderTests.fs @@ -457,13 +457,37 @@ type T VerifyNoCompletionList(fileContents, "type T") [] -let ``No completion on function name at declaration site``() = +let ``No completion on name of unfinished function declaration``() = let fileContents = """ let f """ VerifyNoCompletionList(fileContents, "let f") +[] +let ``No completion on name of value declaration``() = + let fileContents = """ +let xyz = 1 + +""" + VerifyNoCompletionList(fileContents, "let xy") + +[] +let ``No completion on name of function declaration``() = + let fileContents = """ +let foo x = 1 + +""" + VerifyNoCompletionList(fileContents, "let fo") + +[] +let ``No completion on name of tupled function declaration``() = + let fileContents = """ +let foo (x, y) = 1 + +""" + VerifyNoCompletionList(fileContents, "let fo") + [] let ``No completion on member name at declaration site``() = let fileContents = """