Skip to content

Commit

Permalink
minor fix
Browse files Browse the repository at this point in the history
Signed-off-by: xiarui.xr <[email protected]>
  • Loading branch information
amyXia1994 committed Oct 12, 2023
1 parent 864baec commit a736fef
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
19 changes: 11 additions & 8 deletions kclvm/tools/src/LSP/src/goto_def.rs
Original file line number Diff line number Diff line change
Expand Up @@ -302,14 +302,17 @@ pub(crate) fn resolve_var(
let ty = get_system_member_function_ty(&name, &func_name);
match &ty.kind {
kclvm_sema::ty::TypeKind::Function(func_ty) => {
return Some(Definition::Object(ScopeObject {
name: func_name.clone(),
start: func_name_node.get_pos(),
end: func_name_node.get_end_pos(),
ty: ty.clone(),
kind: ScopeObjectKind::FunctionCall,
doc: Some(func_ty.doc.clone()),
}, func_name))
return Some(Definition::Object(
ScopeObject {
name: func_name.clone(),
start: func_name_node.get_pos(),
end: func_name_node.get_end_pos(),
ty: ty.clone(),
kind: ScopeObjectKind::FunctionCall,
doc: Some(func_ty.doc.clone()),
},
func_name,
))
}
_ => return None,
}
Expand Down
1 change: 0 additions & 1 deletion kclvm/tools/src/LSP/src/request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ impl LanguageServerState {
state.shutdown_requested = true;
Ok(())
})?
// .on::<lsp_types::request::Initialize>(handle_initialize)?
.on::<lsp_types::request::GotoDefinition>(handle_goto_definition)?
.on::<lsp_types::request::References>(handle_reference)?
.on::<lsp_types::request::Completion>(handle_completion)?
Expand Down
2 changes: 1 addition & 1 deletion kclvm/tools/src/LSP/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -754,7 +754,7 @@ pub fn build_word_index(path: String) -> anyhow::Result<HashMap<String, Vec<Loca
// str path to url
if let Ok(url) = Url::from_file_path(file_path) {
// read file content and save the word to word index
let text = read_file(file_path).unwrap();
let text = read_file(file_path)?;
let lines: Vec<&str> = text.lines().collect();
for (li, line) in lines.into_iter().enumerate() {
let words = line_to_words(line.to_string());
Expand Down

0 comments on commit a736fef

Please sign in to comment.