From 55f3670b715e5833af67c18db9d7102f266d5b68 Mon Sep 17 00:00:00 2001 From: psteinroe Date: Mon, 17 Nov 2025 09:05:17 +0100 Subject: [PATCH 1/2] chore(docs): improve getting started --- docs/codegen/src/lib.rs | 1 + docs/codegen/src/main.rs | 2 ++ docs/codegen/src/version.rs | 17 +++++++++++++++++ docs/getting_started.md | 10 +++++++++- 4 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 docs/codegen/src/version.rs diff --git a/docs/codegen/src/lib.rs b/docs/codegen/src/lib.rs index df49d5424..1be6d0df0 100644 --- a/docs/codegen/src/lib.rs +++ b/docs/codegen/src/lib.rs @@ -5,5 +5,6 @@ pub mod rules_docs; pub mod rules_index; pub mod rules_sources; pub mod schema; +pub mod version; mod utils; diff --git a/docs/codegen/src/main.rs b/docs/codegen/src/main.rs index dfecbd533..98a63b310 100644 --- a/docs/codegen/src/main.rs +++ b/docs/codegen/src/main.rs @@ -8,6 +8,7 @@ use docs_codegen::rules_docs::generate_rules_docs; use docs_codegen::rules_index::generate_rules_index; use docs_codegen::rules_sources::generate_rule_sources; use docs_codegen::schema::generate_schema; +use docs_codegen::version::replace_version; fn docs_root() -> PathBuf { let dir = @@ -25,6 +26,7 @@ fn main() -> anyhow::Result<()> { generate_rules_index(&docs_root)?; generate_rule_sources(&docs_root)?; generate_schema(&docs_root)?; + replace_version(&docs_root)?; Ok(()) } diff --git a/docs/codegen/src/version.rs b/docs/codegen/src/version.rs new file mode 100644 index 000000000..26430cae2 --- /dev/null +++ b/docs/codegen/src/version.rs @@ -0,0 +1,17 @@ +use pgls_env::VERSION; +use std::{fs, path::Path}; + +use regex::Regex; + +pub fn replace_version(docs_dir: &Path) -> anyhow::Result<()> { + let index_path = docs_dir.join("getting_started.md"); + + let data = fs::read_to_string(&index_path)?; + + let version_pattern = Regex::new(r"\$\{PGLS_VERSION\}").unwrap(); + let new_data = version_pattern.replace_all(&data, VERSION); + + fs::write(&index_path, new_data.as_ref())?; + + Ok(()) +} diff --git a/docs/getting_started.md b/docs/getting_started.md index 6cd7b2b29..57b51fe9a 100644 --- a/docs/getting_started.md +++ b/docs/getting_started.md @@ -2,6 +2,14 @@ The Postgres Language Server can be installed as a development dependency of your project, a standalone executable, or as an extension of your favorite editor. +Install via your package manager if you use one: + +```sh +pnpm add -D -E @postgres-language-server/cli +``` + +Alternatively, most [editor integrations](/guides/ide_setup) will manage the installation for you, or you can install it as a [standalone executable](/manual_installation). + ## Configuration We recommend creating a `postgres-language-server.jsonc` configuration file for each project. This eliminates repetitive CLI options and ensures that consistent configuration in your editor. Some options are only available from a configuration file. This step is optional though: if you are happy with the defaults, you don’t need a configuration file. To create the `postgres-language-server.jsonc` file, run the `init` command in the root folder of your project: @@ -47,7 +55,7 @@ You’ll now have a `postgres-language-server.jsonc` file in your directory: Make sure to edit the database connection settings to connect to your local development database. To see all options, run `postgres-language-server --help`. -You can use your current `postgres-language-server` version instead of "latest" in the `$schema` URL, e.g. `https://pg-language-server.com/0.8.1/schema.json`. +You can use your current `postgres-language-server` version instead of "latest" in the `$schema` URL, e.g. `https://pg-language-server.com/${VERSION}/schema.json`. ## Usage From 2eb4c70d3547495efffe9c052d388df71fd029b6 Mon Sep 17 00:00:00 2001 From: psteinroe Date: Mon, 17 Nov 2025 09:11:05 +0100 Subject: [PATCH 2/2] fix: replace with version --- docs/getting_started.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/getting_started.md b/docs/getting_started.md index 57b51fe9a..48a91a3a1 100644 --- a/docs/getting_started.md +++ b/docs/getting_started.md @@ -55,7 +55,7 @@ You’ll now have a `postgres-language-server.jsonc` file in your directory: Make sure to edit the database connection settings to connect to your local development database. To see all options, run `postgres-language-server --help`. -You can use your current `postgres-language-server` version instead of "latest" in the `$schema` URL, e.g. `https://pg-language-server.com/${VERSION}/schema.json`. +You can use your current `postgres-language-server` version instead of "latest" in the `$schema` URL, e.g. `https://pg-language-server.com/0.0.0/schema.json`. ## Usage