Skip to content

Commit f6ade61

Browse files
committed
progress
1 parent 226451c commit f6ade61

File tree

13 files changed

+50
-49
lines changed

13 files changed

+50
-49
lines changed

crates/pgls_analyse/src/categories.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -91,34 +91,34 @@ impl ActionCategory {
9191
match self {
9292
ActionCategory::QuickFix(tag) => {
9393
if tag.is_empty() {
94-
Cow::Borrowed("quickfix.pgt")
94+
Cow::Borrowed("quickfix.pgls")
9595
} else {
96-
Cow::Owned(format!("quickfix.pgt.{tag}"))
96+
Cow::Owned(format!("quickfix.pgls.{tag}"))
9797
}
9898
}
9999

100-
ActionCategory::Refactor(RefactorKind::None) => Cow::Borrowed("refactor.pgt"),
100+
ActionCategory::Refactor(RefactorKind::None) => Cow::Borrowed("refactor.pgls"),
101101
ActionCategory::Refactor(RefactorKind::Extract) => {
102-
Cow::Borrowed("refactor.extract.pgt")
102+
Cow::Borrowed("refactor.extract.pgls")
103103
}
104-
ActionCategory::Refactor(RefactorKind::Inline) => Cow::Borrowed("refactor.inline.pgt"),
104+
ActionCategory::Refactor(RefactorKind::Inline) => Cow::Borrowed("refactor.inline.pgls"),
105105
ActionCategory::Refactor(RefactorKind::Rewrite) => {
106-
Cow::Borrowed("refactor.rewrite.pgt")
106+
Cow::Borrowed("refactor.rewrite.pgls")
107107
}
108108
ActionCategory::Refactor(RefactorKind::Other(tag)) => {
109-
Cow::Owned(format!("refactor.{tag}.pgt"))
109+
Cow::Owned(format!("refactor.{tag}.pgls"))
110110
}
111111

112-
ActionCategory::Source(SourceActionKind::None) => Cow::Borrowed("source.pgt"),
113-
ActionCategory::Source(SourceActionKind::FixAll) => Cow::Borrowed("source.fixAll.pgt"),
112+
ActionCategory::Source(SourceActionKind::None) => Cow::Borrowed("source.pgls"),
113+
ActionCategory::Source(SourceActionKind::FixAll) => Cow::Borrowed("source.fixAll.pgls"),
114114
ActionCategory::Source(SourceActionKind::OrganizeImports) => {
115-
Cow::Borrowed("source.organizeImports.pgt")
115+
Cow::Borrowed("source.organizeImports.pgls")
116116
}
117117
ActionCategory::Source(SourceActionKind::Other(tag)) => {
118-
Cow::Owned(format!("source.{tag}.pgt"))
118+
Cow::Owned(format!("source.{tag}.pgls"))
119119
}
120120

121-
ActionCategory::Other(tag) => Cow::Owned(format!("{tag}.pgt")),
121+
ActionCategory::Other(tag) => Cow::Owned(format!("{tag}.pgls")),
122122
}
123123
}
124124
}

crates/pgls_cli/src/cli_options.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ pub struct CliOptions {
5858

5959
#[bpaf(
6060
env("PGT_LOG_LEVEL"),
61+
env("PGLS_LOG_LEVEL"),
6162
long("log-level"),
6263
argument("none|debug|info|warn|error"),
6364
fallback(LoggingLevel::default()),

crates/pgls_cli/src/commands/daemon.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -181,15 +181,15 @@ async fn start_lsp_proxy(
181181
/// The events received by the subscriber are filtered at the `info` level,
182182
/// then printed using the [HierarchicalLayer] layer, and the resulting text
183183
/// is written to log files rotated on a hourly basis (in
184-
/// `pgt-logs/server.log.yyyy-MM-dd-HH` files inside the system temporary
184+
/// `pgls-logs/server.log.yyyy-MM-dd-HH` files inside the system temporary
185185
/// directory)
186186
fn setup_tracing_subscriber(
187187
log_path: Option<PathBuf>,
188188
log_file_name_prefix: Option<String>,
189189
log_level: Option<String>,
190190
log_kind: Option<String>,
191191
) {
192-
let pgls_log_path = log_path.unwrap_or(pgls_fs::ensure_cache_dir().join("pgt-logs"));
192+
let pgls_log_path = log_path.unwrap_or(pgls_fs::ensure_cache_dir().join("pgls-logs"));
193193

194194
let appender_builder = tracing_appender::rolling::RollingFileAppender::builder();
195195

@@ -200,7 +200,7 @@ fn setup_tracing_subscriber(
200200
.build(pgls_log_path)
201201
.expect("Failed to start the logger for the daemon.");
202202

203-
let filter = PgtLoggingFilter::from(log_level);
203+
let filter = PgLSLoggingFilter::from(log_level);
204204

205205
let log_kind = log_kind.unwrap_or("hierarchical".into());
206206

@@ -241,16 +241,16 @@ pub fn default_pgls_log_path() -> PathBuf {
241241
.or_else(|| env.pgls_log_path.value())
242242
{
243243
Some(directory) => PathBuf::from(directory),
244-
None => pgls_fs::ensure_cache_dir().join("pgt-logs"),
244+
None => pgls_fs::ensure_cache_dir().join("pgls-logs"),
245245
}
246246
}
247247

248248
/// Tracing Filter with two rules:
249-
/// For all crates starting with pgt*, use `PGT_LOG_LEVEL` or CLI option or "info" as default
249+
/// For all crates starting with pgls*, use `PGLS_LOG_LEVEL` or CLI option or "info" as default
250250
/// For all other crates, use "info"
251-
struct PgtLoggingFilter(LevelFilter);
251+
struct PgLSLoggingFilter(LevelFilter);
252252

253-
impl From<Option<String>> for PgtLoggingFilter {
253+
impl From<Option<String>> for PgLSLoggingFilter {
254254
fn from(value: Option<String>) -> Self {
255255
Self(
256256
value
@@ -269,9 +269,9 @@ impl From<Option<String>> for PgtLoggingFilter {
269269
}
270270
}
271271

272-
impl PgtLoggingFilter {
272+
impl PgLSLoggingFilter {
273273
fn is_enabled(&self, meta: &Metadata<'_>) -> bool {
274-
let filter = if meta.target().starts_with("pgt") {
274+
let filter = if meta.target().starts_with("pgls") {
275275
self.0
276276
} else {
277277
LevelFilter::INFO
@@ -281,7 +281,7 @@ impl PgtLoggingFilter {
281281
}
282282
}
283283

284-
impl<S> Filter<S> for PgtLoggingFilter {
284+
impl<S> Filter<S> for PgLSLoggingFilter {
285285
fn enabled(&self, meta: &Metadata<'_>, _cx: &Context<'_, S>) -> bool {
286286
self.is_enabled(meta)
287287
}

crates/pgls_cli/src/commands/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ pub enum PgLSCommand {
9393
long("log-path"),
9494
argument("PATH"),
9595
hide_usage,
96-
fallback(pgls_fs::ensure_cache_dir().join("pgt-logs")),
96+
fallback(pgls_fs::ensure_cache_dir().join("pgls-logs")),
9797
)]
9898
log_path: PathBuf,
9999
/// Allows to set a custom file path to the configuration file,
@@ -136,7 +136,7 @@ pub enum PgLSCommand {
136136
long("log-path"),
137137
argument("PATH"),
138138
hide_usage,
139-
fallback(pgls_fs::ensure_cache_dir().join("pgt-logs")),
139+
fallback(pgls_fs::ensure_cache_dir().join("pgls-logs")),
140140
)]
141141
log_path: PathBuf,
142142
/// Allows to set a custom file path to the configuration file,
@@ -178,11 +178,11 @@ pub enum PgLSCommand {
178178
long("log-path"),
179179
argument("PATH"),
180180
hide_usage,
181-
fallback(pgls_fs::ensure_cache_dir().join("pgt-logs")),
181+
fallback(pgls_fs::ensure_cache_dir().join("pgls-logs")),
182182
)]
183183
log_path: PathBuf,
184184

185-
/// Allows to change the log level. Default is debug. This will only affect "pgt*" crates. All others are logged with info level.
185+
/// Allows to change the log level. Default is debug. This will only affect "pgls*" crates. All others are logged with info level.
186186
#[bpaf(
187187
env("PGT_LOG_LEVEL"),
188188
env("PGLS_LOG_LEVEL"),

crates/pgls_cli/src/execute/walk.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ pub(crate) fn traverse(
5959

6060
let (duration, evaluated_paths, diagnostics) = thread::scope(|s| {
6161
let handler = thread::Builder::new()
62-
.name(String::from("pgt::console"))
62+
.name(String::from("pgls::console"))
6363
.spawn_scoped(s, || printer.run(receiver, recv_files))
6464
.expect("failed to spawn console thread");
6565

@@ -121,7 +121,7 @@ fn init_thread_pool() {
121121
static INIT_ONCE: Once = Once::new();
122122
INIT_ONCE.call_once(|| {
123123
rayon::ThreadPoolBuilder::new()
124-
.thread_name(|index| format!("pgt::worker_{index}"))
124+
.thread_name(|index| format!("pgls::worker_{index}"))
125125
.build_global()
126126
.expect("failed to initialize the global thread pool");
127127
});

crates/pgls_cli/src/logging.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,12 @@ impl Display for LoggingLevel {
9292

9393
/// Tracing filter enabling:
9494
/// - All spans and events at level info or higher
95-
/// - All spans and events at level debug in crates whose name starts with `pgt`
95+
/// - All spans and events at level debug in crates whose name starts with `pgls`
9696
struct LoggingFilter {
9797
level: LoggingLevel,
9898
}
9999

100-
/// Tracing filter used for spans emitted by `pgt*` crates
100+
/// Tracing filter used for spans emitted by `pgls*` crates
101101
const SELF_FILTER: LevelFilter = if cfg!(debug_assertions) {
102102
LevelFilter::TRACE
103103
} else {
@@ -106,7 +106,7 @@ const SELF_FILTER: LevelFilter = if cfg!(debug_assertions) {
106106

107107
impl LoggingFilter {
108108
fn is_enabled(&self, meta: &Metadata<'_>) -> bool {
109-
let filter = if meta.target().starts_with("pgt") {
109+
let filter = if meta.target().starts_with("pgls") {
110110
if let Some(level) = self.level.to_filter_level() {
111111
level
112112
} else {

crates/pgls_cli/src/service/unix.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use tracing::{Instrument, debug, info};
2121
/// Returns the filesystem path of the global socket used to communicate with
2222
/// the server daemon
2323
fn get_socket_name() -> PathBuf {
24-
pgls_fs::ensure_cache_dir().join(format!("pgt-socket-{}", pgls_configuration::VERSION))
24+
pgls_fs::ensure_cache_dir().join(format!("pgls-socket-{}", pgls_configuration::VERSION))
2525
}
2626

2727
#[allow(dead_code)]
@@ -32,7 +32,7 @@ pub(crate) fn enumerate_pipes() -> io::Result<impl Iterator<Item = String>> {
3232
let file_name = entry.file_name()?;
3333
let file_name = file_name.to_str()?;
3434

35-
let version = file_name.strip_prefix("pgt-socket")?;
35+
let version = file_name.strip_prefix("pgls-socket")?;
3636
if version.is_empty() {
3737
Some(String::new())
3838
} else {

crates/pgls_cli/src/service/windows.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ use tracing::Instrument;
2424
/// Returns the name of the global named pipe used to communicate with the
2525
/// server daemon
2626
fn get_pipe_name() -> String {
27-
format!(r"\\.\pipe\pgt-service-{}", pgls_configuration::VERSION)
27+
format!(r"\\.\pipe\pgls-service-{}", pgls_configuration::VERSION)
2828
}
2929

3030
#[allow(dead_code)]
@@ -35,7 +35,7 @@ pub(crate) fn enumerate_pipes() -> io::Result<impl Iterator<Item = String>> {
3535
let file_name = entry.file_name()?;
3636
let file_name = file_name.to_str()?;
3737

38-
let version = file_name.strip_prefix("pgt-service")?;
38+
let version = file_name.strip_prefix("pgls-service")?;
3939
if version.is_empty() {
4040
Some(String::new())
4141
} else {

crates/pgls_fs/src/dir.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ use std::{env, fs, path::PathBuf};
33
use tracing::warn;
44

55
pub fn ensure_cache_dir() -> PathBuf {
6-
if let Some(proj_dirs) = ProjectDirs::from("dev", "supabase-community", "pgt") {
7-
// Linux: /home/alice/.cache/pgt
8-
// Win: C:\Users\Alice\AppData\Local\supabase-community\pgt\cache
9-
// Mac: /Users/Alice/Library/Caches/dev.supabase-community.pgt
6+
if let Some(proj_dirs) = ProjectDirs::from("dev", "supabase-community", "pgls") {
7+
// Linux: /home/alice/.cache/pgls
8+
// Win: C:\Users\Alice\AppData\Local\supabase-community\pgls\cache
9+
// Mac: /Users/Alice/Library/Caches/dev.supabase-community.pgls
1010
let cache_dir = proj_dirs.cache_dir().to_path_buf();
1111
if let Err(err) = fs::create_dir_all(&cache_dir) {
1212
let temp_dir = env::temp_dir();

crates/pgls_lsp/tests/server.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1063,7 +1063,7 @@ async fn test_invalidate_schema_cache(test_db: PgPool) -> Result<()> {
10631063

10641064
// Invalidate the schema cache (all = false for current connection only)
10651065
server
1066-
.request::<bool, ()>("pgt/invalidate_schema_cache", "_invalidate_cache", false)
1066+
.request::<bool, ()>("pgls/invalidate_schema_cache", "_invalidate_cache", false)
10671067
.await?;
10681068

10691069
// Get completions after invalidating cache - 'name' should NOW be present

0 commit comments

Comments
 (0)