Skip to content

Commit c5d2412

Browse files
committed
progress
1 parent a072fe1 commit c5d2412

File tree

18 files changed

+92
-59
lines changed

18 files changed

+92
-59
lines changed

.vscode/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"postgrestools.bin": "./target/debug/postgrestools"
2+
"postgres-language-server.bin": "./target/debug/postgres-language-server"
33
}

AGENTS.md

Lines changed: 4 additions & 4 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` (legacy name: `postgrestools`):
6666
```bash
6767
cargo run -p pgls_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
@@ -103,8 +103,8 @@ The project uses a modular Rust workspace with crates prefixed with `pgls_`:
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/` (legacy: `packages/@postgrestools/backend-jsonrpc/`)
107+
- Main TypeScript package in `packages/@postgres-language-server/postgres-language-server/` (legacy: `packages/@postgrestools/postgrestools/`)
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.

crates/pgls_cli/src/commands/mod.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ pub(crate) mod version;
1919
#[bpaf(options, version(VERSION))]
2020
#[allow(clippy::large_enum_variant)]
2121
/// Postgres Tools official CLI. Use it to check the health of your project or run it to check single files.
22-
pub enum PgtCommand {
22+
pub enum PgLSCommand {
2323
/// Shows the version information and quit.
2424
#[bpaf(command)]
2525
Version(#[bpaf(external(cli_options), hide_usage)] CliOptions),
@@ -218,19 +218,19 @@ pub enum PgtCommand {
218218
PrintSocket,
219219
}
220220

221-
impl PgtCommand {
221+
impl PgLSCommand {
222222
const fn cli_options(&self) -> Option<&CliOptions> {
223223
match self {
224-
PgtCommand::Version(cli_options)
225-
| PgtCommand::Check { cli_options, .. }
226-
| PgtCommand::Dblint { cli_options, .. } => Some(cli_options),
227-
PgtCommand::LspProxy { .. }
228-
| PgtCommand::Start { .. }
229-
| PgtCommand::Stop
230-
| PgtCommand::Init
231-
| PgtCommand::RunServer { .. }
232-
| PgtCommand::Clean
233-
| PgtCommand::PrintSocket => None,
224+
PgLSCommand::Version(cli_options)
225+
| PgLSCommand::Check { cli_options, .. }
226+
| PgLSCommand::Dblint { cli_options, .. } => Some(cli_options),
227+
PgLSCommand::LspProxy { .. }
228+
| PgLSCommand::Start { .. }
229+
| PgLSCommand::Stop
230+
| PgLSCommand::Init
231+
| PgLSCommand::RunServer { .. }
232+
| PgLSCommand::Clean
233+
| PgLSCommand::PrintSocket => None,
234234
}
235235
}
236236

@@ -315,6 +315,6 @@ mod tests {
315315
/// Tests that all CLI options adhere to the invariants expected by `bpaf`.
316316
#[test]
317317
fn check_options() {
318-
pgt_command().check_invariants(false);
318+
pg_l_s_command().check_invariants(false);
319319
}
320320
}

crates/pgls_cli/src/lib.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ mod service;
2525
mod workspace;
2626

2727
use crate::cli_options::ColorsArg;
28-
pub use crate::commands::{PgtCommand, pgt_command};
28+
pub use crate::commands::{PgLSCommand, pg_l_s_command};
2929
pub use crate::logging::{LoggingLevel, setup_cli_subscriber};
3030
use crate::reporter::Report;
3131
pub use diagnostics::CliDiagnostic;
@@ -57,19 +57,19 @@ impl<'app> CliSession<'app> {
5757
}
5858

5959
/// Main function to run the CLI
60-
pub fn run(self, command: PgtCommand) -> Result<(), CliDiagnostic> {
60+
pub fn run(self, command: PgLSCommand) -> Result<(), CliDiagnostic> {
6161
let has_metrics = command.has_metrics();
6262
if has_metrics {
6363
crate::metrics::init_metrics();
6464
}
6565

6666
let result = match command {
67-
PgtCommand::Version(_) => commands::version::version(self),
68-
PgtCommand::Dblint {
67+
PgLSCommand::Version(_) => commands::version::version(self),
68+
PgLSCommand::Dblint {
6969
cli_options,
7070
configuration,
7171
} => commands::dblint::dblint(self, &cli_options, configuration),
72-
PgtCommand::Check {
72+
PgLSCommand::Check {
7373
cli_options,
7474
configuration,
7575
paths,
@@ -89,21 +89,21 @@ impl<'app> CliSession<'app> {
8989
since,
9090
},
9191
),
92-
PgtCommand::Clean => commands::clean::clean(self),
93-
PgtCommand::Start {
92+
PgLSCommand::Clean => commands::clean::clean(self),
93+
PgLSCommand::Start {
9494
config_path,
9595
log_path,
9696
log_prefix_name,
9797
} => commands::daemon::start(self, config_path, Some(log_path), Some(log_prefix_name)),
98-
PgtCommand::Stop => commands::daemon::stop(self),
99-
PgtCommand::Init => commands::init::init(self),
100-
PgtCommand::LspProxy {
98+
PgLSCommand::Stop => commands::daemon::stop(self),
99+
PgLSCommand::Init => commands::init::init(self),
100+
PgLSCommand::LspProxy {
101101
config_path,
102102
log_path,
103103
log_prefix_name,
104104
..
105105
} => commands::daemon::lsp_proxy(config_path, Some(log_path), Some(log_prefix_name)),
106-
PgtCommand::RunServer {
106+
PgLSCommand::RunServer {
107107
stop_on_disconnect,
108108
config_path,
109109
log_path,
@@ -118,7 +118,7 @@ impl<'app> CliSession<'app> {
118118
Some(log_level),
119119
Some(log_kind),
120120
),
121-
PgtCommand::PrintSocket => commands::daemon::print_socket(),
121+
PgLSCommand::PrintSocket => commands::daemon::print_socket(),
122122
};
123123

124124
if has_metrics {

crates/pgls_cli/src/main.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! This is the main binary
22
33
use pgls_cli::{
4-
CliDiagnostic, CliSession, PgtCommand, open_transport, pgt_command, setup_panic_handler,
4+
CliDiagnostic, CliSession, PgLSCommand, open_transport, pg_l_s_command, setup_panic_handler,
55
to_color_mode,
66
};
77
use pgls_console::{ConsoleExt, EnvConsole, markup};
@@ -31,7 +31,7 @@ fn main() -> ExitCode {
3131
set_bottom_frame(main as usize);
3232

3333
let mut console = EnvConsole::default();
34-
let command = pgt_command().fallback_to_usage().run();
34+
let command = pg_l_s_command().fallback_to_usage().run();
3535

3636
console.set_color(to_color_mode(command.get_color()));
3737

@@ -50,7 +50,7 @@ fn main() -> ExitCode {
5050
}
5151
}
5252

53-
fn run_workspace(console: &mut EnvConsole, command: PgtCommand) -> Result<(), CliDiagnostic> {
53+
fn run_workspace(console: &mut EnvConsole, command: PgLSCommand) -> Result<(), CliDiagnostic> {
5454
// If the `--use-server` CLI flag is set, try to open a connection to an
5555
// existing server socket
5656
let workspace = if command.should_use_server() {

crates/pgls_configuration/src/analyser/linter/rules.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ impl std::str::FromStr for RuleGroup {
4646
#[cfg_attr(feature = "schema", derive(JsonSchema))]
4747
#[serde(rename_all = "camelCase", deny_unknown_fields)]
4848
pub struct Rules {
49-
#[doc = r" It enables the lint rules recommended by Postgres Tools. `true` by default."]
49+
#[doc = r" It enables the lint rules recommended by Postgres Language Server. `true` by default."]
5050
#[serde(skip_serializing_if = "Option::is_none")]
5151
pub recommended: Option<bool>,
5252
#[doc = r" It enables ALL rules. The rules that belong to `nursery` won't be enabled."]

crates/pgls_fs/src/path.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ impl From<FileKind> for FileKinds {
8787
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
8888
pub struct PgLSPath {
8989
path: PathBuf,
90-
/// Determines the kind of the file inside Postgres Tools. Some files are considered as configuration files, others as manifest files, and others as files to handle
90+
/// Determines the kind of the file inside Postgres Language Server. Some files are considered as configuration files, others as manifest files, and others as files to handle
9191
kind: FileKinds,
9292
/// Whether this path (usually a file) was fixed as a result of a format/lint/check command with the `--write` filag.
9393
was_written: bool,

docs/codegen/src/cli_doc.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use pgls_cli::pgt_command;
1+
use pgls_cli::pg_l_s_command;
22
use std::{fs, path::Path};
33

44
use crate::utils;
@@ -11,7 +11,7 @@ pub fn generate_cli_doc(docs_dir: &Path) -> anyhow::Result<()> {
1111
let new_content = utils::replace_section(
1212
&content,
1313
"CLI_REF",
14-
&pgt_command().render_markdown("postgres-language-server"),
14+
&pg_l_s_command().render_markdown("postgres-language-server"),
1515
);
1616

1717
fs::write(file_path, &new_content)?;

docs/getting_started.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,14 @@ Run `postgres-language-server --help` for all options. The CLI options take prec
7171

7272
The Postgres Language Server is available as an extension in your favorite editors.
7373

74-
- VSCode: The language server is available on the [VSCode Marketplace](https://marketplace.visualstudio.com/items?itemName=Supabase.postgrestools). It's published from [this repo](https://github.com/supabase-community/postgrestools-vscode).
74+
- VSCode: The language server is available on the [VSCode Marketplace](https://marketplace.visualstudio.com/items?itemName=Supabase.postgrestools). It's published from [this repo](https://github.com/supabase-community/postgres-language-server-vscode).
7575
- Neovim: You will have to install `nvim-lspconfig`, and follow the [instructions](https://github.com/neovim/nvim-lspconfig/blob/master/doc/configs.md#postgres_lsp).
7676
- Emacs: The language client is available through [lsp-mode](https://github.com/emacs-lsp/lsp-mode). For more details, refer to their [manual page](https://emacs-lsp.github.io/lsp-mode/page/lsp-postgres/).
7777
- Zed: The language server is available as an Extension. It's published from [this repo](https://github.com/LoamStudios/zed-postgres-language-server).
7878

7979
### Continuous Integration
8080

81-
Run `postgres-language-server check` in your CI pipeline to lint your schema changes and enforce code quality across your team. We provide a [GitHub Action](https://github.com/supabase-community/postgrestools-cli-action) to setup the Postgres Language Server in your runner.
81+
Run `postgres-language-server check` in your CI pipeline to lint your schema changes and enforce code quality across your team. We provide a [GitHub Action](https://github.com/supabase-community/postgres-language-server-cli-action) to setup the Postgres Language Server in your runner.
8282

8383
See the [Continuous Integration](/guides/continuous_integration) guide for an example.
8484

docs/guides/continuous_integration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Running the Postgres Language Server in a CI environment can boost your teams co
44

55
### GitHub Actions
66

7-
We provide a first-party [GitHub Action](https://github.com/supabase-community/postgrestools-cli-action) to setup the CLI in your runner. Here's what a simple workflow might look like:
7+
We provide a first-party [GitHub Action](https://github.com/supabase-community/postgres-language-server-cli-action) to setup the CLI in your runner. Here's what a simple workflow might look like:
88

99
```yaml
1010
jobs:

0 commit comments

Comments
 (0)