Skip to content

Commit

Permalink
Fix no props completion
Browse files Browse the repository at this point in the history
  • Loading branch information
yoyo930021 committed Jul 30, 2020
1 parent 3c686d0 commit e8fe639
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
9 changes: 6 additions & 3 deletions server/src/modes/script/childComponents.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as ts from 'typescript';
import { getLastChild, buildDocumentation, getObjectLiteralExprFromExportExpr } from './componentInfo';
import { getLastChild, buildDocumentation, getDefaultExportObjectLiteralExpr } from './componentInfo';
import { T_TypeScript } from '../../services/dependencyService';

interface InternalChildComponent {
Expand Down Expand Up @@ -58,7 +58,10 @@ export function getChildComponents(
if (objectLiteralSymbol.flags & tsModule.SymbolFlags.Alias) {
const definitionObjectLiteralSymbol = checker.getAliasedSymbol(objectLiteralSymbol);
if (definitionObjectLiteralSymbol.valueDeclaration) {
const defaultExportExpr = getLastChild(definitionObjectLiteralSymbol.valueDeclaration);
const defaultExportExpr = getDefaultExportObjectLiteralExpr(
tsModule,
definitionObjectLiteralSymbol.valueDeclaration.getSourceFile()
);
if (!defaultExportExpr) {
return;
}
Expand All @@ -71,7 +74,7 @@ export function getChildComponents(
start: defaultExportExpr.getStart(undefined, true),
end: defaultExportExpr.getEnd()
},
defaultExportExpr: getObjectLiteralExprFromExportExpr(tsModule, defaultExportExpr)
defaultExportExpr
});
}
}
Expand Down
2 changes: 1 addition & 1 deletion server/src/modes/script/componentInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export function analyzeDefaultExportExpr(
};
}

function getDefaultExportObjectLiteralExpr(
export function getDefaultExportObjectLiteralExpr(
tsModule: T_TypeScript,
sourceFile: ts.SourceFile
): ts.Expression | undefined {
Expand Down
2 changes: 1 addition & 1 deletion test/interpolation/fixture/completion/Basic.vue
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,5 @@ export default {
console.log(this.msg)
}
}
}
};
</script>

0 comments on commit e8fe639

Please sign in to comment.