mirror of
https://github.com/Myriad-Dreamin/tinymist.git
synced 2025-07-24 13:13:43 +00:00
dev: collect server information for summary (#162)
* dev: collect server information for summary * dev: humanize font variant to show * fix: let focus state correct
This commit is contained in:
parent
6722b2501f
commit
703c8b4c1d
13 changed files with 467 additions and 46 deletions
|
@ -113,6 +113,7 @@ pub trait StatefulRequest {
|
|||
mod polymorphic {
|
||||
use lsp_types::TextEdit;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use typst::foundations::Dict;
|
||||
|
||||
use super::prelude::*;
|
||||
use super::*;
|
||||
|
@ -161,6 +162,19 @@ mod polymorphic {
|
|||
pub path: PathBuf,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct ServerInfoRequest {}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct ServerInfoReponse {
|
||||
pub root: Option<PathBuf>,
|
||||
#[serde(rename = "fontPaths")]
|
||||
pub font_paths: Vec<PathBuf>,
|
||||
pub inputs: Dict,
|
||||
#[serde(rename = "estimatedMemoryUsage")]
|
||||
pub estimated_memory_usage: HashMap<String, usize>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
||||
pub enum FoldRequestFeature {
|
||||
PinnedFirst,
|
||||
|
@ -192,6 +206,7 @@ mod polymorphic {
|
|||
SelectionRange(SelectionRangeRequest),
|
||||
|
||||
DocumentMetrics(DocumentMetricsRequest),
|
||||
ServerInfo(ServerInfoRequest),
|
||||
}
|
||||
|
||||
impl CompilerQueryRequest {
|
||||
|
@ -219,6 +234,7 @@ mod polymorphic {
|
|||
CompilerQueryRequest::SelectionRange(..) => ContextFreeUnique,
|
||||
|
||||
CompilerQueryRequest::DocumentMetrics(..) => PinnedFirst,
|
||||
CompilerQueryRequest::ServerInfo(..) => Mergable,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -245,6 +261,7 @@ mod polymorphic {
|
|||
CompilerQueryRequest::SelectionRange(req) => &req.path,
|
||||
|
||||
CompilerQueryRequest::DocumentMetrics(req) => &req.path,
|
||||
CompilerQueryRequest::ServerInfo(..) => return None,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -272,6 +289,7 @@ mod polymorphic {
|
|||
SelectionRange(Option<Vec<SelectionRange>>),
|
||||
|
||||
DocumentMetrics(Option<DocumentMetricsResponse>),
|
||||
ServerInfo(Option<HashMap<String, ServerInfoReponse>>),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue