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, 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( export function getTemplateCompletions(
templateInfo: AstResult, position: number): ts.CompletionEntry[] { templateInfo: AstResult, position: number): ts.CompletionEntry[] {
@ -244,18 +244,18 @@ function elementCompletions(info: AstResult, path: AstPath<HtmlAst>): ts.Complet
sortText: name, sortText: name,
}; };
}); });
const pseudoElements = ANGULAR_PSEUDO_ELEMENTS.map(name => { const angularElements = ANGULAR_ELEMENTS.map(name => {
return { return {
name, name,
// Need to cast to unknown because Angular's CompletionKind includes HTML // Need to cast to unknown because Angular's CompletionKind includes HTML
// entites. // entites.
kind: CompletionKind.PSEUDO_ELEMENT as unknown as ts.ScriptElementKind, kind: CompletionKind.ANGULAR_ELEMENT as unknown as ts.ScriptElementKind,
sortText: name, sortText: name,
}; };
}); });
// Return components and html elements // 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', REFERENCE = 'reference',
TYPE = 'type', TYPE = 'type',
VARIABLE = 'variable', VARIABLE = 'variable',
PSEUDO_ELEMENT = 'pseudo element' ANGULAR_ELEMENT = 'angular element'
} }
/** /**