mirror of
https://github.com/Myriad-Dreamin/tinymist.git
synced 2025-07-24 13:13:43 +00:00
fix: source switch on primary node
This commit is contained in:
parent
efe07c7b4a
commit
f6d473f320
3 changed files with 61 additions and 8 deletions
|
@ -1,6 +1,7 @@
|
|||
use std::{borrow::Cow, ops::Range};
|
||||
|
||||
use comemo::Prehashed;
|
||||
use log::debug;
|
||||
use tower_lsp::lsp_types::{InlayHintKind, InlayHintLabel};
|
||||
use typst::{
|
||||
foundations::{Args, Closure},
|
||||
|
@ -32,7 +33,15 @@ impl InlayHintRequest {
|
|||
);
|
||||
|
||||
let hints = inlay_hints(world, &source, range, position_encoding).ok()?;
|
||||
trace!("got inlay hints {hints:?}");
|
||||
debug!(
|
||||
"got inlay hints on {source:?} => {hints:?}",
|
||||
source = source.id(),
|
||||
hints = hints.len()
|
||||
);
|
||||
if hints.is_empty() {
|
||||
let root = LinkedNode::new(source.root());
|
||||
debug!("debug root {root:#?}");
|
||||
}
|
||||
|
||||
Some(hints)
|
||||
}
|
||||
|
|
|
@ -57,6 +57,24 @@ mod polymorphic {
|
|||
FoldingRange(FoldingRangeRequest),
|
||||
SelectionRange(SelectionRangeRequest),
|
||||
}
|
||||
impl CompilerQueryRequest {
|
||||
pub fn associated_path(&self) -> Option<&Path> {
|
||||
Some(match self {
|
||||
CompilerQueryRequest::OnSaveExport(req) => &req.path,
|
||||
CompilerQueryRequest::Hover(req) => &req.path,
|
||||
CompilerQueryRequest::GotoDefinition(req) => &req.path,
|
||||
CompilerQueryRequest::InlayHint(req) => &req.path,
|
||||
CompilerQueryRequest::Completion(req) => &req.path,
|
||||
CompilerQueryRequest::SignatureHelp(req) => &req.path,
|
||||
CompilerQueryRequest::DocumentSymbol(req) => &req.path,
|
||||
CompilerQueryRequest::Symbol(..) => return None,
|
||||
CompilerQueryRequest::SemanticTokensFull(req) => &req.path,
|
||||
CompilerQueryRequest::SemanticTokensDelta(req) => &req.path,
|
||||
CompilerQueryRequest::FoldingRange(req) => &req.path,
|
||||
CompilerQueryRequest::SelectionRange(req) => &req.path,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub enum CompilerQueryResponse {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue