diff --git a/packages/language-service/src/completions.ts b/packages/language-service/src/completions.ts index 64abe85f5b..97bca50faa 100644 --- a/packages/language-service/src/completions.ts +++ b/packages/language-service/src/completions.ts @@ -316,6 +316,7 @@ function attributeValueCompletions(info: AstResult, htmlPath: HtmlAstPath): ng.C templatePath.tail.visit(visitor, null); return visitor.results; } + // In order to provide accurate attribute value completion, we need to know // what the LHS is, and construct the proper AST if it is missing. const htmlAttr = htmlPath.tail as Attribute; diff --git a/packages/language-service/test/completions_spec.ts b/packages/language-service/test/completions_spec.ts index 55c386e067..5d27e46c17 100644 --- a/packages/language-service/test/completions_spec.ts +++ b/packages/language-service/test/completions_spec.ts @@ -753,6 +753,16 @@ describe('completions', () => { expectContain(completions, CompletionKind.VARIABLE, ['$event']); }); }); + + describe('$event completions', () => { + it('should suggest $event in event bindings', () => { + mockHost.override(TEST_TEMPLATE, `
`); + const marker = mockHost.getLocationMarkerFor(TEST_TEMPLATE, 'cursor'); + debugger; + const completions = ngLS.getCompletionsAt(TEST_TEMPLATE, marker.start); + expectContain(completions, CompletionKind.VARIABLE, ['$event']); + }); + }); }); function expectContain(