Skip to content

Commit

Permalink
fix: fix config entry key def
Browse files Browse the repository at this point in the history
Signed-off-by: he1pa <[email protected]>
  • Loading branch information
He1pa committed Aug 13, 2024
1 parent dcbd9d9 commit f39ae30
Show file tree
Hide file tree
Showing 7 changed files with 74 additions and 5 deletions.
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,6 @@
---
source: tools/src/LSP/src/goto_def.rs
assertion_line: 501
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,6 @@
---
source: tools/src/LSP/src/goto_def.rs
assertion_line: 508
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,6 @@
---
source: tools/src/LSP/src/goto_def.rs
assertion_line: 515
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,6 @@
---
source: tools/src/LSP/src/goto_def.rs
assertion_line: 522
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
}

0 comments on commit f39ae30

Please sign in to comment.