mirror of
https://github.com/Myriad-Dreamin/tinymist.git
synced 2025-08-04 10:18:16 +00:00
feat: add command to profile the entire server (#1438)
* feat: declare and bind tinymist.profileServer command * feat: editor bridge with the frontend * feat: start and stop server profiling * feat: add profile-server prototype (#1440) * Add profile-server prototype * fix: use branch --------- Co-authored-by: Myriad-Dreamin <camiyoru@gmail.com> * feat: make it good * build: update cargo.lock * dev: ls profile impl and hook * test: update snapshot --------- Co-authored-by: Derived Cat <hooyuser@outlook.com>
This commit is contained in:
parent
890ecd93a5
commit
d6d3766b6f
43 changed files with 858 additions and 298 deletions
|
@ -281,6 +281,33 @@ impl fmt::Debug for Resolving {
|
|||
}
|
||||
}
|
||||
|
||||
impl fmt::Display for Resolving {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
use WorkspaceResolution::*;
|
||||
let Some(id) = self.id else {
|
||||
return write!(f, "unresolved-path");
|
||||
};
|
||||
|
||||
let path = match WorkspaceResolver::resolve(id) {
|
||||
Ok(Workspace(workspace)) => id.vpath().resolve(&workspace.path()),
|
||||
Ok(UntitledRooted(..)) => Some(id.vpath().as_rootless_path().to_owned()),
|
||||
Ok(Rootless | Package) | Err(_) => None,
|
||||
};
|
||||
|
||||
if let Some(path) = path {
|
||||
write!(f, "{}", path.display())
|
||||
} else {
|
||||
let pkg = id.package();
|
||||
match pkg {
|
||||
Some(pkg) => {
|
||||
write!(f, "{pkg}{}", id.vpath().as_rooted_path().display())
|
||||
}
|
||||
None => write!(f, "{}", id.vpath().as_rooted_path().display()),
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue