Skip to content

Commit 7cda2b3

Browse files
authored
chore: rename cli to pglt (#201)
* chore: rename cli to pglt * chore: rename config file
1 parent 0a6a0b2 commit 7cda2b3

File tree

47 files changed

+256
-265
lines changed

Some content is hidden

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

47 files changed

+256
-265
lines changed

crates/pglt_analyse/src/categories.rs

+12-16
Original file line numberDiff line numberDiff line change
@@ -74,38 +74,34 @@ impl ActionCategory {
7474
match self {
7575
ActionCategory::QuickFix(tag) => {
7676
if tag.is_empty() {
77-
Cow::Borrowed("quickfix.pglsp")
77+
Cow::Borrowed("quickfix.pglt")
7878
} else {
79-
Cow::Owned(format!("quickfix.pglsp.{tag}"))
79+
Cow::Owned(format!("quickfix.pglt.{tag}"))
8080
}
8181
}
8282

83-
ActionCategory::Refactor(RefactorKind::None) => Cow::Borrowed("refactor.pglsp"),
83+
ActionCategory::Refactor(RefactorKind::None) => Cow::Borrowed("refactor.pglt"),
8484
ActionCategory::Refactor(RefactorKind::Extract) => {
85-
Cow::Borrowed("refactor.extract.pglsp")
86-
}
87-
ActionCategory::Refactor(RefactorKind::Inline) => {
88-
Cow::Borrowed("refactor.inline.pglsp")
85+
Cow::Borrowed("refactor.extract.pglt")
8986
}
87+
ActionCategory::Refactor(RefactorKind::Inline) => Cow::Borrowed("refactor.inline.pglt"),
9088
ActionCategory::Refactor(RefactorKind::Rewrite) => {
91-
Cow::Borrowed("refactor.rewrite.pglsp")
89+
Cow::Borrowed("refactor.rewrite.pglt")
9290
}
9391
ActionCategory::Refactor(RefactorKind::Other(tag)) => {
94-
Cow::Owned(format!("refactor.{tag}.pglsp"))
92+
Cow::Owned(format!("refactor.{tag}.pglt"))
9593
}
9694

97-
ActionCategory::Source(SourceActionKind::None) => Cow::Borrowed("source.pglsp"),
98-
ActionCategory::Source(SourceActionKind::FixAll) => {
99-
Cow::Borrowed("source.fixAll.pglsp")
100-
}
95+
ActionCategory::Source(SourceActionKind::None) => Cow::Borrowed("source.pglt"),
96+
ActionCategory::Source(SourceActionKind::FixAll) => Cow::Borrowed("source.fixAll.pglt"),
10197
ActionCategory::Source(SourceActionKind::OrganizeImports) => {
102-
Cow::Borrowed("source.organizeImports.pglsp")
98+
Cow::Borrowed("source.organizeImports.pglt")
10399
}
104100
ActionCategory::Source(SourceActionKind::Other(tag)) => {
105-
Cow::Owned(format!("source.{tag}.pglsp"))
101+
Cow::Owned(format!("source.{tag}.pglt"))
106102
}
107103

108-
ActionCategory::Other(tag) => Cow::Owned(format!("{tag}.pglsp")),
104+
ActionCategory::Other(tag) => Cow::Owned(format!("{tag}.pglt")),
109105
}
110106
}
111107
}

crates/pglt_analyse/src/options.rs

+1-1
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 [`pglsp.toml`] file
48+
/// A data structured derived from the [`pglt.toml`] file
4949
pub rules: AnalyserRules,
5050
}
5151

crates/pglt_analyser/CONTRIBUTING.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ Let's assume that the rule we implement support the following options:
7979
- `threshold`: an integer between 0 and 255;
8080
- `behaviorExceptions`: an array of strings.
8181

82-
We would like to set the options in the `pglsp.toml` configuration file:
82+
We would like to set the options in the `pglt.toml` configuration file:
8383

8484
```toml
8585
[linter.rules.safety.myRule]
@@ -132,9 +132,9 @@ We currently require implementing _serde_'s traits `Deserialize`/`Serialize`.
132132

133133
Also, we use other `serde` macros to adjust the JSON configuration:
134134

135-
- `rename_all = "snake_case"`: it renames all fields in camel-case, so they are in line with the naming style of the `pglsp.toml`.
135+
- `rename_all = "snake_case"`: it renames all fields in camel-case, so they are in line with the naming style of the `pglt.toml`.
136136
- `deny_unknown_fields`: it raises an error if the configuration contains extraneous fields.
137-
- `default`: it uses the `Default` value when the field is missing from `pglsp.toml`. This macro makes the field optional.
137+
- `default`: it uses the `Default` value when the field is missing from `pglt.toml`. This macro makes the field optional.
138138

139139
You can simply use a derive macros:
140140

crates/pglt_base_db/src/change.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -292,13 +292,13 @@ mod tests {
292292
use text_size::{TextRange, TextSize};
293293

294294
use crate::{change::Change, document::StatementRef, Document, DocumentChange};
295-
use pglt_fs::PgLspPath;
295+
use pglt_fs::PgLTPath;
296296

297297
#[test]
298298
fn test_document_apply_changes() {
299299
let input = "select id from users;\nselect * from contacts;";
300300

301-
let mut d = Document::new(PgLspPath::new("test.sql"), Some(input.to_string()));
301+
let mut d = Document::new(PgLTPath::new("test.sql"), Some(input.to_string()));
302302

303303
assert_eq!(d.statement_ranges.len(), 2);
304304

@@ -317,15 +317,15 @@ mod tests {
317317
assert_eq!(
318318
changed[0].statement().to_owned(),
319319
StatementRef {
320-
document_url: PgLspPath::new("test.sql"),
320+
document_url: PgLTPath::new("test.sql"),
321321
text: "select id from users;".to_string(),
322322
idx: 0
323323
}
324324
);
325325
assert_eq!(
326326
changed[1].statement().to_owned(),
327327
StatementRef {
328-
document_url: PgLspPath::new("test.sql"),
328+
document_url: PgLTPath::new("test.sql"),
329329
text: "select * from contacts;".to_string(),
330330
idx: 1
331331
}
@@ -350,7 +350,7 @@ mod tests {
350350
fn test_document_apply_changes_at_end_of_statement() {
351351
let input = "select id from\nselect * from contacts;";
352352

353-
let mut d = Document::new(PgLspPath::new("test.sql"), Some(input.to_string()));
353+
let mut d = Document::new(PgLTPath::new("test.sql"), Some(input.to_string()));
354354

355355
assert_eq!(d.statement_ranges.len(), 2);
356356

@@ -393,7 +393,7 @@ mod tests {
393393

394394
#[test]
395395
fn test_document_apply_changes_replacement() {
396-
let path = PgLspPath::new("test.sql");
396+
let path = PgLTPath::new("test.sql");
397397

398398
let mut doc = Document::new(path, None);
399399

@@ -508,7 +508,7 @@ mod tests {
508508
fn test_document_apply_changes_within_statement() {
509509
let input = "select id from users;\nselect * from contacts;";
510510

511-
let mut d = Document::new(PgLspPath::new("test.sql"), Some(input.to_string()));
511+
let mut d = Document::new(PgLTPath::new("test.sql"), Some(input.to_string()));
512512

513513
assert_eq!(d.statement_ranges.len(), 2);
514514

crates/pglt_base_db/src/document.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ use std::{hash::Hash, hash::Hasher, ops::RangeBounds};
33
use line_index::LineIndex;
44
use text_size::{TextRange, TextSize};
55

6-
use pglt_fs::PgLspPath;
6+
use pglt_fs::PgLTPath;
77

88
extern crate test;
99

1010
/// Represents a sql source file, and contains a list of statements represented by their ranges
1111
pub struct Document {
1212
/// The url of the document
13-
pub url: PgLspPath,
13+
pub url: PgLTPath,
1414
/// The text of the document
1515
pub text: String,
1616
/// The version of the document
@@ -33,15 +33,15 @@ impl Hash for Document {
3333
/// Note that the ref must include all information needed to uniquely identify the statement, so that it can be used as a key in a hashmap.
3434
#[derive(Debug, Hash, PartialEq, Eq, Clone)]
3535
pub struct StatementRef {
36-
pub document_url: PgLspPath,
36+
pub document_url: PgLTPath,
3737
// TODO use string interner for text
3838
pub text: String,
3939
pub idx: usize,
4040
}
4141

4242
impl Document {
4343
/// Create a new document
44-
pub fn new(url: PgLspPath, text: Option<String>) -> Document {
44+
pub fn new(url: PgLTPath, text: Option<String>) -> Document {
4545
Document {
4646
version: 0,
4747
line_index: LineIndex::new(text.as_ref().unwrap_or(&"".to_string())),
@@ -162,14 +162,14 @@ impl Document {
162162
#[cfg(test)]
163163
mod tests {
164164

165-
use pglt_fs::PgLspPath;
165+
use pglt_fs::PgLTPath;
166166
use text_size::{TextRange, TextSize};
167167

168168
use crate::Document;
169169

170170
#[test]
171171
fn test_statements_at_range() {
172-
let url = PgLspPath::new("test.sql");
172+
let url = PgLTPath::new("test.sql");
173173

174174
let doc = Document::new(
175175
url,

crates/pglt_cli/src/cli_options.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ pub struct CliOptions {
2626
#[bpaf(long("verbose"), switch, fallback(false))]
2727
pub verbose: bool,
2828

29-
/// Set the file path to the configuration file, or the directory path to find `pglsp.toml`.
29+
/// Set the file path to the configuration file, or the directory path to find `pglt.toml`.
3030
/// If used, it disables the default configuration file resolution.
3131
#[bpaf(long("config-path"), argument("PATH"), optional)]
3232
pub config_path: Option<String>,

crates/pglt_cli/src/commands/clean.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
use crate::commands::daemon::default_pglsp_log_path;
1+
use crate::commands::daemon::default_pglt_log_path;
22
use crate::{CliDiagnostic, CliSession};
3-
use pglt_flags::pglsp_env;
3+
use pglt_flags::pglt_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 = pglsp_env()
10-
.pglsp_log_path
9+
let logs_path = pglt_env()
10+
.pglt_log_path
1111
.value()
12-
.map_or(default_pglsp_log_path(), PathBuf::from);
12+
.map_or(default_pglt_log_path(), PathBuf::from);
1313
remove_dir_all(logs_path.clone()).and_then(|_| create_dir(logs_path))?;
1414
Ok(())
1515
}

crates/pglt_cli/src/commands/daemon.rs

+10-10
Original file line numberDiff line numberDiff line change
@@ -176,9 +176,9 @@ pub(crate) fn read_most_recent_log_file(
176176
log_path: Option<PathBuf>,
177177
log_file_name_prefix: String,
178178
) -> io::Result<Option<String>> {
179-
let pglsp_log_path = log_path.unwrap_or(default_pglsp_log_path());
179+
let pglt_log_path = log_path.unwrap_or(default_pglt_log_path());
180180

181-
let most_recent = fs::read_dir(pglsp_log_path)?
181+
let most_recent = fs::read_dir(pglt_log_path)?
182182
.flatten()
183183
.filter(|file| file.file_type().is_ok_and(|ty| ty.is_file()))
184184
.filter_map(|file| {
@@ -203,16 +203,16 @@ pub(crate) fn read_most_recent_log_file(
203203
/// The events received by the subscriber are filtered at the `info` level,
204204
/// then printed using the [HierarchicalLayer] layer, and the resulting text
205205
/// is written to log files rotated on a hourly basis (in
206-
/// `pglsp-logs/server.log.yyyy-MM-dd-HH` files inside the system temporary
206+
/// `pglt-logs/server.log.yyyy-MM-dd-HH` files inside the system temporary
207207
/// directory)
208208
fn setup_tracing_subscriber(log_path: Option<PathBuf>, log_file_name_prefix: Option<String>) {
209-
let pglsp_log_path = log_path.unwrap_or(pglt_fs::ensure_cache_dir().join("pglsp-logs"));
209+
let pglt_log_path = log_path.unwrap_or(pglt_fs::ensure_cache_dir().join("pglt-logs"));
210210
let appender_builder = tracing_appender::rolling::RollingFileAppender::builder();
211211
let file_appender = appender_builder
212212
.filename_prefix(log_file_name_prefix.unwrap_or(String::from("server.log")))
213213
.max_log_files(7)
214214
.rotation(Rotation::HOURLY)
215-
.build(pglsp_log_path)
215+
.build(pglt_log_path)
216216
.expect("Failed to start the logger for the daemon.");
217217

218218
registry()
@@ -229,19 +229,19 @@ fn setup_tracing_subscriber(log_path: Option<PathBuf>, log_file_name_prefix: Opt
229229
.init();
230230
}
231231

232-
pub fn default_pglsp_log_path() -> PathBuf {
232+
pub fn default_pglt_log_path() -> PathBuf {
233233
match env::var_os("PGLSP_LOG_PATH") {
234234
Some(directory) => PathBuf::from(directory),
235-
None => pglt_fs::ensure_cache_dir().join("pglsp-logs"),
235+
None => pglt_fs::ensure_cache_dir().join("pglt-logs"),
236236
}
237237
}
238238

239239
/// Tracing filter enabling:
240240
/// - All spans and events at level info or higher
241-
/// - All spans and events at level debug in crates whose name starts with `pglsp`
241+
/// - All spans and events at level debug in crates whose name starts with `pglt`
242242
struct LoggingFilter;
243243

244-
/// Tracing filter used for spans emitted by `pglsp*` crates
244+
/// Tracing filter used for spans emitted by `pglt*` crates
245245
const SELF_FILTER: LevelFilter = if cfg!(debug_assertions) {
246246
LevelFilter::TRACE
247247
} else {
@@ -250,7 +250,7 @@ const SELF_FILTER: LevelFilter = if cfg!(debug_assertions) {
250250

251251
impl LoggingFilter {
252252
fn is_enabled(&self, meta: &Metadata<'_>) -> bool {
253-
let filter = if meta.target().starts_with("pglsp") {
253+
let filter = if meta.target().starts_with("pglt") {
254254
SELF_FILTER
255255
} else {
256256
LevelFilter::INFO

crates/pglt_cli/src/commands/init.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use pglt_workspace::configuration::create_config;
77
pub(crate) fn init(mut session: CliSession) -> Result<(), CliDiagnostic> {
88
let fs = &mut session.app.fs;
99
create_config(fs, PartialConfiguration::init())?;
10-
let file_created = ConfigName::pglsp_toml();
10+
let file_created = ConfigName::pglt_toml();
1111
session.app.console.log(markup! {
1212
"
1313
Welcome to the Postgres Language Server! Let's get you started...

crates/pglt_cli/src/commands/mod.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ pub(crate) mod version;
2424

2525
#[derive(Debug, Clone, Bpaf)]
2626
#[bpaf(options, version(VERSION))]
27-
/// PgLsp official CLI. Use it to check the health of your project or run it to check single files.
27+
/// PgLT official CLI. Use it to check the health of your project or run it to check single files.
2828
pub enum PgltCommand {
2929
/// Shows the version information and quit.
3030
#[bpaf(command)]
@@ -58,7 +58,7 @@ pub enum PgltCommand {
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 `pglsp.toml`
61+
/// flag and the `defaultBranch` is not set in your `pglt.toml`
6262
#[bpaf(long("since"), argument("REF"))]
6363
since: Option<String>,
6464

@@ -87,11 +87,11 @@ pub enum PgltCommand {
8787
long("log-path"),
8888
argument("PATH"),
8989
hide_usage,
90-
fallback(pglt_fs::ensure_cache_dir().join("pglsp-logs")),
90+
fallback(pglt_fs::ensure_cache_dir().join("pglt-logs")),
9191
)]
9292
log_path: PathBuf,
9393
/// Allows to set a custom file path to the configuration file,
94-
/// or a custom directory path to find `pglsp.toml`
94+
/// or a custom directory path to find `pglt.toml`
9595
#[bpaf(env("PGLSP_LOG_PREFIX_NAME"), long("config-path"), argument("PATH"))]
9696
config_path: Option<PathBuf>,
9797
},
@@ -123,11 +123,11 @@ pub enum PgltCommand {
123123
long("log-path"),
124124
argument("PATH"),
125125
hide_usage,
126-
fallback(pglt_fs::ensure_cache_dir().join("pglsp-logs")),
126+
fallback(pglt_fs::ensure_cache_dir().join("pglt-logs")),
127127
)]
128128
log_path: PathBuf,
129129
/// Allows to set a custom file path to the configuration file,
130-
/// or a custom directory path to find `pglsp.toml`
130+
/// or a custom directory path to find `pglt.toml`
131131
#[bpaf(env("PGLSP_CONFIG_PATH"), long("config-path"), argument("PATH"))]
132132
config_path: Option<PathBuf>,
133133
/// Bogus argument to make the command work with vscode-languageclient
@@ -157,14 +157,14 @@ pub enum PgltCommand {
157157
long("log-path"),
158158
argument("PATH"),
159159
hide_usage,
160-
fallback(pglt_fs::ensure_cache_dir().join("pglsp-logs")),
160+
fallback(pglt_fs::ensure_cache_dir().join("pglt-logs")),
161161
)]
162162
log_path: PathBuf,
163163

164164
#[bpaf(long("stop-on-disconnect"), hide_usage)]
165165
stop_on_disconnect: bool,
166166
/// Allows to set a custom file path to the configuration file,
167-
/// or a custom directory path to find `pglsp.toml`
167+
/// or a custom directory path to find `pglt.toml`
168168
#[bpaf(env("PGLSP_CONFIG_PATH"), long("config-path"), argument("PATH"))]
169169
config_path: Option<PathBuf>,
170170
},
@@ -197,7 +197,7 @@ impl PgltCommand {
197197
}
198198
// We want force colors in CI, to give e better UX experience
199199
// Unless users explicitly set the colors flag
200-
// if matches!(self, PgLspCommand::Ci { .. }) && cli_options.colors.is_none() {
200+
// if matches!(self, PgLTCommand::Ci { .. }) && cli_options.colors.is_none() {
201201
// return Some(&ColorsArg::Force);
202202
// }
203203
// Normal behaviors

0 commit comments

Comments
 (0)