Skip to content

Commit 3f1f8d4

Browse files
committed
progress
1 parent d95787a commit 3f1f8d4

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

crates/pgt_workspace/src/workspace/server.rs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -570,8 +570,21 @@ impl Workspace for WorkspaceServer {
570570
if let Some(node) = stmt_root {
571571
analysable_stmts.push(node);
572572
}
573-
// TODO: ignore the syntax error if we already have a diagnostic for it
574573
if let Some(diag) = diagnostic {
574+
// ignore the syntax error if we already have more specialized diagnostics for the
575+
// same statement.
576+
// this is important for create function statements, where we might already have detailed
577+
// diagnostics from plpgsql_check.
578+
if diagnostics.iter().any(|d| {
579+
d.location().span.is_some_and(|async_loc| {
580+
diag.location()
581+
.span
582+
.is_some_and(|syntax_loc| syntax_loc.contains(async_loc))
583+
})
584+
}) {
585+
continue;
586+
}
587+
575588
diagnostics.push(SDiagnostic::new(
576589
diag.with_file_path(path.clone())
577590
.with_severity(Severity::Error),

0 commit comments

Comments
 (0)