Skip to content

Commit 7ce97c6

Browse files
removed many stuffs
1 parent f8daaf3 commit 7ce97c6

File tree

4 files changed

+4
-67
lines changed

4 files changed

+4
-67
lines changed

crates/pgls_completions/src/builder.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,6 @@ pub(crate) struct CompletionBuilder<'a> {
2525

2626
impl<'a> CompletionBuilder<'a> {
2727
pub fn new(ctx: &'a TreesitterContext) -> Self {
28-
println!(
29-
"is sanitized: {:#?}",
30-
ctx.get_node_under_cursor_content()
31-
.map(|txt| sanitization::is_sanitized_token(txt.as_str()))
32-
);
33-
3428
CompletionBuilder { items: vec![], ctx }
3529
}
3630

crates/pgls_completions/src/providers/schemas.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ mod tests {
5959
assert_complete_results(
6060
format!("select * from {}", QueryWithCursorPosition::cursor_marker()).as_str(),
6161
vec![
62-
CompletionAssertion::LabelAndKind("public".to_string(), CompletionItemKind::Schema),
62+
// users table still preferred over schemas
63+
CompletionAssertion::LabelAndKind("users".to_string(), CompletionItemKind::Table),
6364
CompletionAssertion::LabelAndKind("auth".to_string(), CompletionItemKind::Schema),
6465
CompletionAssertion::LabelAndKind(
6566
"internal".to_string(),
@@ -69,8 +70,7 @@ mod tests {
6970
"private".to_string(),
7071
CompletionItemKind::Schema,
7172
),
72-
// users table still preferred over system schemas
73-
CompletionAssertion::LabelAndKind("users".to_string(), CompletionItemKind::Table),
73+
// system schemas have lowest preference
7474
CompletionAssertion::LabelAndKind(
7575
"information_schema".to_string(),
7676
CompletionItemKind::Schema,
@@ -110,8 +110,8 @@ mod tests {
110110
)
111111
.as_str(),
112112
vec![
113-
CompletionAssertion::LabelAndKind("users".into(), CompletionItemKind::Table),
114113
CompletionAssertion::LabelAndKind("ultimate".into(), CompletionItemKind::Schema),
114+
CompletionAssertion::LabelAndKind("users".into(), CompletionItemKind::Table),
115115
],
116116
Some(setup),
117117
&pool,

crates/pgls_completions/src/relevance/scoring.rs

Lines changed: 0 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -33,52 +33,15 @@ impl CompletionScore<'_> {
3333
}
3434

3535
pub fn calc_score(&mut self, ctx: &TreesitterContext) {
36-
let case = (matches!(self.data, CompletionRelevanceData::Schema(_))
37-
&& self.get_schema_name().is_some_and(|s| s == "pg_catalog"))
38-
|| (matches!(self.data, CompletionRelevanceData::Table(_))
39-
&& self.get_table_name().is_some_and(|s| s == "parameters"));
40-
41-
if case {
42-
println!("checking {}", self.get_fully_qualified_name())
43-
}
44-
4536
self.check_is_user_defined();
46-
if case {
47-
println!("{} after user-defined check", self.score);
48-
}
49-
5037
self.check_matches_schema(ctx);
51-
if case {
52-
println!("{} after schema match check", self.score);
53-
}
5438
self.check_matches_query_input(ctx);
55-
if case {
56-
println!("{} after query input match check", self.score);
57-
}
5839
self.check_is_invocation(ctx);
59-
if case {
60-
println!("{} after invocation check", self.score);
61-
}
6240
self.check_matching_clause_type(ctx);
63-
if case {
64-
println!("{} after clause type check", self.score);
65-
}
6641
self.check_without_content(ctx);
67-
if case {
68-
println!("{} after wrapping node check", self.score);
69-
}
7042
self.check_relations_in_stmt(ctx);
71-
if case {
72-
println!("{} after relations in stmt check", self.score);
73-
}
7443
self.check_columns_in_stmt(ctx);
75-
if case {
76-
println!("{} after columns in stmt check", self.score);
77-
}
7844
self.check_is_not_wellknown_migration(ctx);
79-
if case {
80-
println!("{} after well-known migration check", self.score);
81-
}
8245
}
8346

8447
fn check_matches_query_input(&mut self, ctx: &TreesitterContext) {
@@ -168,21 +131,6 @@ impl CompletionScore<'_> {
168131
} else {
169132
scorei32 / 3
170133
};
171-
172-
if matches!(self.data, CompletionRelevanceData::Schema(_))
173-
&& self.get_schema_name().is_some_and(|s| s == "pg_catalog")
174-
{
175-
println!("Debug: Schema pg_catalog match score {}", self.score);
176-
}
177-
178-
if matches!(self.data, CompletionRelevanceData::Table(_))
179-
&& self.get_table_name().is_some_and(|s| s == "parameters")
180-
{
181-
println!(
182-
"Debug: Table information_schema.parameters match score {}",
183-
self.score
184-
);
185-
}
186134
}
187135
None => self.skip = true,
188136
}

crates/pgls_completions/src/test_helper.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -186,11 +186,6 @@ pub(crate) async fn assert_complete_results(
186186
items.len()
187187
);
188188

189-
if !items.is_empty() {
190-
let max_len = std::cmp::min(items.len(), 5);
191-
println!("Completion Items: {:#?}", &items[..max_len]);
192-
}
193-
194189
for item in &items {
195190
for assertion in &not_existing {
196191
assertion.assert(item);

0 commit comments

Comments
 (0)