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

feat: add hints for schema config expr #1589

Closed
wants to merge 7 commits into from
Closed
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions kclvm/sema/src/advanced_resolver/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -867,6 +867,42 @@ impl<'ctx> MutSelfTypedResultWalker<'ctx> for AdvancedResolver<'ctx> {
}

fn walk_config_expr(&mut self, config_expr: &'ctx ast::ConfigExpr) -> Self::Result {
let (start, end) = (self.ctx.start_pos.clone(), self.ctx.end_pos.clone());
shruti2522 marked this conversation as resolved.
Show resolved Hide resolved
let schema_symbol = self.ctx.schema_symbol_stack.last().unwrap_or(&None).clone();
let kind = LocalSymbolScopeKind::Config;

self.enter_local_scope(
&self.ctx.current_filename.as_ref().unwrap().clone(),
start.clone(),
end.clone(),
kind,
);

let cur_scope = *self.ctx.scopes.last().unwrap();
self.gs
.get_scopes_mut()
.set_owner_to_scope(cur_scope, schema_symbol.unwrap());

if let Some(schema_expr) = self
.gs
.get_symbols_mut()
.exprs
.get_mut(schema_symbol.unwrap().get_id())
shruti2522 marked this conversation as resolved.
Show resolved Hide resolved
{
let mut expr_symbol = ExpressionSymbol::new(
schema_expr.name.to_string(),
start.clone(),
shruti2522 marked this conversation as resolved.
Show resolved Hide resolved
end.clone(),
None,
);
expr_symbol.hint = Some(SymbolHint {
pos: start.clone(),
kind: SymbolHintKind::VarHint(schema_expr.name.to_string()),
});
}
shruti2522 marked this conversation as resolved.
Show resolved Hide resolved

self.leave_scope();

self.walk_config_entries(&config_expr.items)?;
Ok(None)
}
Expand Down
Loading