-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(lsp): pass client_info on initialization
Pass client name ('helix') and client version (version / git hash) to LSP server on initialization.
- Loading branch information
Showing
2 changed files
with
26 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
use std::borrow::Cow; | ||
use std::process::Command; | ||
|
||
const VERSION: &str = include_str!("../VERSION"); | ||
|
||
fn main() { | ||
let git_hash = Command::new("git") | ||
.args(["rev-parse", "HEAD"]) | ||
.output() | ||
.ok() | ||
.filter(|output| output.status.success()) | ||
.and_then(|x| String::from_utf8(x.stdout).ok()); | ||
|
||
let version: Cow<_> = match git_hash { | ||
Some(git_hash) => format!("{} ({})", VERSION, &git_hash[..8]).into(), | ||
None => VERSION.into(), | ||
}; | ||
|
||
println!("cargo:rerun-if-changed=../VERSION"); | ||
|
||
println!("cargo:rustc-env=VERSION_AND_GIT_HASH={}", version); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters