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: lsp support find refs #721

Merged
merged 11 commits into from
Oct 12, 2023
1 change: 1 addition & 0 deletions kclvm/tools/src/LSP/src/capabilities.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ pub fn server_capabilities(client_caps: &ClientCapabilities) -> ServerCapabiliti
),
document_formatting_provider: Some(OneOf::Left(true)),
document_range_formatting_provider: Some(OneOf::Left(true)),
references_provider: Some(OneOf::Left(true)),
..Default::default()
}
}
10 changes: 5 additions & 5 deletions kclvm/tools/src/LSP/src/completion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ fn completion_attr(
if let Some((node, schema_expr)) = is_in_schema(program, pos) {
let schema_def = find_def(node, &schema_expr.name.get_end_pos(), prog_scope);
if let Some(schema) = schema_def {
if let Definition::Object(obj) = schema {
if let Definition::Object(obj, _) = schema {
let schema_type = obj.ty.into_schema_type();
completions.extend(schema_type.attrs.keys().map(|attr| KCLCompletionItem {
label: attr.clone(),
Expand Down Expand Up @@ -178,7 +178,7 @@ pub(crate) fn get_completion(
let def = find_def(stmt, pos, prog_scope);
if let Some(def) = def {
match def {
crate::goto_def::Definition::Object(obj) => {
crate::goto_def::Definition::Object(obj, _) => {
match &obj.ty.kind {
// builtin (str) functions
kclvm_sema::ty::TypeKind::Str => {
Expand Down Expand Up @@ -226,7 +226,7 @@ pub(crate) fn get_completion(
_ => {}
}
}
crate::goto_def::Definition::Scope(s) => {
crate::goto_def::Definition::Scope(s, _) => {
for (name, obj) in &s.elems {
if let ScopeObjectKind::Module(_) = obj.borrow().kind {
continue;
Expand Down Expand Up @@ -259,7 +259,7 @@ pub(crate) fn get_completion(
find_def(stmt, &schema_expr.name.get_end_pos(), prog_scope);
if let Some(schema) = schema_def {
match schema {
Definition::Object(obj) => {
Definition::Object(obj, _) => {
let schema_type = obj.ty.into_schema_type();
items.extend(
schema_type
Expand All @@ -271,7 +271,7 @@ pub(crate) fn get_completion(
.collect::<IndexSet<KCLCompletionItem>>(),
);
}
Definition::Scope(_) => {}
Definition::Scope(_, _) => {}
}
}
}
Expand Down
28 changes: 0 additions & 28 deletions kclvm/tools/src/LSP/src/find_ref/find_refs.rs

This file was deleted.

6 changes: 0 additions & 6 deletions kclvm/tools/src/LSP/src/find_ref/go_to_def.rs

This file was deleted.

134 changes: 0 additions & 134 deletions kclvm/tools/src/LSP/src/find_ref/mod.rs

This file was deleted.

10 changes: 0 additions & 10 deletions kclvm/tools/src/LSP/src/find_ref/test_data/inherit.k

This file was deleted.

4 changes: 0 additions & 4 deletions kclvm/tools/src/LSP/src/find_ref/test_data/inherit_pkg.k

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading
Loading