未验证 提交 665f675f 编写于 作者: K kerams 提交者: GitHub

Filter type test completion list (#12930)

上级 567ea957
......@@ -634,7 +634,8 @@ module SyntaxTraversal =
let path = SyntaxNode.SynPat p :: origPath
match p with
| SynPat.Paren (p, _) -> traversePat path p
| SynPat.Or (p1, p2, _, _) -> [ p1; p2] |> List.tryPick (traversePat path)
| SynPat.As (p1, p2, _)
| SynPat.Or (p1, p2, _, _) -> [ p1; p2 ] |> List.tryPick (traversePat path)
| SynPat.Ands (ps, _)
| SynPat.Tuple (_, ps, _)
| SynPat.ArrayOrList (_, ps, _) -> ps |> List.tryPick (traversePat path)
......
......@@ -1079,6 +1079,12 @@ module ParsedInput =
None
| _ -> None)
member _.VisitPat (_, defaultTraverse, pat) =
match pat with
| SynPat.IsInst (_, range) when rangeContainsPos range pos ->
Some CompletionContext.PatternType
| _ -> defaultTraverse pat
member _.VisitModuleDecl(_path, defaultTraverse, decl) =
match decl with
| SynModuleDecl.Open(target, m) ->
......
......@@ -647,6 +647,25 @@ let _ = fun (p:l) -> ()
"""
VerifyCompletionList(fileContents, "let _ = fun (p:l", ["LanguagePrimitives"; "List"], ["let"; "log"])
[<Test>]
let ``Completions in match clause type test contain modules and types but not keywords or functions``() =
let fileContents = """
match box 5 with
| :? l as x -> ()
| _ -> ()
"""
VerifyCompletionList(fileContents, ":? l", ["LanguagePrimitives"; "List"], ["let"; "log"])
[<Test>]
let ``Completions in catch clause type test contain modules and types but not keywords or functions``() =
let fileContents = """
try
()
with :? l as x ->
()
"""
VerifyCompletionList(fileContents, ":? l", ["LanguagePrimitives"; "List"], ["let"; "log"])
[<Test>]
let ``Extensions.Bug5162``() =
let fileContents = """
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册