Skip to content

Commit fee1ccf

Browse files
ok
1 parent bfc2404 commit fee1ccf

File tree

6 files changed

+48
-36
lines changed

6 files changed

+48
-36
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ pgt_suppressions = { path = "./crates/pgt_suppressions", version = "0.
8282
pgt_text_edit = { path = "./crates/pgt_text_edit", version = "0.0.0" }
8383
pgt_text_size = { path = "./crates/pgt_text_size", version = "0.0.0" }
8484
pgt_tokenizer = { path = "./crates/pgt_tokenizer", version = "0.0.0" }
85-
pgt_treesitter = { path = "./crates/pgt_treesitter", version = "0.0.0" }
85+
pgt_treesitter = { path = "./crates/pgt_treesitter", version = "0.0.0" }
8686
pgt_typecheck = { path = "./crates/pgt_typecheck", version = "0.0.0" }
8787
pgt_workspace = { path = "./crates/pgt_workspace", version = "0.0.0" }
8888

crates/pgt_completions/Cargo.toml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,17 @@ version = "0.0.0"
1414
[dependencies]
1515
async-std = "1.12.0"
1616

17-
pgt_text_size.workspace = true
18-
pgt_schema_cache.workspace = true
19-
pgt_treesitter.workspace = true
20-
21-
fuzzy-matcher = "0.3.7"
22-
schemars = { workspace = true, optional = true }
23-
serde = { workspace = true, features = ["derive"] }
24-
serde_json = { workspace = true }
25-
tracing = { workspace = true }
26-
tree-sitter.workspace = true
27-
tree_sitter_sql.workspace = true
17+
pgt_schema_cache.workspace = true
18+
pgt_text_size.workspace = true
19+
pgt_treesitter.workspace = true
20+
21+
fuzzy-matcher = "0.3.7"
22+
schemars = { workspace = true, optional = true }
23+
serde = { workspace = true, features = ["derive"] }
24+
serde_json = { workspace = true }
25+
tracing = { workspace = true }
26+
tree-sitter.workspace = true
27+
tree_sitter_sql.workspace = true
2828

2929
sqlx.workspace = true
3030

crates/pgt_treesitter/Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ version = "0.0.0"
1212

1313

1414
[dependencies]
15-
clap = { version = "4.5.23", features = ["derive"] }
16-
tree-sitter.workspace = true
17-
tree_sitter_sql.workspace = true
18-
pgt_text_size.workspace = true
15+
clap = { version = "4.5.23", features = ["derive"] }
1916
pgt_schema_cache.workspace = true
17+
pgt_text_size.workspace = true
18+
tree-sitter.workspace = true
19+
tree_sitter_sql.workspace = true
2020

2121
[dev-dependencies]
2222
pgt_test_utils.workspace = true

crates/pgt_treesitter/src/context/mod.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -212,11 +212,11 @@ impl<'a> CompletionContext<'a> {
212212
// policy handling is important to Supabase, but they are a PostgreSQL specific extension,
213213
// so the tree_sitter_sql language does not support it.
214214
// We infer the context manually.
215-
if PolicyParser::looks_like_matching_stmt(&params.text) {
215+
if PolicyParser::looks_like_matching_stmt(params.text) {
216216
ctx.gather_policy_context();
217-
} else if GrantParser::looks_like_matching_stmt(&params.text) {
217+
} else if GrantParser::looks_like_matching_stmt(params.text) {
218218
ctx.gather_grant_context();
219-
} else if RevokeParser::looks_like_matching_stmt(&params.text) {
219+
} else if RevokeParser::looks_like_matching_stmt(params.text) {
220220
ctx.gather_revoke_context();
221221
} else {
222222
ctx.gather_tree_context();
@@ -230,7 +230,7 @@ impl<'a> CompletionContext<'a> {
230230
let revoke_context = RevokeParser::get_context(self.text, self.position);
231231

232232
self.node_under_cursor = Some(NodeUnderCursor::CustomNode {
233-
text: revoke_context.node_text.into(),
233+
text: revoke_context.node_text,
234234
range: revoke_context.node_range,
235235
kind: revoke_context.node_kind.clone(),
236236
previous_node_kind: None,
@@ -258,7 +258,7 @@ impl<'a> CompletionContext<'a> {
258258
let grant_context = GrantParser::get_context(self.text, self.position);
259259

260260
self.node_under_cursor = Some(NodeUnderCursor::CustomNode {
261-
text: grant_context.node_text.into(),
261+
text: grant_context.node_text,
262262
range: grant_context.node_range,
263263
kind: grant_context.node_kind.clone(),
264264
previous_node_kind: None,
@@ -286,7 +286,7 @@ impl<'a> CompletionContext<'a> {
286286
let policy_context = PolicyParser::get_context(self.text, self.position);
287287

288288
self.node_under_cursor = Some(NodeUnderCursor::CustomNode {
289-
text: policy_context.node_text.into(),
289+
text: policy_context.node_text,
290290
range: policy_context.node_range,
291291
kind: policy_context.node_kind.clone(),
292292
previous_node_kind: Some(policy_context.previous_node_kind),

crates/pgt_typecheck/Cargo.toml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,16 @@ version = "0.0.0"
1212

1313

1414
[dependencies]
15-
pgt_console.workspace = true
16-
pgt_diagnostics.workspace = true
17-
pgt_query_ext.workspace = true
18-
pgt_schema_cache.workspace = true
19-
pgt_text_size.workspace = true
20-
pgt_treesitter.workspace = true
21-
sqlx.workspace = true
22-
tokio.workspace = true
23-
tree-sitter.workspace = true
24-
tree_sitter_sql.workspace = true
15+
pgt_console.workspace = true
16+
pgt_diagnostics.workspace = true
17+
pgt_query_ext.workspace = true
18+
pgt_schema_cache.workspace = true
19+
pgt_text_size.workspace = true
20+
pgt_treesitter.workspace = true
21+
sqlx.workspace = true
22+
tokio.workspace = true
23+
tree-sitter.workspace = true
24+
tree_sitter_sql.workspace = true
2525

2626
[dev-dependencies]
2727
insta.workspace = true

crates/pgt_workspace/src/features/completions.rs

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,10 @@ mod tests {
129129

130130
#[test]
131131
fn does_not_return_overlapping_statements_if_too_close() {
132-
let sql = format!("select * from {}select 1;", QueryWithCursorPosition::cursor_marker());
132+
let sql = format!(
133+
"select * from {}select 1;",
134+
QueryWithCursorPosition::cursor_marker()
135+
);
133136

134137
let (doc, position) = get_doc_and_pos(sql.as_str());
135138

@@ -141,7 +144,10 @@ mod tests {
141144

142145
#[test]
143146
fn is_fine_with_spaces() {
144-
let sql = format!("select * from {} ;", QueryWithCursorPosition::cursor_marker());
147+
let sql = format!(
148+
"select * from {} ;",
149+
QueryWithCursorPosition::cursor_marker()
150+
);
145151

146152
let (doc, position) = get_doc_and_pos(sql.as_str());
147153

@@ -189,7 +195,10 @@ mod tests {
189195

190196
#[test]
191197
fn does_not_consider_too_far_offset() {
192-
let sql = format!("select * from {}", QueryWithCursorPosition::cursor_marker());
198+
let sql = format!(
199+
"select * from {}",
200+
QueryWithCursorPosition::cursor_marker()
201+
);
193202

194203
let (doc, position) = get_doc_and_pos(sql.as_str());
195204

@@ -198,7 +207,10 @@ mod tests {
198207

199208
#[test]
200209
fn does_not_consider_offset_if_statement_terminated_by_semi() {
201-
let sql = format!("select * from users;{}", QueryWithCursorPosition::cursor_marker());
210+
let sql = format!(
211+
"select * from users;{}",
212+
QueryWithCursorPosition::cursor_marker()
213+
);
202214

203215
let (doc, position) = get_doc_and_pos(sql.as_str());
204216

0 commit comments

Comments
 (0)