fix: don't panic on bad node range

This commit is contained in:
Myriad-Dreamin 2024-03-08 21:13:22 +08:00
parent 4abde9de2e
commit 964def25a9
13 changed files with 51 additions and 92 deletions

View file

@ -13,8 +13,7 @@ impl SignatureHelpRequest {
position_encoding: PositionEncoding,
) -> Option<SignatureHelp> {
let source = get_suitable_source_in_workspace(world, &self.path).ok()?;
let typst_offset =
lsp_to_typst::position_to_offset(self.position, position_encoding, &source);
let typst_offset = lsp_to_typst::position(self.position, position_encoding, &source)?;
let ast_node = LinkedNode::new(source.root()).leaf_at(typst_offset)?;
let (callee, callee_node, args) = surrounding_function_syntax(&ast_node)?;