fix(completion): flag-aware partial so a dash completes flags, not keywords

The partial-token walk stopped at `-`, so after typing `-` (or `--`)
the partial was empty and the replaced range was a zero-width point
*after* the dash. Two bugs followed at a flag position (e.g.
`add 1:n relationship … -`): the `on` keyword was offered (it
prefix-matched the empty partial), and accepting a candidate inserted
after the dash — `-on`, `---create-fk`, `----all-rows`.

Detect a dash-prefixed token at a word boundary as a flag-in-progress
and fold the whole dash-run into the partial, gated on a flag actually
being expected there (so `where x = -5` stays a signed number, not a
flag). The flag matcher now strips leading dashes and matches the body
uniformly (empty / `-` / `--` → all flags; `--cr` → create-fk).

Keywords like `on` no longer appear after a dash, and accept replaces
the dash(es) so `-` → `--create-fk` and `--all` → `--all-rows`. Two
partial-flag snapshots updated (they had captured the old behaviour).
This commit is contained in:
claude@clouddev1
2026-06-12 10:59:49 +00:00
parent 30b2677bf3
commit c3e010332c
3 changed files with 107 additions and 21 deletions
@@ -24,10 +24,10 @@ Assessment {
completion: Some(
Completion {
replaced_range: (
24,
22,
27,
),
partial_prefix: "all",
partial_prefix: "--all",
candidates: [
Candidate {
text: "--all-rows",
@@ -24,10 +24,10 @@ Assessment {
completion: Some(
Completion {
replaced_range: (
33,
31,
36,
),
partial_prefix: "all",
partial_prefix: "--all",
candidates: [
Candidate {
text: "--all-rows",