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
3 changes: 2 additions & 1 deletion crates/squawk_ide/src/classify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,8 @@ pub(crate) fn classify_name_ref(node: &SyntaxNode) -> Option<NameRefClass> {
.and_then(|p| p.syntax().parent().and_then(ast::Path::cast))
&& let Some(stmt_parent) = path.syntax().parent()
&& (ast::AlterPropertyGraph::can_cast(stmt_parent.kind())
|| ast::DropPropertyGraph::can_cast(stmt_parent.kind()))
|| ast::DropPropertyGraph::can_cast(stmt_parent.kind())
|| ast::GraphTableFn::can_cast(stmt_parent.kind()))
{
return Some(NameRefClass::PropertyGraph);
}
Expand Down
16 changes: 16 additions & 0 deletions crates/squawk_ide/src/goto_definition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9722,4 +9722,20 @@ alter property graph foo.ba$0r rename to baz;
╰╴ ─ 1. source
");
}

#[test]
fn goto_graph_table_fn() {
assert_snapshot!(goto("
create property graph myshop vertex tables (t key (a) no properties);
select 1 from graph_table (myshop$0
match (n is t)
columns (1 as x));
"), @"
╭▸
2 │ create property graph myshop vertex tables (t key (a) no properties);
│ ────── 2. destination
3 │ select 1 from graph_table (myshop
╰╴ ─ 1. source
");
}
}
15 changes: 14 additions & 1 deletion crates/squawk_ide/src/semantic_tokens.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ pub enum SemanticTokenType {
Type,
Parameter,
PositionalParam,
PropertyGraph,
Table,
Schema,
}
Expand All @@ -188,6 +189,7 @@ impl TryFrom<LocationKind> for SemanticTokenType {
LocationKind::Column => Ok(SemanticTokenType::Column),
LocationKind::NamedArgParameter => Ok(SemanticTokenType::Parameter),
LocationKind::Schema => Ok(SemanticTokenType::Schema),
LocationKind::PropertyGraph => Ok(SemanticTokenType::PropertyGraph),
LocationKind::Sequence | LocationKind::Table | LocationKind::View => {
Ok(SemanticTokenType::Table)
}
Expand All @@ -203,7 +205,6 @@ impl TryFrom<LocationKind> for SemanticTokenType {
| LocationKind::Index
| LocationKind::Policy
| LocationKind::PreparedStatement
| LocationKind::PropertyGraph
| LocationKind::Role
| LocationKind::Server
| LocationKind::Tablespace
Expand Down Expand Up @@ -820,6 +821,18 @@ select * from t;
"#);
}

#[test]
fn create_property_graph() {
assert_snapshot!(semantic_tokens(
"
create property graph foo
vertex tables (bar key (a) no properties);
",
), @r#"
"foo" @ 23..26: PropertyGraph
"#);
}

#[test]
fn select_target_schema_qualified() {
assert_snapshot!(semantic_tokens(
Expand Down
4 changes: 3 additions & 1 deletion crates/squawk_server/src/lsp_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,9 @@ fn to_token_type(ty: SemanticTokenType) -> lsp_types::SemanticTokenType {
lsp_types::SemanticTokenType::PARAMETER
}
SemanticTokenType::Column => lsp_types::SemanticTokenType::VARIABLE,
SemanticTokenType::Table => lsp_types::SemanticTokenType::STRUCT,
SemanticTokenType::PropertyGraph | SemanticTokenType::Table => {
lsp_types::SemanticTokenType::STRUCT
}
SemanticTokenType::Schema => lsp_types::SemanticTokenType::NAMESPACE,
}
}
Expand Down
2 changes: 1 addition & 1 deletion crates/squawk_wasm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ fn semantic_token_type_name(ty: SemanticTokenType) -> &'static str {
SemanticTokenType::Parameter | SemanticTokenType::PositionalParam => "parameter",
SemanticTokenType::Schema => "namespace",
SemanticTokenType::String => "string",
SemanticTokenType::Table => "struct",
SemanticTokenType::PropertyGraph | SemanticTokenType::Table => "struct",
SemanticTokenType::Type => "type",
}
}
Expand Down
Loading