Skip to content

Commit 80f7182

Browse files
committed
update hint goto
1 parent 2f427f7 commit 80f7182

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

crates/emmylua_ls/src/handlers/definition/goto_function.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ use emmylua_code_analysis::{
55
use emmylua_parser::{
66
LuaAstNode, LuaCallExpr, LuaExpr, LuaLiteralToken, LuaSyntaxToken, LuaTokenKind,
77
};
8+
use lsp_types::GotoDefinitionResponse;
89
use rowan::{NodeOrToken, TokenAtOffset};
910
use std::sync::Arc;
1011

@@ -302,3 +303,12 @@ pub fn compare_function_types(
302303
Some(call_function == func.as_ref())
303304
}
304305
}
306+
307+
pub fn goto_overload_function(
308+
semantic_model: &SemanticModel,
309+
trigger_token: &LuaSyntaxToken,
310+
) -> Option<GotoDefinitionResponse> {
311+
let document = semantic_model.get_document_by_file_id(semantic_model.get_file_id())?;
312+
let location = document.to_lsp_location(trigger_token.text_range())?;
313+
Some(GotoDefinitionResponse::Scalar(location))
314+
}

crates/emmylua_ls/src/handlers/definition/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ use tokio_util::sync::CancellationToken;
2323

2424
use super::RegisterCapabilities;
2525
use crate::context::ServerContextSnapshot;
26+
use crate::handlers::definition::goto_function::goto_overload_function;
2627
use crate::handlers::definition::goto_path::goto_path;
2728
use crate::util::find_ref_at;
2829

@@ -116,6 +117,8 @@ pub fn definition(
116117
)?;
117118

118119
return goto_path(&semantic_model, &analysis.compilation, &path, &token);
120+
} else if token.kind() == LuaTokenKind::TkTagOverload.into() {
121+
return goto_overload_function(&semantic_model, &token);
119122
}
120123

121124
None

crates/emmylua_ls/src/handlers/inlay_hint/build_inlay_hint.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,7 @@ fn set_meta_call_part(
550550
("new".to_string(), call_expr.get_range(), Some(true))
551551
} else {
552552
(
553-
"".to_string(),
553+
":call".to_string(),
554554
call_expr.get_prefix_expr()?.get_range(),
555555
None,
556556
)

0 commit comments

Comments
 (0)