fix(language-service): Proper completions for properties and events (#34445)

This commit fixes autocompletions for properties and events bindings.

The language service will no longer provide bindings like (click) or [id].
Instead, it'll infer the context based on the brackets and provide suggestions
without any brackets.

This fix also adds support for alternative binding syntax such as
`bind-`, `on-`, and `bindon`.

PR closes https://github.com/angular/vscode-ng-language-service/issues/398
PR closes https://github.com/angular/vscode-ng-language-service/issues/474

PR Close #34445
This commit is contained in:
Keen Yee Liau
2019-12-12 15:46:27 -08:00
committed by Kara Erickson
parent 7ea39849ff
commit 4e41bf9e30
7 changed files with 241 additions and 159 deletions

View File

@ -36,7 +36,6 @@ import * as ParsingCases from './parsing-cases';
ParsingCases.CaseUnknown,
ParsingCases.EmptyInterpolation,
ParsingCases.EventBinding,
ParsingCases.FooComponent,
ParsingCases.ForLetIEqual,
ParsingCases.ForOfLetEmpty,
ParsingCases.ForUsingComponent,

View File

@ -93,18 +93,6 @@ export class NumberModel {
@Output('outputAlias') modelChange: EventEmitter<number> = new EventEmitter();
}
@Component({
selector: 'foo-component',
template: `
<div string-model ~{string-marker}="text"></div>
<div number-model ~{number-marker}="value"></div>
`,
})
export class FooComponent {
text: string = 'some text';
value: number = 42;
}
interface Person {
name: string;
age: number;

View File

@ -4,7 +4,4 @@
</h1>
~{after-h1}<h2>{{~{h2-hero}hero.~{h2-name}name}} details!</h2>
<div><label>id: </label>{{~{label-hero}hero.~{label-id}id}}</div>
<div ~{div-attributes}>
<label>name: </label>
</div>
&~{entity-amp}amp;