Skip to content

Commit c2b44cf

Browse files
committed
chore: support both names
1 parent c136f2e commit c2b44cf

File tree

41 files changed

+323
-197
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+323
-197
lines changed

.github/workflows/release.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@ jobs:
8989
# Strip all debug symbols from the resulting binaries
9090
RUSTFLAGS: "-C strip=symbols -C codegen-units=1"
9191
# Inline the version in the CLI binary
92+
PGLS_VERSION: ${{ needs.extract_version.outputs.version }}
93+
# Inline the version in the CLI binary (deprecated)
9294
PGT_VERSION: ${{ needs.extract_version.outputs.version }}
9395

9496
# windows is a special snowflake too, it saves binaries as .exe

CLAUDE.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,11 @@ just new-crate <name>
6262
```
6363

6464
### CLI Usage
65-
The main CLI binary is `postgrestools`:
65+
The main CLI binary is `postgres-language-server`:
6666
```bash
6767
cargo run -p pgt_cli -- check file.sql
6868
# or after building:
69-
./target/release/postgrestools check file.sql
69+
./target/release/postgres-language-server check file.sql
7070
```
7171

7272
## Architecture
@@ -76,7 +76,7 @@ The project uses a modular Rust workspace with crates prefixed with `pgt_`:
7676

7777
**Core Infrastructure:**
7878
- `pgt_workspace` - Main API and workspace management
79-
- `pgt_lsp` - Language Server Protocol implementation
79+
- `pgt_lsp` - Language Server Protocol implementation
8080
- `pgt_cli` - Command-line interface
8181
- `pgt_fs` - Virtual file system abstraction
8282
- `pgt_configuration` - Configuration management
@@ -103,8 +103,8 @@ The project uses a modular Rust workspace with crates prefixed with `pgt_`:
103103
### TypeScript Packages
104104
Located in `packages/` and `editors/`:
105105
- VSCode extension in `editors/code/`
106-
- Backend JSON-RPC bridge in `packages/@postgrestools/backend-jsonrpc/`
107-
- Main TypeScript package in `packages/@postgrestools/postgrestools/`
106+
- Backend JSON-RPC bridge in `packages/@postgres-language-server/backend-jsonrpc/`
107+
- Main TypeScript package in `packages/@postgres-language-server/postgres-language-server/`
108108

109109
### Database Integration
110110
The server connects to a Postgres database to build an in-memory schema cache containing tables, columns, functions, and type information. This enables accurate autocompletion and type checking.
@@ -132,7 +132,7 @@ cargo insta review
132132

133133
### Rust Configuration
134134
- `Cargo.toml` - Workspace definition with all crate dependencies
135-
- `rust-toolchain.toml` - Rust version specification
135+
- `rust-toolchain.toml` - Rust version specification
136136
- `rustfmt.toml` - Code formatting configuration
137137
- `clippy.toml` - Clippy linting configuration
138138

@@ -150,6 +150,6 @@ Many parser structures are generated from PostgreSQL's protobuf definitions usin
150150
### Database Schema
151151
The `pgt_schema_cache` crate contains SQL queries in `src/queries/` that introspect the database schema to build the in-memory cache.
152152

153-
### Multi-Platform Support
153+
### Multi-Platform Support
154154
The project includes platform-specific allocators and build configurations for Windows, macOS, and Linux.
155-
- Seeing the Treesitter tree for an SQL query can be helpful to debug and implement features. To do this, create a file with an SQL query, and run `just tree-print <file.sql>`.
155+
- Seeing the Treesitter tree for an SQL query can be helpful to debug and implement features. To do this, create a file with an SQL query, and run `just tree-print <file.sql>`.

crates/pgt_analyse/src/options.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ impl AnalyserRules {
4545
/// A set of information useful to the analyser infrastructure
4646
#[derive(Debug, Default)]
4747
pub struct AnalyserOptions {
48-
/// A data structured derived from the [`postgrestools.jsonc`] file
48+
/// A data structured derived from the [`postgres-language-server.jsonc`] file
4949
pub rules: AnalyserRules,
5050
}
5151

crates/pgt_analyser/CONTRIBUTING.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ Let's assume that the rule we implement support the following options:
8181
- `threshold`: an integer between 0 and 255;
8282
- `behaviorExceptions`: an array of strings.
8383

84-
We would like to set the options in the `postgrestools.jsonc` configuration file:
84+
We would like to set the options in the `postgres-language-server.jsonc` configuration file:
8585

8686
```json
8787
{
@@ -143,9 +143,9 @@ We currently require implementing _serde_'s traits `Deserialize`/`Serialize`.
143143

144144
Also, we use other `serde` macros to adjust the JSON configuration:
145145

146-
- `rename_all = "camelCase"`: it renames all fields in camel-case, so they are in line with the naming style of the `postgrestools.jsonc`.
146+
- `rename_all = "camelCase"`: it renames all fields in camel-case, so they are in line with the naming style of the `postgres-language-server.jsonc`.
147147
- `deny_unknown_fields`: it raises an error if the configuration contains extraneous fields.
148-
- `default`: it uses the `Default` value when the field is missing from `postgrestools.jsonc`. This macro makes the field optional.
148+
- `default`: it uses the `Default` value when the field is missing from `postgres-language-server.jsonc`. This macro makes the field optional.
149149

150150
You can simply use a derive macros:
151151

crates/pgt_cli/src/cli_options.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ pub struct CliOptions {
2222
#[bpaf(long("verbose"), switch, fallback(false))]
2323
pub verbose: bool,
2424

25-
/// Set the file path to the configuration file, or the directory path to find `postgrestools.jsonc`.
25+
/// Set the file path to the configuration file, or the directory path to find
26+
/// `postgres-language-server.jsonc`.
2627
/// If used, it disables the default configuration file resolution.
2728
#[bpaf(long("config-path"), argument("PATH"), optional)]
2829
pub config_path: Option<String>,
@@ -58,6 +59,7 @@ pub struct CliOptions {
5859

5960
#[bpaf(
6061
env("PGT_LOG_LEVEL"),
62+
env("PGLS_LOG_LEVEL"),
6163
long("log-level"),
6264
argument("none|debug|info|warn|error"),
6365
fallback(LoggingLevel::default()),
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
use crate::commands::daemon::default_pgt_log_path;
1+
use crate::commands::daemon::default_pgls_log_path;
22
use crate::{CliDiagnostic, CliSession};
3-
use pgt_flags::pgt_env;
3+
use pgt_flags::pgls_env;
44
use std::fs::{create_dir, remove_dir_all};
55
use std::path::PathBuf;
66

77
/// Runs the clean command
88
pub fn clean(_cli_session: CliSession) -> Result<(), CliDiagnostic> {
9-
let logs_path = pgt_env()
9+
let logs_path = pgls_env()
1010
.pgt_log_path
1111
.value()
12-
.map_or(default_pgt_log_path(), PathBuf::from);
12+
.map_or(default_pgls_log_path(), PathBuf::from);
1313
remove_dir_all(logs_path.clone()).and_then(|_| create_dir(logs_path))?;
1414
Ok(())
1515
}

crates/pgt_cli/src/commands/daemon.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -233,15 +233,15 @@ fn setup_tracing_subscriber(
233233
}
234234
}
235235

236-
pub fn default_pgt_log_path() -> PathBuf {
237-
match env::var_os("PGT_LOG_PATH") {
236+
pub fn default_pgls_log_path() -> PathBuf {
237+
match env::var_os("PGLS_LOG_PATH") {
238238
Some(directory) => PathBuf::from(directory),
239-
None => pgt_fs::ensure_cache_dir().join("pgt-logs"),
239+
None => pgt_fs::ensure_cache_dir().join("pgls-logs"),
240240
}
241241
}
242242

243243
/// Tracing Filter with two rules:
244-
/// For all crates starting with pgt*, use `PGT_LOG_LEVEL` or CLI option or "info" as default
244+
/// For all crates starting with pgt*, use `PGLS_LOG_LEVEL` or CLI option or "info" as default
245245
/// For all other crates, use "info"
246246
struct PgtLoggingFilter(LevelFilter);
247247

crates/pgt_cli/src/commands/init.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ pub(crate) fn init(mut session: CliSession) -> Result<(), CliDiagnostic> {
88
let fs = &mut session.app.fs;
99
let config = &mut PartialConfiguration::init();
1010
create_config(fs, config)?;
11-
let file_created = ConfigName::pgt_jsonc();
11+
let file_created = ConfigName::pgls_jsonc();
1212
session.app.console.log(markup! {
1313
"
14-
Welcome to the Postgres Language Tools! Let's get you started...
14+
Welcome to the Postgres Language Server! Let's get you started...
1515
1616
"<Info><Emphasis>"Files created "</Emphasis></Info>"
1717

crates/pgt_cli/src/commands/mod.rs

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ pub enum PgtCommand {
5858
changed: bool,
5959

6060
/// Use this to specify the base branch to compare against when you're using the --changed
61-
/// flag and the `defaultBranch` is not set in your `postgrestools.jsonc`
61+
/// flag and the `defaultBranch` is not set in your `postgres-language-server.jsonc`
6262
#[bpaf(long("since"), argument("REF"))]
6363
since: Option<String>,
6464

@@ -73,6 +73,7 @@ pub enum PgtCommand {
7373
/// Allows to change the prefix applied to the file name of the logs.
7474
#[bpaf(
7575
env("PGT_LOG_PREFIX_NAME"),
76+
env("PGLS_LOG_PREFIX_NAME"),
7677
long("log-prefix-name"),
7778
argument("STRING"),
7879
hide_usage,
@@ -84,15 +85,21 @@ pub enum PgtCommand {
8485
/// Allows to change the folder where logs are stored.
8586
#[bpaf(
8687
env("PGT_LOG_PATH"),
88+
env("PGLS_LOG_PATH"),
8789
long("log-path"),
8890
argument("PATH"),
8991
hide_usage,
9092
fallback(pgt_fs::ensure_cache_dir().join("pgt-logs")),
9193
)]
9294
log_path: PathBuf,
9395
/// Allows to set a custom file path to the configuration file,
94-
/// or a custom directory path to find `postgrestools.jsonc`
95-
#[bpaf(env("PGT_LOG_PREFIX_NAME"), long("config-path"), argument("PATH"))]
96+
/// or a custom directory path to find `postgres-language-server.jsonc`
97+
#[bpaf(
98+
env("PGT_LOG_PREFIX_NAME"),
99+
env("PGLS_LOG_PREFIX_NAME"),
100+
long("config-path"),
101+
argument("PATH")
102+
)]
96103
config_path: Option<PathBuf>,
97104
},
98105

@@ -110,6 +117,7 @@ pub enum PgtCommand {
110117
/// Allows to change the prefix applied to the file name of the logs.
111118
#[bpaf(
112119
env("PGT_LOG_PREFIX_NAME"),
120+
env("PGLS_LOG_PREFIX_NAME"),
113121
long("log-prefix-name"),
114122
argument("STRING"),
115123
hide_usage,
@@ -120,15 +128,21 @@ pub enum PgtCommand {
120128
/// Allows to change the folder where logs are stored.
121129
#[bpaf(
122130
env("PGT_LOG_PATH"),
131+
env("PGLS_LOG_PATH"),
123132
long("log-path"),
124133
argument("PATH"),
125134
hide_usage,
126135
fallback(pgt_fs::ensure_cache_dir().join("pgt-logs")),
127136
)]
128137
log_path: PathBuf,
129138
/// Allows to set a custom file path to the configuration file,
130-
/// or a custom directory path to find `postgrestools.jsonc`
131-
#[bpaf(env("PGT_CONFIG_PATH"), long("config-path"), argument("PATH"))]
139+
/// or a custom directory path to find `postgres-language-server.jsonc`
140+
#[bpaf(
141+
env("PGT_CONFIG_PATH"),
142+
env("PGLS_CONFIG_PATH"),
143+
long("config-path"),
144+
argument("PATH")
145+
)]
132146
config_path: Option<PathBuf>,
133147
/// Bogus argument to make the command work with vscode-languageclient
134148
#[bpaf(long("stdio"), hide, hide_usage, switch)]
@@ -144,6 +158,7 @@ pub enum PgtCommand {
144158
/// Allows to change the prefix applied to the file name of the logs.
145159
#[bpaf(
146160
env("PGT_LOG_PREFIX_NAME"),
161+
env("PGLS_LOG_PREFIX_NAME"),
147162
long("log-prefix-name"),
148163
argument("STRING"),
149164
hide_usage,
@@ -155,6 +170,7 @@ pub enum PgtCommand {
155170
/// Allows to change the folder where logs are stored.
156171
#[bpaf(
157172
env("PGT_LOG_PATH"),
173+
env("PGLS_LOG_PATH"),
158174
long("log-path"),
159175
argument("PATH"),
160176
hide_usage,
@@ -165,6 +181,7 @@ pub enum PgtCommand {
165181
/// Allows to change the log level. Default is debug. This will only affect "pgt*" crates. All others are logged with info level.
166182
#[bpaf(
167183
env("PGT_LOG_LEVEL"),
184+
env("PGLS_LOG_LEVEL"),
168185
long("log-level"),
169186
argument("trace|debug|info|warn|error|none"),
170187
fallback(String::from("debug"))
@@ -174,6 +191,7 @@ pub enum PgtCommand {
174191
/// Allows to change the logging format kind. Default is hierarchical.
175192
#[bpaf(
176193
env("PGT_LOG_KIND"),
194+
env("PGLS_LOG_KIND"),
177195
long("log-kind"),
178196
argument("hierarchical|bunyan"),
179197
fallback(String::from("hierarchical"))
@@ -183,8 +201,13 @@ pub enum PgtCommand {
183201
#[bpaf(long("stop-on-disconnect"), hide_usage)]
184202
stop_on_disconnect: bool,
185203
/// Allows to set a custom file path to the configuration file,
186-
/// or a custom directory path to find `postgrestools.jsonc`
187-
#[bpaf(env("PGT_CONFIG_PATH"), long("config-path"), argument("PATH"))]
204+
/// or a custom directory path to find `postgres-language-server.jsonc`
205+
#[bpaf(
206+
env("PGT_CONFIG_PATH"),
207+
env("PGLS_CONFIG_PATH"),
208+
long("config-path"),
209+
argument("PATH")
210+
)]
188211
config_path: Option<PathBuf>,
189212
},
190213
#[bpaf(command("__print_socket"), hide)]

crates/pgt_cli/src/diagnostics.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ fn command_name() -> String {
1111
current_exe()
1212
.ok()
1313
.and_then(|path| Some(path.file_name()?.to_str()?.to_string()))
14-
.unwrap_or_else(|| String::from("postgrestools"))
14+
.unwrap_or_else(|| String::from("postgres-language-server"))
1515
}
1616

1717
/// A diagnostic that is emitted when running Postgres Tools via CLI.
@@ -47,7 +47,7 @@ pub enum CliDiagnostic {
4747
IoError(IoDiagnostic),
4848
/// The daemon is not running
4949
ServerNotRunning(ServerNotRunning),
50-
/// The end configuration (`postgrestools.jsonc` + other options) is incompatible with the command
50+
/// The end configuration (`postgres-language-server.jsonc` + other options) is incompatible with the command
5151
IncompatibleEndConfiguration(IncompatibleEndConfiguration),
5252
/// No files processed during the file system traversal
5353
NoFilesWereProcessed(NoFilesWereProcessed),
@@ -390,7 +390,7 @@ impl CliDiagnostic {
390390
Self::ServerNotRunning(ServerNotRunning)
391391
}
392392

393-
/// Emitted when the end configuration (`postgrestools.jsonc` file + CLI arguments + LSP configuration)
393+
/// Emitted when the end configuration (`postgres-language-server.jsonc` file + CLI arguments + LSP configuration)
394394
/// results in a combination of options that doesn't allow to run the command correctly.
395395
///
396396
/// A reason needs to be provided

0 commit comments

Comments
 (0)