Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions crates/squawk_ide/src/classify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ fn is_special_fn(kind: SyntaxKind) -> bool {
| SyntaxKind::ANY_FN
| SyntaxKind::ALL_FN
| SyntaxKind::EXISTS_FN
| SyntaxKind::GRAPH_TABLE_FN
)
}

Expand Down
5 changes: 4 additions & 1 deletion crates/squawk_ide/src/expand_selection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ const DELIMITED_LIST_KINDS: &[SyntaxKind] = &[
SyntaxKind::REVOKE_COMMAND_LIST,
SyntaxKind::ROLE_REF_LIST,
SyntaxKind::ROW_LIST,
SyntaxKind::XML_ATTRIBUTE_LIST,
SyntaxKind::EXPR_AS_NAME_LIST,
SyntaxKind::XML_NAMESPACE_LIST,
SyntaxKind::SET_COLUMN_LIST,
SyntaxKind::SET_EXPR_LIST,
Expand All @@ -73,6 +73,8 @@ const DELIMITED_LIST_KINDS: &[SyntaxKind] = &[
SyntaxKind::VACUUM_OPTION_LIST,
SyntaxKind::VARIANT_LIST,
SyntaxKind::XML_TABLE_COLUMN_LIST,
SyntaxKind::PATH_PATTERN_LIST,
SyntaxKind::PROPERTIES_LIST,
];

pub fn extend_selection(root: &SyntaxNode, range: TextRange) -> TextRange {
Expand Down Expand Up @@ -553,6 +555,7 @@ $0
SyntaxKind::TRIGGER_EVENT_LIST,
SyntaxKind::XML_COLUMN_OPTION_LIST,
SyntaxKind::WHEN_CLAUSE_LIST,
SyntaxKind::LABEL_AND_PROPERTIES_LIST,
];

let unhandled_list_kinds = (0..SyntaxKind::__LAST as u16)
Expand Down
7 changes: 5 additions & 2 deletions crates/squawk_ide/src/folding_ranges.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,13 @@ fn fold_kind(kind: SyntaxKind) -> Option<FoldKind> {
| SyntaxKind::TRIGGER_EVENT_LIST
| SyntaxKind::VACUUM_OPTION_LIST
| SyntaxKind::VARIANT_LIST
| SyntaxKind::XML_ATTRIBUTE_LIST
| SyntaxKind::EXPR_AS_NAME_LIST
| SyntaxKind::XML_COLUMN_OPTION_LIST
| SyntaxKind::XML_NAMESPACE_LIST
| SyntaxKind::XML_TABLE_COLUMN_LIST => Some(FoldKind::List),
| SyntaxKind::XML_TABLE_COLUMN_LIST
| SyntaxKind::LABEL_AND_PROPERTIES_LIST
| SyntaxKind::PATH_PATTERN_LIST
| SyntaxKind::PROPERTIES_LIST => Some(FoldKind::List),
_ => None,
}
}
Expand Down
18 changes: 9 additions & 9 deletions crates/squawk_ide/src/goto_definition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2318,13 +2318,13 @@ drop type person$0;
fn goto_create_table_type_reference() {
assert_snapshot!(goto("
create type person_info as (name text, email text);
create table user(id int, member person_info$0);
"), @r"
create table users(id int, member person_info$0);
"), @"
╭▸
2 │ create type person_info as (name text, email text);
│ ─────────── 2. destination
3 │ create table user(id int, member person_info);
╰╴ ─ 1. source
3 │ create table users(id int, member person_info);
╰╴ ─ 1. source
");
}

Expand Down Expand Up @@ -2416,14 +2416,14 @@ create table data(id int, value myint$0);
fn goto_composite_type_field() {
assert_snapshot!(goto("
create type person_info as (name text, email text);
create table user(id int, member person_info);
select (member).name$0 from user;
"), @r"
create table users(id int, member person_info);
select (member).name$0 from users;
"), @"
╭▸
2 │ create type person_info as (name text, email text);
│ ──── 2. destination
3 │ create table user(id int, member person_info);
4 │ select (member).name from user;
3 │ create table users(id int, member person_info);
4 │ select (member).name from users;
╰╴ ─ 1. source
");
}
Expand Down
2 changes: 2 additions & 0 deletions crates/squawk_lexer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ impl Cursor<'_> {
')' => TokenKind::CloseParen,
'[' => TokenKind::OpenBracket,
']' => TokenKind::CloseBracket,
'{' => TokenKind::OpenCurly,
'}' => TokenKind::CloseCurly,
'@' => TokenKind::At,
'#' => TokenKind::Pound,
'~' => TokenKind::Tilde,
Expand Down
4 changes: 4 additions & 0 deletions crates/squawk_lexer/src/token.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ pub enum TokenKind {
CloseBracket,
/// `[`
OpenBracket,
/// `}`
CloseCurly,
/// `{`
OpenCurly,
/// `)`
CloseParen,
/// `(`
Expand Down
4 changes: 4 additions & 0 deletions crates/squawk_linter/src/analyze.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ pub fn possibly_slow_stmt(stmt: &ast::Stmt) -> bool {
| ast::Stmt::AlterOperatorClass(_)
| ast::Stmt::AlterOperatorFamily(_)
| ast::Stmt::AlterPolicy(_)
| ast::Stmt::AlterPropertyGraph(_)
| ast::Stmt::AlterProcedure(_)
| ast::Stmt::AlterPublication(_)
| ast::Stmt::AlterRole(_)
Expand Down Expand Up @@ -94,6 +95,7 @@ pub fn possibly_slow_stmt(stmt: &ast::Stmt) -> bool {
| ast::Stmt::CreateOperatorClass(_)
| ast::Stmt::CreateOperatorFamily(_)
| ast::Stmt::CreatePolicy(_)
| ast::Stmt::CreatePropertyGraph(_)
| ast::Stmt::CreateProcedure(_)
| ast::Stmt::CreatePublication(_)
| ast::Stmt::CreateRole(_)
Expand Down Expand Up @@ -136,6 +138,7 @@ pub fn possibly_slow_stmt(stmt: &ast::Stmt) -> bool {
| ast::Stmt::DropOperatorFamily(_)
| ast::Stmt::DropOwned(_)
| ast::Stmt::DropPolicy(_)
| ast::Stmt::DropPropertyGraph(_)
| ast::Stmt::DropProcedure(_)
| ast::Stmt::DropPublication(_)
| ast::Stmt::DropRole(_)
Expand Down Expand Up @@ -197,6 +200,7 @@ pub fn possibly_slow_stmt(stmt: &ast::Stmt) -> bool {
| ast::Stmt::ReleaseSavepoint(_)
| ast::Stmt::Reset(_)
| ast::Stmt::Revoke(_)
| ast::Stmt::Repack(_)
| ast::Stmt::Rollback(_)
| ast::Stmt::Savepoint(_)
| ast::Stmt::SecurityLabel(_)
Expand Down
4 changes: 2 additions & 2 deletions crates/squawk_linter/src/rules/prefer_robust_stmts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -277,10 +277,10 @@ DROP TABLE users;
#[test]
fn fix_create_index_if_not_exists() {
assert_snapshot!(fix("
create index idx on table (col);
create index idx on items (col);
CREATE INDEX CONCURRENTLY idx2 ON users (email);
"), @r"
create index if not exists idx on table (col);
create index if not exists idx on items (col);
CREATE INDEX CONCURRENTLY if not exists idx2 ON users (email);
");
}
Expand Down
Loading
Loading