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:
+2
-2
@@ -24,10 +24,10 @@ Assessment {
|
||||
completion: Some(
|
||||
Completion {
|
||||
replaced_range: (
|
||||
24,
|
||||
22,
|
||||
27,
|
||||
),
|
||||
partial_prefix: "all",
|
||||
partial_prefix: "--all",
|
||||
candidates: [
|
||||
Candidate {
|
||||
text: "--all-rows",
|
||||
|
||||
+2
-2
@@ -24,10 +24,10 @@ Assessment {
|
||||
completion: Some(
|
||||
Completion {
|
||||
replaced_range: (
|
||||
33,
|
||||
31,
|
||||
36,
|
||||
),
|
||||
partial_prefix: "all",
|
||||
partial_prefix: "--all",
|
||||
candidates: [
|
||||
Candidate {
|
||||
text: "--all-rows",
|
||||
|
||||
Reference in New Issue
Block a user