Skip to content

Commit 0ae6ab8

Browse files
authored
Merge branch 'main' into feat/eugene-rules
2 parents 77def76 + 0993ff3 commit 0ae6ab8

File tree

48 files changed

+2633
-119
lines changed

Some content is hidden

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

48 files changed

+2633
-119
lines changed

.github/workflows/publish.reusable.yml

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,23 @@ jobs:
3333
exit 1
3434
fi
3535
36+
- name: Generate Packages (deprecated)
37+
id: generate-packages-deprecated
38+
run: node packages/@postgrestools/postgrestools/scripts/generate-packages.mjs
39+
env:
40+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
41+
RELEASE_TAG: ${{ inputs.release-tag }}
42+
PRERELEASE: ${{ inputs.is-prerelease }}
43+
3644
- name: Generate Packages
3745
id: generate-packages
38-
run: node packages/@postgrestools/postgrestools/scripts/generate-packages.mjs
46+
run: node packages/@postgres-language-server/cli/scripts/generate-packages.mjs
3947
env:
4048
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4149
RELEASE_TAG: ${{ inputs.release-tag }}
4250
PRERELEASE: ${{ inputs.is-prerelease }}
4351

44-
- name: Publish npm packages as nightly
52+
- name: Publish npm packages as nightly (deprecated)
4553
if: inputs.is-prerelease == 'true'
4654
run: |
4755
for package in packages/@postgrestools/*; do
@@ -50,7 +58,16 @@ jobs:
5058
env:
5159
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} #
5260

53-
- name: Publish npm packages as latest
61+
- name: Publish npm packages as nightly
62+
if: inputs.is-prerelease == 'true'
63+
run: |
64+
for package in packages/@postgres-language-server/*; do
65+
npm publish "$package" --tag nightly --access public --provenance
66+
done
67+
env:
68+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} #
69+
70+
- name: Publish npm packages as latest (deprecated)
5471
if: inputs.is-prerelease != 'true'
5572
run: |
5673
for package in packages/@postgrestools/*; do
@@ -66,3 +83,20 @@ jobs:
6683
done
6784
env:
6885
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
86+
87+
- name: Publish npm packages as latest
88+
if: inputs.is-prerelease != 'true'
89+
run: |
90+
for package in packages/@postgres-language-server/*; do
91+
version="${{ inputs.release-tag }}"
92+
npm_package_name=$(jq -r ".name" "$package/package.json")
93+
94+
if npm view "$npm_package_name@$version" version 2>/dev/null; then
95+
echo "Package $npm_package_name@$version already exists, skipping..."
96+
else
97+
echo "Publishing $npm_package_name@$version..."
98+
npm publish "$package" --tag latest --access public --provenance
99+
fi
100+
done
101+
env:
102+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.github/workflows/release.yml

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,6 @@ jobs:
4747

4848
runs-on: ${{ matrix.config.os }}
4949

50-
outputs:
51-
artifact_url: ${{ steps.upload-artifacts.outputs.artifact-url }}
52-
5350
steps:
5451
- uses: actions/checkout@v4
5552
with:
@@ -96,17 +93,22 @@ jobs:
9693
if: matrix.config.os == 'windows-2022'
9794
run: |
9895
mkdir dist
96+
# deprecated
9997
cp target/${{ matrix.config.target }}/release/postgrestools.exe ./dist/postgrestools_${{ matrix.config.target }}
98+
cp target/${{ matrix.config.target }}/release/postgres-language-server.exe ./dist/postgres-language-server_${{ matrix.config.target }}
99+
100100
- name: 👦 Name the Binary
101101
if: matrix.config.os != 'windows-2022'
102102
run: |
103103
mkdir dist
104+
# deprecated
104105
cp target/${{ matrix.config.target }}/release/postgrestools ./dist/postgrestools_${{ matrix.config.target }}
106+
cp target/${{ matrix.config.target }}/release/postgres-language-server ./dist/postgres-language-server_${{ matrix.config.target }}
105107
106108
# It is not possible to return the artifacts from the matrix jobs individually: Matrix outputs overwrite each other.
107109
# A common workaround is to upload and download the resulting artifacts.
108-
- name: 👆 Upload Artifacts
109-
id: upload-artifacts
110+
- name: 👆 Upload Artifacts (deprecated)
111+
id: upload-artifacts-deprecated
110112
uses: actions/upload-artifact@v4
111113
with:
112114
name: postgrestools_${{ matrix.config.target }}
@@ -117,6 +119,20 @@ jobs:
117119
compression-level: 2
118120
if-no-files-found: error
119121

122+
# It is not possible to return the artifacts from the matrix jobs individually: Matrix outputs overwrite each other.
123+
# A common workaround is to upload and download the resulting artifacts.
124+
- name: 👆 Upload Artifacts
125+
id: upload-artifacts
126+
uses: actions/upload-artifact@v4
127+
with:
128+
name: postgres-language-server_${{ matrix.config.target }}
129+
path: ./dist/postgres-language-server_*
130+
# The default compression level is 6; this took the binary down from 350 to 330MB.
131+
# It is recommended to use a lower level for binaries, since the compressed result is not much smaller,
132+
# and the higher levels of compression take much longer.
133+
compression-level: 2
134+
if-no-files-found: error
135+
120136
create_changelog_and_release:
121137
runs-on: ubuntu-latest
122138
needs: [extract_version, build_and_test] # make sure that tests & build work correctly
@@ -142,12 +158,19 @@ jobs:
142158
echo "Tag does not match: ${{ steps.create_changelog.outputs.version }} vs ${{ needs.extract_version.outputs.version }}"
143159
exit 1
144160
161+
- name: 👇 Download Artifacts (deprecated)
162+
uses: actions/download-artifact@v4
163+
id: download-deprecated
164+
with:
165+
merge-multiple: true
166+
pattern: postgrestools_*
167+
145168
- name: 👇 Download Artifacts
146169
uses: actions/download-artifact@v4
147170
id: download
148171
with:
149172
merge-multiple: true
150-
pattern: postgrestools_*
173+
pattern: postgres-language-server_*
151174

152175
- name: 📂 Create Release
153176
uses: softprops/action-gh-release@v2

crates/pgt_cli/Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,7 @@ doctest = false
6161
[[bin]]
6262
name = "postgrestools"
6363
path = "src/main.rs"
64+
65+
[[bin]]
66+
name = "postgres-language-server"
67+
path = "src/main.rs"

crates/pgt_cli/src/commands/clean.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
use crate::commands::daemon::default_pgt_log_path;
22
use crate::{CliDiagnostic, CliSession};
3-
use pgt_env::pgt_env;
3+
use pgt_env::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()
1212
.map_or(default_pgt_log_path(), PathBuf::from);

crates/pgt_cli/src/commands/daemon.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use crate::{
55
use pgt_console::{ConsoleExt, markup};
66
use pgt_lsp::ServerFactory;
77
use pgt_workspace::{TransportError, WorkspaceError, workspace::WorkspaceClient};
8-
use std::{env, path::PathBuf};
8+
use std::path::PathBuf;
99
use tokio::io;
1010
use tokio::runtime::Runtime;
1111
use tracing::subscriber::Interest;
@@ -234,7 +234,12 @@ fn setup_tracing_subscriber(
234234
}
235235

236236
pub fn default_pgt_log_path() -> PathBuf {
237-
match env::var_os("PGT_LOG_PATH") {
237+
let env = pgt_env::pgls_env();
238+
match env
239+
.pgls_log_path
240+
.value()
241+
.or_else(|| env.pgt_log_path.value())
242+
{
238243
Some(directory) => PathBuf::from(directory),
239244
None => pgt_fs::ensure_cache_dir().join("pgt-logs"),
240245
}

crates/pgt_cli/src/commands/mod.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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,6 +85,7 @@ 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,
@@ -115,6 +117,7 @@ pub enum PgtCommand {
115117
/// Allows to change the prefix applied to the file name of the logs.
116118
#[bpaf(
117119
env("PGT_LOG_PREFIX_NAME"),
120+
env("PGLS_LOG_PREFIX_NAME"),
118121
long("log-prefix-name"),
119122
argument("STRING"),
120123
hide_usage,
@@ -125,6 +128,7 @@ pub enum PgtCommand {
125128
/// Allows to change the folder where logs are stored.
126129
#[bpaf(
127130
env("PGT_LOG_PATH"),
131+
env("PGLS_LOG_PATH"),
128132
long("log-path"),
129133
argument("PATH"),
130134
hide_usage,
@@ -154,6 +158,7 @@ pub enum PgtCommand {
154158
/// Allows to change the prefix applied to the file name of the logs.
155159
#[bpaf(
156160
env("PGT_LOG_PREFIX_NAME"),
161+
env("PGLS_LOG_PREFIX_NAME"),
157162
long("log-prefix-name"),
158163
argument("STRING"),
159164
hide_usage,
@@ -165,6 +170,7 @@ pub enum PgtCommand {
165170
/// Allows to change the folder where logs are stored.
166171
#[bpaf(
167172
env("PGT_LOG_PATH"),
173+
env("PGLS_LOG_PATH"),
168174
long("log-path"),
169175
argument("PATH"),
170176
hide_usage,
@@ -175,6 +181,7 @@ pub enum PgtCommand {
175181
/// Allows to change the log level. Default is debug. This will only affect "pgt*" crates. All others are logged with info level.
176182
#[bpaf(
177183
env("PGT_LOG_LEVEL"),
184+
env("PGLS_LOG_LEVEL"),
178185
long("log-level"),
179186
argument("trace|debug|info|warn|error|none"),
180187
fallback(String::from("debug"))
@@ -184,6 +191,7 @@ pub enum PgtCommand {
184191
/// Allows to change the logging format kind. Default is hierarchical.
185192
#[bpaf(
186193
env("PGT_LOG_KIND"),
194+
env("PGLS_LOG_KIND"),
187195
long("log-kind"),
188196
argument("hierarchical|bunyan"),
189197
fallback(String::from("hierarchical"))

crates/pgt_completions/src/relevance/filtering.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ impl CompletionFilter<'_> {
163163
// only autocomplete left side of binary expression
164164
WrappingClause::Where => {
165165
ctx.before_cursor_matches_kind(&["keyword_and", "keyword_where"])
166-
|| (ctx.before_cursor_matches_kind(&["."])
166+
|| (ctx.before_cursor_matches_kind(&["field_qualifier"])
167167
&& ctx.matches_ancestor_history(&["field"]))
168168
}
169169

crates/pgt_configuration/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ use files::{FilesConfiguration, PartialFilesConfiguration, partial_files_configu
3333
use migrations::{
3434
MigrationsConfiguration, PartialMigrationsConfiguration, partial_migrations_configuration,
3535
};
36-
use pgt_env::PGT_WEBSITE;
36+
use pgt_env::PGLS_WEBSITE;
3737
use plpgsql_check::{
3838
PartialPlPgSqlCheckConfiguration, PlPgSqlCheckConfiguration,
3939
partial_pl_pg_sql_check_configuration,
@@ -103,7 +103,7 @@ impl PartialConfiguration {
103103
/// Returns the initial configuration.
104104
pub fn init() -> Self {
105105
Self {
106-
schema: Some(format!("{}/schemas/{VERSION}/schema.json", PGT_WEBSITE)),
106+
schema: Some(format!("{}/schemas/{VERSION}/schema.json", PGLS_WEBSITE)),
107107
extends: Some(StringSet::default()),
108108
files: Some(PartialFilesConfiguration {
109109
ignore: Some(Default::default()),

0 commit comments

Comments
 (0)