Don’t suppress completions after yield (#37609)

This commit is contained in:
Andrew Branch 2020-03-25 14:27:47 -08:00 committed by GitHub
parent 4567fc4f1a
commit a04225dbec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 4 deletions

View File

@ -2159,7 +2159,6 @@ namespace ts.Completions {
case SyntaxKind.ImportKeyword:
case SyntaxKind.LetKeyword:
case SyntaxKind.ConstKeyword:
case SyntaxKind.YieldKeyword:
case SyntaxKind.TypeKeyword: // type htm|
return true;
@ -2200,7 +2199,6 @@ namespace ts.Completions {
case SyntaxKind.PublicKeyword:
case SyntaxKind.StaticKeyword:
case SyntaxKind.VarKeyword:
case SyntaxKind.YieldKeyword:
return true;
case SyntaxKind.AsyncKeyword:
return isPropertyDeclaration(contextToken.parent);

View File

@ -3,5 +3,4 @@
////var x;
////var y = function* gen(p) { yield /*1*/
// These tentatively don't work.
verify.completions({ marker: "1", exact: undefined });
verify.completions({ marker: "1", includes: ["x", "y", "gen", "p", ...completion.globalsVars] });

View File

@ -0,0 +1,20 @@
/// <reference path="fourslash.ts" />
// @Filename: /a.ts
////export function a() {}
// @Filename: /b.ts
////function *f() {
//// yield a/**/
////}
verify.applyCodeActionFromCompletion("", {
name: "a",
source: "/a",
description: `Import 'a' from module "./a"`,
newFileContent: `import { a } from "./a";
function *f() {
yield a
}`
});