Skip to content

Commit 54ed210

Browse files
adjust grammar, remove custom node
1 parent 6e72b72 commit 54ed210

File tree

3 files changed

+242
-318
lines changed

3 files changed

+242
-318
lines changed

crates/pgt_completions/src/relevance/filtering.rs

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use pgt_schema_cache::ProcKind;
2-
use pgt_treesitter::context::{NodeUnderCursor, TreesitterContext, WrappingClause, WrappingNode};
2+
use pgt_treesitter::context::{TreesitterContext, WrappingClause, WrappingNode};
33

44
use super::CompletionRelevanceData;
55

@@ -67,23 +67,20 @@ impl CompletionFilter<'_> {
6767
}
6868

6969
// No autocompletions if there are two identifiers without a separator.
70-
if ctx.node_under_cursor.as_ref().is_some_and(|n| match n {
71-
NodeUnderCursor::TsNode(node) => node.prev_sibling().is_some_and(|p| {
70+
if ctx.node_under_cursor.as_ref().is_some_and(|node| {
71+
node.prev_sibling().is_some_and(|p| {
7272
(p.kind() == "identifier" || p.kind() == "object_reference")
73-
&& n.kind() == "identifier"
74-
}),
75-
NodeUnderCursor::CustomNode { .. } => false,
73+
&& node.kind() == "identifier"
74+
})
7675
}) {
7776
return None;
7877
}
7978

8079
// no completions if we're right after an asterisk:
8180
// `select * {}`
82-
if ctx.node_under_cursor.as_ref().is_some_and(|n| match n {
83-
NodeUnderCursor::TsNode(node) => node
84-
.prev_sibling()
85-
.is_some_and(|p| (p.kind() == "all_fields") && n.kind() == "identifier"),
86-
NodeUnderCursor::CustomNode { .. } => false,
81+
if ctx.node_under_cursor.as_ref().is_some_and(|n| {
82+
n.prev_sibling()
83+
.is_some_and(|p| (p.kind() == "all_fields") && n.kind() == "identifier")
8784
}) {
8885
return None;
8986
}

0 commit comments

Comments
 (0)