mirror of
https://github.com/Myriad-Dreamin/tinymist.git
synced 2025-11-24 13:10:07 +00:00
refactor: add compatibility for typst_syntax::LinkedNode.leaf_at (#582)
* refactor: add compatibility for `typst_syntax::LinkedNode.leaf_at` * feat: `LinkedNodeExt` trait with `leaf_at_compat`
This commit is contained in:
parent
ffa12bc2c9
commit
ce107efc7e
23 changed files with 86 additions and 28 deletions
|
|
@ -1,3 +1,5 @@
|
|||
use typst_shim::syntax::LinkedNodeExt;
|
||||
|
||||
use crate::{prelude::*, SyntaxRequest};
|
||||
|
||||
/// The [`textDocument/selectionRange`] request is sent from the client to the
|
||||
|
|
@ -34,7 +36,7 @@ impl SyntaxRequest for SelectionRangeRequest {
|
|||
for position in self.positions {
|
||||
let typst_offset = lsp_to_typst::position(position, position_encoding, source)?;
|
||||
let tree = LinkedNode::new(source.root());
|
||||
let leaf = tree.leaf_at(typst_offset + 1)?;
|
||||
let leaf = tree.leaf_at_compat(typst_offset + 1)?;
|
||||
ranges.push(range_for_node(source, position_encoding, &leaf));
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue