Skip to content

Commit 78b8152

Browse files
renamed it
1 parent fee1ccf commit 78b8152

File tree

12 files changed

+47
-47
lines changed

12 files changed

+47
-47
lines changed

crates/pgt_completions/src/builder.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use crate::{
44
relevance::{filtering::CompletionFilter, scoring::CompletionScore},
55
};
66

7-
use pgt_treesitter::CompletionContext;
7+
use pgt_treesitter::TreesitterContext;
88

99
pub(crate) struct PossibleCompletionItem<'a> {
1010
pub label: String,
@@ -18,11 +18,11 @@ pub(crate) struct PossibleCompletionItem<'a> {
1818

1919
pub(crate) struct CompletionBuilder<'a> {
2020
items: Vec<PossibleCompletionItem<'a>>,
21-
ctx: &'a CompletionContext<'a>,
21+
ctx: &'a TreesitterContext<'a>,
2222
}
2323

2424
impl<'a> CompletionBuilder<'a> {
25-
pub fn new(ctx: &'a CompletionContext) -> Self {
25+
pub fn new(ctx: &'a TreesitterContext) -> Self {
2626
CompletionBuilder { items: vec![], ctx }
2727
}
2828

crates/pgt_completions/src/complete.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use pgt_text_size::TextSize;
22

3-
use pgt_treesitter::{TreeSitterContextParams, context::CompletionContext};
3+
use pgt_treesitter::{TreeSitterContextParams, context::TreesitterContext};
44

55
use crate::{
66
builder::CompletionBuilder,
@@ -29,7 +29,7 @@ pub struct CompletionParams<'a> {
2929
pub fn complete(params: CompletionParams) -> Vec<CompletionItem> {
3030
let sanitized_params = SanitizedCompletionParams::from(params);
3131

32-
let ctx = CompletionContext::new(TreeSitterContextParams {
32+
let ctx = TreesitterContext::new(TreeSitterContextParams {
3333
position: sanitized_params.position,
3434
schema: sanitized_params.schema,
3535
text: &sanitized_params.text,

crates/pgt_completions/src/providers/columns.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use pgt_treesitter::{CompletionContext, WrappingClause};
1+
use pgt_treesitter::{TreesitterContext, WrappingClause};
22

33
use crate::{
44
CompletionItemKind,
@@ -8,7 +8,7 @@ use crate::{
88

99
use super::helper::{find_matching_alias_for_table, get_completion_text_with_schema_or_alias};
1010

11-
pub fn complete_columns<'a>(ctx: &CompletionContext<'a>, builder: &mut CompletionBuilder<'a>) {
11+
pub fn complete_columns<'a>(ctx: &TreesitterContext<'a>, builder: &mut CompletionBuilder<'a>) {
1212
let available_columns = &ctx.schema_cache.columns;
1313

1414
for col in available_columns {

crates/pgt_completions/src/providers/functions.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use pgt_schema_cache::Function;
2-
use pgt_treesitter::CompletionContext;
2+
use pgt_treesitter::TreesitterContext;
33

44
use crate::{
55
CompletionItemKind, CompletionText,
@@ -10,7 +10,7 @@ use crate::{
1010

1111
use super::helper::get_completion_text_with_schema_or_alias;
1212

13-
pub fn complete_functions<'a>(ctx: &'a CompletionContext, builder: &mut CompletionBuilder<'a>) {
13+
pub fn complete_functions<'a>(ctx: &'a TreesitterContext, builder: &mut CompletionBuilder<'a>) {
1414
let available_functions = &ctx.schema_cache.functions;
1515

1616
for func in available_functions {
@@ -30,7 +30,7 @@ pub fn complete_functions<'a>(ctx: &'a CompletionContext, builder: &mut Completi
3030
}
3131
}
3232

33-
fn get_completion_text(ctx: &CompletionContext, func: &Function) -> CompletionText {
33+
fn get_completion_text(ctx: &TreesitterContext, func: &Function) -> CompletionText {
3434
let range = get_range_to_replace(ctx);
3535
let mut text = get_completion_text_with_schema_or_alias(ctx, &func.name, &func.schema)
3636
.map(|ct| ct.text)

crates/pgt_completions/src/providers/helper.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
use pgt_text_size::{TextRange, TextSize};
2-
use pgt_treesitter::CompletionContext;
2+
use pgt_treesitter::TreesitterContext;
33

44
use crate::{CompletionText, remove_sanitized_token};
55

66
pub(crate) fn find_matching_alias_for_table(
7-
ctx: &CompletionContext,
7+
ctx: &TreesitterContext,
88
table_name: &str,
99
) -> Option<String> {
1010
for (alias, table) in ctx.mentioned_table_aliases.iter() {
@@ -15,7 +15,7 @@ pub(crate) fn find_matching_alias_for_table(
1515
None
1616
}
1717

18-
pub(crate) fn get_range_to_replace(ctx: &CompletionContext) -> TextRange {
18+
pub(crate) fn get_range_to_replace(ctx: &TreesitterContext) -> TextRange {
1919
match ctx.node_under_cursor.as_ref() {
2020
Some(node) => {
2121
let content = ctx.get_node_under_cursor_content().unwrap_or("".into());
@@ -31,7 +31,7 @@ pub(crate) fn get_range_to_replace(ctx: &CompletionContext) -> TextRange {
3131
}
3232

3333
pub(crate) fn get_completion_text_with_schema_or_alias(
34-
ctx: &CompletionContext,
34+
ctx: &TreesitterContext,
3535
item_name: &str,
3636
schema_or_alias_name: &str,
3737
) -> Option<CompletionText> {

crates/pgt_completions/src/providers/policies.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use pgt_text_size::{TextRange, TextSize};
2-
use pgt_treesitter::CompletionContext;
2+
use pgt_treesitter::TreesitterContext;
33

44
use crate::{
55
CompletionItemKind, CompletionText,
@@ -9,7 +9,7 @@ use crate::{
99

1010
use super::helper::get_range_to_replace;
1111

12-
pub fn complete_policies<'a>(ctx: &CompletionContext<'a>, builder: &mut CompletionBuilder<'a>) {
12+
pub fn complete_policies<'a>(ctx: &TreesitterContext<'a>, builder: &mut CompletionBuilder<'a>) {
1313
let available_policies = &ctx.schema_cache.policies;
1414

1515
let surrounded_by_quotes = ctx

crates/pgt_completions/src/providers/roles.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ use crate::{
33
builder::{CompletionBuilder, PossibleCompletionItem},
44
relevance::{CompletionRelevanceData, filtering::CompletionFilter, scoring::CompletionScore},
55
};
6-
use pgt_treesitter::CompletionContext;
6+
use pgt_treesitter::TreesitterContext;
77

8-
pub fn complete_roles<'a>(ctx: &CompletionContext<'a>, builder: &mut CompletionBuilder<'a>) {
8+
pub fn complete_roles<'a>(ctx: &TreesitterContext<'a>, builder: &mut CompletionBuilder<'a>) {
99
let available_roles = &ctx.schema_cache.roles;
1010

1111
for role in available_roles {

crates/pgt_completions/src/providers/schemas.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ use crate::{
22
builder::{CompletionBuilder, PossibleCompletionItem},
33
relevance::{CompletionRelevanceData, filtering::CompletionFilter, scoring::CompletionScore},
44
};
5-
use pgt_treesitter::CompletionContext;
5+
use pgt_treesitter::TreesitterContext;
66

7-
pub fn complete_schemas<'a>(ctx: &'a CompletionContext, builder: &mut CompletionBuilder<'a>) {
7+
pub fn complete_schemas<'a>(ctx: &'a TreesitterContext, builder: &mut CompletionBuilder<'a>) {
88
let available_schemas = &ctx.schema_cache.schemas;
99

1010
for schema in available_schemas {

crates/pgt_completions/src/providers/tables.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use pgt_treesitter::CompletionContext;
1+
use pgt_treesitter::TreesitterContext;
22

33
use crate::{
44
builder::{CompletionBuilder, PossibleCompletionItem},
@@ -8,7 +8,7 @@ use crate::{
88

99
use super::helper::get_completion_text_with_schema_or_alias;
1010

11-
pub fn complete_tables<'a>(ctx: &'a CompletionContext, builder: &mut CompletionBuilder<'a>) {
11+
pub fn complete_tables<'a>(ctx: &'a TreesitterContext, builder: &mut CompletionBuilder<'a>) {
1212
let available_tables = &ctx.schema_cache.tables;
1313

1414
for table in available_tables {

crates/pgt_completions/src/relevance/filtering.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use pgt_schema_cache::ProcKind;
22

3-
use pgt_treesitter::context::{CompletionContext, NodeUnderCursor, WrappingClause, WrappingNode};
3+
use pgt_treesitter::context::{NodeUnderCursor, TreesitterContext, WrappingClause, WrappingNode};
44

55
use super::CompletionRelevanceData;
66

@@ -16,7 +16,7 @@ impl<'a> From<CompletionRelevanceData<'a>> for CompletionFilter<'a> {
1616
}
1717

1818
impl CompletionFilter<'_> {
19-
pub fn is_relevant(&self, ctx: &CompletionContext) -> Option<()> {
19+
pub fn is_relevant(&self, ctx: &TreesitterContext) -> Option<()> {
2020
self.completable_context(ctx)?;
2121
self.check_clause(ctx)?;
2222
self.check_invocation(ctx)?;
@@ -25,7 +25,7 @@ impl CompletionFilter<'_> {
2525
Some(())
2626
}
2727

28-
fn completable_context(&self, ctx: &CompletionContext) -> Option<()> {
28+
fn completable_context(&self, ctx: &TreesitterContext) -> Option<()> {
2929
if ctx.wrapping_node_kind.is_none() && ctx.wrapping_clause_type.is_none() {
3030
return None;
3131
}
@@ -70,7 +70,7 @@ impl CompletionFilter<'_> {
7070
Some(())
7171
}
7272

73-
fn check_clause(&self, ctx: &CompletionContext) -> Option<()> {
73+
fn check_clause(&self, ctx: &TreesitterContext) -> Option<()> {
7474
ctx.wrapping_clause_type
7575
.as_ref()
7676
.map(|clause| {
@@ -208,7 +208,7 @@ impl CompletionFilter<'_> {
208208
.and_then(|is_ok| if is_ok { Some(()) } else { None })
209209
}
210210

211-
fn check_invocation(&self, ctx: &CompletionContext) -> Option<()> {
211+
fn check_invocation(&self, ctx: &TreesitterContext) -> Option<()> {
212212
if !ctx.is_invocation {
213213
return Some(());
214214
}
@@ -221,7 +221,7 @@ impl CompletionFilter<'_> {
221221
Some(())
222222
}
223223

224-
fn check_mentioned_schema_or_alias(&self, ctx: &CompletionContext) -> Option<()> {
224+
fn check_mentioned_schema_or_alias(&self, ctx: &TreesitterContext) -> Option<()> {
225225
if ctx.schema_or_alias_name.is_none() {
226226
return Some(());
227227
}

0 commit comments

Comments
 (0)