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,5 +1,7 @@
|
|||
//! <https://github.com/rust-lang/rust-analyzer/blob/master/docs/dev/lsp-extensions.md#on-enter>
|
||||
|
||||
use typst_shim::syntax::LinkedNodeExt;
|
||||
|
||||
use crate::{prelude::*, SyntaxRequest};
|
||||
|
||||
/// The [`experimental/onEnter`] request is sent from client to server to handle
|
||||
|
|
@ -32,7 +34,7 @@ impl SyntaxRequest for OnEnterRequest {
|
|||
) -> Option<Self::Response> {
|
||||
let root = LinkedNode::new(source.root());
|
||||
let cursor = lsp_to_typst::position(self.position, position_encoding, source)?;
|
||||
let leaf = root.leaf_at(cursor)?;
|
||||
let leaf = root.leaf_at_compat(cursor)?;
|
||||
|
||||
let worker = OnEnterWorker {
|
||||
source,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue