Skip to content

Fix ON DELETE SET NULL formatting - #134

Open
VrtxOmega wants to merge 1 commit into
shssoichiro:masterfrom
VrtxOmega:fix/on-delete-set-null-132
Open

Fix ON DELETE SET NULL formatting#134
VrtxOmega wants to merge 1 commit into
shssoichiro:masterfrom
VrtxOmega:fix/on-delete-set-null-132

Conversation

@VrtxOmega

Copy link
Copy Markdown

Fixes #132.

Summary

  • Treat SET NULL as a regular reserved phrase so foreign-key actions like ON DELETE SET NULL do not split at SET.
  • Add a regression test covering the reported table definition and formatting options.

Validation

  • cargo fmt --check
  • cargo test
  • Manual CLI repro for the issue input now keeps ON DELETE SET NULL on the column definition line.

Comment thread src/tokenizer.rs
terminated("SELECT", end_of_word),
terminated("SET CURRENT SCHEMA", end_of_word),
terminated("SET SCHEMA", end_of_word),
terminated("SET NULL", end_of_word),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WARNING: SET DEFAULT is still tokenized as a top-level SET clause

This special-cases SET NULL, but referential actions also allow SET DEFAULT. For ON DELETE SET DEFAULT and ON UPDATE SET DEFAULT, the tokenizer will still match the plain SET branch here, classify it as ReservedTopLevel, and split the foreign-key action across lines again.


Reply with @kilocode-bot fix it to have Kilo Code address this issue.

@kilo-code-bot

kilo-code-bot Bot commented Jun 14, 2026

Copy link
Copy Markdown

Code Review Summary

Status: 1 Issues Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 1
SUGGESTION 0
Issue Details (click to expand)

WARNING

File Line Issue
src/tokenizer.rs 617 SET NULL is handled, but valid referential actions using SET DEFAULT still fall through to the top-level SET rule and remain mis-formatted.
Other Observations (not in diff)

Issues found in unchanged code that cannot receive inline comments:

None.

Files Reviewed (2 files)
  • src/tokenizer.rs - 1 issue
  • src/lib.rs - 0 issues

Fix these issues in Kilo Cloud


Reviewed by gpt-5.4-20260305 · 469,562 tokens

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ON DELETE SET NULL causes incorrect line breaks and cascading indentation errors

1 participant