Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[typespec-vscode] Meta property autocomplete #5353

Merged
merged 9 commits into from
Jan 10, 2025
14 changes: 13 additions & 1 deletion packages/compiler/src/core/checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2932,8 +2932,20 @@ export function createChecker(program: Program, resolver: NameResolver): Checker
if (base.flags & SymbolFlags.Alias) {
base = getAliasedSymbol(base, undefined);
}
if (base) {
if (base && (base.exports || base.members)) {
mzhongl524 marked this conversation as resolved.
Show resolved Hide resolved
addCompletions(base.exports ?? base.members);
} else if (base?.node === undefined && base?.declarations) {
// Process meta properties separately, such as `::parameters`, `::returnType`
const [nodeModels] = Object.values(base?.declarations);
mzhongl524 marked this conversation as resolved.
Show resolved Hide resolved
if (nodeModels.kind === SyntaxKind.OperationStatement) {
const operation = nodeModels as OperationStatementNode;
addCompletion("parameters", operation.symbol);
addCompletion("returnType", operation.symbol);
}
} else if (base?.node?.kind === SyntaxKind.ModelProperty) {
// Process meta properties separately, such as `::type`
const metaProperty = base.node as ModelPropertyNode;
addCompletion("type", metaProperty.symbol);
RodgeFu marked this conversation as resolved.
Show resolved Hide resolved
}
}
} else {
Expand Down
Loading