diff --git a/src/services/completions.ts b/src/services/completions.ts index 478a9ece1c691..aeb19e3c78eb8 100644 --- a/src/services/completions.ts +++ b/src/services/completions.ts @@ -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); diff --git a/tests/cases/fourslash/completionListInUnclosedYieldExpression01.ts b/tests/cases/fourslash/completionListInUnclosedYieldExpression01.ts index 89b50e7bff5e1..998df73c1ce24 100644 --- a/tests/cases/fourslash/completionListInUnclosedYieldExpression01.ts +++ b/tests/cases/fourslash/completionListInUnclosedYieldExpression01.ts @@ -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] }); diff --git a/tests/cases/fourslash/completionsImportYieldExpression.ts b/tests/cases/fourslash/completionsImportYieldExpression.ts new file mode 100644 index 0000000000000..e010154075e1f --- /dev/null +++ b/tests/cases/fourslash/completionsImportYieldExpression.ts @@ -0,0 +1,20 @@ +/// + +// @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 +}` +});