fix(language-service): remove completion for string (#37983)

If the user inputs a string(e.g. `<div [ngClass]="'str~{cursor}'"></div>`), the completion is useless.

PR Close #37983
This commit is contained in:
ivanwonder
2020-07-08 16:29:55 +08:00
committed by Andrew Scott
parent 36dd817913
commit 10aba15154
2 changed files with 17 additions and 1 deletions

View File

@ -848,6 +848,13 @@ describe('completions', () => {
const completions = ngLS.getCompletionsAtPosition(TEST_TEMPLATE, marker.start);
expect(completions).toBeUndefined();
});
it('should not provide completions for string', () => {
mockHost.override(TEST_TEMPLATE, `<div [ngClass]="'str~{cursor}'"></div>`);
const marker = mockHost.getLocationMarkerFor(TEST_TEMPLATE, 'cursor');
const completions = ngLS.getCompletionsAtPosition(TEST_TEMPLATE, marker.start);
expect(completions).toBeUndefined();
});
});
function expectContain(