fix(language-service): Remove completions for let and of in ngFor (#34434)

`let` and `of` should be considered reserved keywords in template syntax
and thus should not be part of the autocomplete suggestions.

For reference, TypeScript does not provide such completions.

This commit removes these results and cleans up the code.

PR Close #34434
This commit is contained in:
Keen Yee Liau
2019-12-16 11:03:39 -08:00
committed by Kara Erickson
parent 7916b1e595
commit ab614802e4
6 changed files with 6 additions and 64 deletions

View File

@ -296,12 +296,6 @@ describe('completions', () => {
});
describe('with a *ngFor', () => {
it('should include a let for empty attribute', () => {
const marker = mockHost.getLocationMarkerFor(PARSING_CASES, 'for-empty');
const completions = ngLS.getCompletionsAt(PARSING_CASES, marker.start);
expectContain(completions, CompletionKind.KEY, ['let', 'of']);
});
it('should suggest NgForRow members for let initialization expression', () => {
const marker = mockHost.getLocationMarkerFor(PARSING_CASES, 'for-let-i-equal');
const completions = ngLS.getCompletionsAt(PARSING_CASES, marker.start);
@ -317,18 +311,6 @@ describe('completions', () => {
]);
});
it('should include a let', () => {
const marker = mockHost.getLocationMarkerFor(PARSING_CASES, 'for-let');
const completions = ngLS.getCompletionsAt(PARSING_CASES, marker.start);
expectContain(completions, CompletionKind.KEY, ['let', 'of']);
});
it('should include an "of"', () => {
const marker = mockHost.getLocationMarkerFor(PARSING_CASES, 'for-of');
const completions = ngLS.getCompletionsAt(PARSING_CASES, marker.start);
expectContain(completions, CompletionKind.KEY, ['let', 'of']);
});
it('should include field reference', () => {
const marker = mockHost.getLocationMarkerFor(PARSING_CASES, 'for-people');
const completions = ngLS.getCompletionsAt(PARSING_CASES, marker.start);