Skip to content

Commit ec3d575

Browse files
wow!
1 parent a98f996 commit ec3d575

File tree

2 files changed

+26
-2
lines changed

2 files changed

+26
-2
lines changed

crates/pgt_completions/src/providers/tables.rs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,4 +379,28 @@ mod tests {
379379
)
380380
.await;
381381
}
382+
383+
#[tokio::test]
384+
async fn suggests_tables_in_insert_into() {
385+
let setup = r#"
386+
create schema auth;
387+
388+
create table auth.users (
389+
uid serial primary key,
390+
name text not null,
391+
email text unique not null
392+
);
393+
"#;
394+
395+
assert_complete_results(
396+
format!("insert into {}", CURSOR_POS).as_str(),
397+
vec![
398+
CompletionAssertion::LabelAndKind("public".into(), CompletionItemKind::Schema),
399+
CompletionAssertion::LabelAndKind("auth".into(), CompletionItemKind::Schema),
400+
CompletionAssertion::LabelAndKind("users".into(), CompletionItemKind::Table),
401+
],
402+
setup,
403+
)
404+
.await;
405+
}
382406
}

crates/pgt_completions/src/relevance/filtering.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ impl CompletionFilter<'_> {
8181
WrappingClause::Insert => {
8282
ctx.wrapping_node_kind
8383
.as_ref()
84-
.is_some_and(|n| n != &WrappingNode::List)
84+
.is_none_or(|n| n != &WrappingNode::List)
8585
&& ctx.before_cursor_matches_kind(&["keyword_into"])
8686
}
8787

@@ -148,7 +148,7 @@ impl CompletionFilter<'_> {
148148
WrappingClause::Insert => {
149149
ctx.wrapping_node_kind
150150
.as_ref()
151-
.is_some_and(|n| n != &WrappingNode::List)
151+
.is_none_or(|n| n != &WrappingNode::List)
152152
&& ctx.before_cursor_matches_kind(&["keyword_into"])
153153
}
154154

0 commit comments

Comments
 (0)