Skip to content

Commit a04225d

Browse files
authored
Don’t suppress completions after yield (microsoft#37609)
1 parent 4567fc4 commit a04225d

File tree

3 files changed

+21
-4
lines changed

3 files changed

+21
-4
lines changed

src/services/completions.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2159,7 +2159,6 @@ namespace ts.Completions {
21592159
case SyntaxKind.ImportKeyword:
21602160
case SyntaxKind.LetKeyword:
21612161
case SyntaxKind.ConstKeyword:
2162-
case SyntaxKind.YieldKeyword:
21632162
case SyntaxKind.TypeKeyword: // type htm|
21642163
return true;
21652164

@@ -2200,7 +2199,6 @@ namespace ts.Completions {
22002199
case SyntaxKind.PublicKeyword:
22012200
case SyntaxKind.StaticKeyword:
22022201
case SyntaxKind.VarKeyword:
2203-
case SyntaxKind.YieldKeyword:
22042202
return true;
22052203
case SyntaxKind.AsyncKeyword:
22062204
return isPropertyDeclaration(contextToken.parent);

tests/cases/fourslash/completionListInUnclosedYieldExpression01.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,4 @@
33
////var x;
44
////var y = function* gen(p) { yield /*1*/
55

6-
// These tentatively don't work.
7-
verify.completions({ marker: "1", exact: undefined });
6+
verify.completions({ marker: "1", includes: ["x", "y", "gen", "p", ...completion.globalsVars] });
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/// <reference path="fourslash.ts" />
2+
3+
// @Filename: /a.ts
4+
////export function a() {}
5+
6+
// @Filename: /b.ts
7+
////function *f() {
8+
//// yield a/**/
9+
////}
10+
11+
verify.applyCodeActionFromCompletion("", {
12+
name: "a",
13+
source: "/a",
14+
description: `Import 'a' from module "./a"`,
15+
newFileContent: `import { a } from "./a";
16+
17+
function *f() {
18+
yield a
19+
}`
20+
});

0 commit comments

Comments
 (0)