[ci] yarn format

This commit is contained in:
matthewp 2021-08-12 23:40:39 +00:00 committed by GitHub Actions
parent 7cd3689a8e
commit d5564747fa
2 changed files with 32 additions and 29 deletions

View file

@ -213,20 +213,23 @@ export class AstroPlugin implements CompletionsProvider, FoldingRangeProvider {
const completionItems: CompletionItem[] = [];
for (let type of typeChecker.getBaseTypes(propsNode as unknown as ts.InterfaceType)) {
type.symbol.members!.forEach(mem => {
type.symbol.members!.forEach((mem) => {
let item: CompletionItem = {
label: mem.name,
insertText: mem.name,
commitCharacters: []
commitCharacters: [],
};
mem.getDocumentationComment(typeChecker);
let description = mem.getDocumentationComment(typeChecker).map(val => val.text).join('\n');
let description = mem
.getDocumentationComment(typeChecker)
.map((val) => val.text)
.join('\n');
if (description) {
let docs: MarkupContent = {
kind: MarkupKind.Markdown,
value: description
value: description,
};
item.documentation = docs;
}
@ -240,18 +243,21 @@ export class AstroPlugin implements CompletionsProvider, FoldingRangeProvider {
let name = member.name.getText();
let symbol = typeChecker.getSymbolAtLocation(member.name);
if (!symbol) continue;
let description = symbol.getDocumentationComment(typeChecker).map(val => val.text).join('\n');
let description = symbol
.getDocumentationComment(typeChecker)
.map((val) => val.text)
.join('\n');
let item: CompletionItem = {
label: name,
insertText: name,
commitCharacters: []
commitCharacters: [],
};
if (description) {
let docs: MarkupContent = {
kind: MarkupKind.Markdown,
value: description
value: description,
};
item.documentation = docs;
}
@ -314,7 +320,7 @@ export class AstroPlugin implements CompletionsProvider, FoldingRangeProvider {
private getPropsNode(sourceFile: ts.SourceFile): ts.InterfaceDeclaration | null {
let found: ts.InterfaceDeclaration | null = null;
ts.forEachChild(sourceFile, node => {
ts.forEachChild(sourceFile, (node) => {
if (isNodeExported(node)) {
if (ts.isInterfaceDeclaration(node)) {
if (ts.getNameOfDeclaration(node)?.getText() === 'Props') {
@ -329,8 +335,5 @@ export class AstroPlugin implements CompletionsProvider, FoldingRangeProvider {
}
function isNodeExported(node: ts.Node): boolean {
return (
(ts.getCombinedModifierFlags(node as ts.Declaration) & ts.ModifierFlags.Export) !== 0 ||
(!!node.parent && node.parent.kind === ts.SyntaxKind.SourceFile)
);
return (ts.getCombinedModifierFlags(node as ts.Declaration) & ts.ModifierFlags.Export) !== 0 || (!!node.parent && node.parent.kind === ts.SyntaxKind.SourceFile);
}