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

fix: fix config entry key def #1559

Merged
merged 1 commit into from
Aug 13, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
12 changes: 7 additions & 5 deletions kclvm/sema/src/advanced_resolver/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1127,11 +1127,13 @@ impl<'ctx> AdvancedResolver<'ctx> {
if let crate::core::symbol::SymbolKind::Attribute =
symbol_ref.get_kind()
{
self.gs.get_scopes_mut().add_def_to_scope(
cur_scope,
name,
first_unresolved_ref,
);
if maybe_def {
self.gs.get_scopes_mut().add_def_to_scope(
cur_scope,
name,
first_unresolved_ref,
);
}
}
}
_ => {}
Expand Down
28 changes: 28 additions & 0 deletions kclvm/tools/src/LSP/src/goto_def.rs
Original file line number Diff line number Diff line change
Expand Up @@ -497,4 +497,32 @@ mod tests {
17,
12
);

goto_def_test_snapshot!(
goto_attr_in_schema_def_5,
"src/test_data/goto_def_test/goto_attr_in_schema_def/goto_attr_in_schema_def.k",
32,
15
);

goto_def_test_snapshot!(
goto_attr_in_schema_def_6,
"src/test_data/goto_def_test/goto_attr_in_schema_def/goto_attr_in_schema_def.k",
33,
15
);

goto_def_test_snapshot!(
goto_attr_in_schema_def_7,
"src/test_data/goto_def_test/goto_attr_in_schema_def/goto_attr_in_schema_def.k",
32,
10
);

goto_def_test_snapshot!(
goto_attr_in_schema_def_8,
"src/test_data/goto_def_test/goto_attr_in_schema_def/goto_attr_in_schema_def.k",
33,
10
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
source: tools/src/LSP/src/goto_def.rs
expression: "format!(\"{:?}\", { fmt_resp(& res) })"
---
"path: \"src/test_data/goto_def_test/goto_attr_in_schema_def/goto_attr_in_schema_def.k\", range: Range { start: Position { line: 26, character: 4 }, end: Position { line: 26, character: 7 } }"
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
source: tools/src/LSP/src/goto_def.rs
expression: "format!(\"{:?}\", { fmt_resp(& res) })"
---
"path: \"src/test_data/goto_def_test/goto_attr_in_schema_def/goto_attr_in_schema_def.k\", range: Range { start: Position { line: 28, character: 4 }, end: Position { line: 28, character: 7 } }"
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
source: tools/src/LSP/src/goto_def.rs
expression: "format!(\"{:?}\", { fmt_resp(& res) })"
---
"path: \"src/test_data/goto_def_test/goto_attr_in_schema_def/goto_attr_in_schema_def.k\", range: Range { start: Position { line: 21, character: 4 }, end: Position { line: 21, character: 7 } }"
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
source: tools/src/LSP/src/goto_def.rs
expression: "format!(\"{:?}\", { fmt_resp(& res) })"
---
"path: \"src/test_data/goto_def_test/goto_attr_in_schema_def/goto_attr_in_schema_def.k\", range: Range { start: Position { line: 22, character: 4 }, end: Position { line: 22, character: 7 } }"
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,18 @@ schema Nested:
if a:
aa: "aa"
}

schema Baz:
foo: [str]
bar: Name

schema RoleBinding:

foo?: [str]

bar: Name

baz: Baz = Baz {
foo: foo
bar: bar
}
Loading