Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 9 additions & 10 deletions crates/pgt_env/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,22 @@
use pgt_console::fmt::{Display, Formatter};
use pgt_console::{DebugDisplay, KeyValuePair, markup};
use std::env;
use std::sync::{LazyLock, OnceLock};
use std::sync::OnceLock;

/// Returns `true` if this is an unstable build of Postgres Language Server
pub fn is_unstable() -> bool {
VERSION == "0.0.0"
}

/// The internal version of Postgres Language Server. This is usually supplied during the CI build
pub static PGLS_VERSION: LazyLock<Option<&str>> =
LazyLock::new(|| option_env!("PGLS_VERSION").or(option_env!("PGT_VERSION")));

/// The version of Postgres Tools with fallback logic
pub const VERSION: &str = match option_env!("PGT_VERSION") {
/// The version of Postgres Language Server. This is usually supplied during the CI build.
pub const VERSION: &str = match option_env!("PGLS_VERSION") {
Some(version) => version,
None => match option_env!("CARGO_PKG_VERSION") {
Some(pkg_version) => pkg_version,
None => "0.0.0",
None => match option_env!("PGT_VERSION") {
Some(version) => version,
None => match option_env!("CARGO_PKG_VERSION") {
Some(pkg_version) => pkg_version,
None => "0.0.0",
},
},
};

Expand Down