Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/codegen/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ pub mod rules_docs;
pub mod rules_index;
pub mod rules_sources;
pub mod schema;
pub mod version;

mod utils;
2 changes: 2 additions & 0 deletions docs/codegen/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand All @@ -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(())
}
17 changes: 17 additions & 0 deletions docs/codegen/src/version.rs
Original file line number Diff line number Diff line change
@@ -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(())
}
10 changes: 9 additions & 1 deletion docs/getting_started.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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/0.0.0/schema.json`.

## Usage

Expand Down