Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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/ServiceUntypedParse.fs
Original file line number Diff line number Diff line change
Expand Up @@ -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) ->
Expand All @@ -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) =
Expand Down
26 changes: 25 additions & 1 deletion vsintegration/tests/UnitTests/CompletionProviderTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -457,13 +457,37 @@ type T
VerifyNoCompletionList(fileContents, "type T")

[<Test>]
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")

[<Test>]
let ``No completion on name of value declaration``() =
let fileContents = """
let xyz = 1

"""
VerifyNoCompletionList(fileContents, "let xy")

[<Test>]
let ``No completion on name of function declaration``() =
let fileContents = """
let foo x = 1

"""
VerifyNoCompletionList(fileContents, "let fo")

[<Test>]
let ``No completion on name of tupled function declaration``() =
let fileContents = """
let foo (x, y) = 1

"""
VerifyNoCompletionList(fileContents, "let fo")

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