refactor: fix by feedback (#31248)

PR Close #31248
This commit is contained in:
Suguru Inatomi 2019-10-18 09:38:56 +09:00 committed by Matias Niemelä
parent 251a512222
commit 60e4490808
2 changed files with 5 additions and 5 deletions

View File

@ -28,7 +28,7 @@ const hiddenHtmlElements = {
link: true,
};
const ANGULAR_PSEUDO_ELEMENTS = ['ng-container', 'ng-content', 'ng-template'] as const ;
const ANGULAR_ELEMENTS: ReadonlyArray<string> = ['ng-container', 'ng-content', 'ng-template'] as const ;
export function getTemplateCompletions(
templateInfo: AstResult, position: number): ts.CompletionEntry[] {
@ -244,18 +244,18 @@ function elementCompletions(info: AstResult, path: AstPath<HtmlAst>): ts.Complet
sortText: name,
};
});
const pseudoElements = ANGULAR_PSEUDO_ELEMENTS.map(name => {
const angularElements = ANGULAR_ELEMENTS.map(name => {
return {
name,
// Need to cast to unknown because Angular's CompletionKind includes HTML
// entites.
kind: CompletionKind.PSEUDO_ELEMENT as unknown as ts.ScriptElementKind,
kind: CompletionKind.ANGULAR_ELEMENT as unknown as ts.ScriptElementKind,
sortText: name,
};
});
// Return components and html elements
return uniqueByName([...htmlElements, ...components, ...pseudoElements]);
return uniqueByName([...htmlElements, ...components, ...angularElements]);
}
/**

View File

@ -274,7 +274,7 @@ export enum CompletionKind {
REFERENCE = 'reference',
TYPE = 'type',
VARIABLE = 'variable',
PSEUDO_ELEMENT = 'pseudo element'
ANGULAR_ELEMENT = 'angular element'
}
/**