feat: print version information when starting lsp server (#614)

This commit is contained in:
Myriad-Dreamin 2024-09-28 16:39:45 +08:00 committed by GitHub
parent f3ccb4a186
commit 58ff9ab846
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 14 additions and 1 deletions

View file

@ -21,5 +21,11 @@ fn main() -> Result<()> {
.expect("Typst should be a dependency");
println!("cargo:rustc-env=TYPST_VERSION={}", typst.version);
let src = typst
.source
.as_ref()
.map(|e| e.repr.as_str())
.unwrap_or_default();
println!("cargo:rustc-env=TYPST_SOURCE={src}");
Ok(())
}

View file

@ -141,6 +141,7 @@ Commit Date: {}
Commit Branch: {}
Cargo Target Triple: {}
Typst Version: {}
Typst Source: {}
",
env!("VERGEN_BUILD_TIMESTAMP"),
env!("VERGEN_GIT_DESCRIBE"),
@ -149,5 +150,6 @@ Typst Version: {}
option_env!("VERGEN_GIT_BRANCH").unwrap_or("None"),
env!("VERGEN_CARGO_TARGET_TRIPLE"),
env!("TYPST_VERSION"),
env!("TYPST_SOURCE"),
)
});

View file

@ -93,7 +93,12 @@ pub fn completion(args: ShellCompletionArgs) -> anyhow::Result<()> {
/// The main entry point for the LSP server.
pub fn lsp_main(args: LspArgs) -> anyhow::Result<()> {
log::info!("starting LSP server: {:#?}", args);
let pairs = LONG_VERSION.trim().split('\n');
let pairs = pairs
.map(|e| e.splitn(2, ":").map(|e| e.trim()).collect::<Vec<_>>())
.collect::<Vec<_>>();
log::info!("tinymist LSP version information: {pairs:?}");
log::info!("starting LSP server: {args:#?}");
let is_replay = !args.mirror.replay.is_empty();
with_stdio_transport(args.mirror.clone(), |conn| {