walker+completion: surface list trailing-optionals + identifiers-first ordering (ADR-0022 Amendment 2)

walk_repeated discarded the last matched item's trailing-optional
expectations at a clean item boundary, so a comma-separated list
offered no continuation after a complete item: `order by Name `
gave no asc/desc, `select Name ` no `as`, `create table …
Code(text) ` no not/unique/default/check. Capture the last item's
skipped set and surface it when the list ends at an item boundary
(the separator `,` itself is deliberately not surfaced).

That fix made expression-position candidate lists long, which
exposed a visibility problem: the hint panel's candidate line is
single-row and window-scrolls on overflow, centring on item 0 when
nothing is selected — so with keywords-first, schema identifiers
scrolled off behind the `>` marker. Reverse the ordering: schema
identifiers (table/column/relationship names) now sort before
keywords, since a name the user would have to look up is the
highest-value completion and must stay visible (keywords are
learned over time; the tok_identifier/tok_keyword colour split
marks the boundary). This reverses the handoff-14 keywords-first
call, now recorded in ADR-0022 Amendment 2.

Tests: walker expected-set + completion-layer regressions for the
trailing-optionals and the ordering; candidate_ordering.rs header
invariant inverted; ~20 typing-surface snapshots re-baselined; a
two-line hint box recorded as a deferred follow-up.
This commit is contained in:
claude@clouddev1
2026-05-21 21:52:49 +00:00
parent 43c49f4d1b
commit 7f68a53f86
28 changed files with 716 additions and 329 deletions
@@ -480,6 +480,75 @@ re-baseline those snapshots. New snapshots cover:
The snapshots are the regression net for "did we change the
visual output unexpectedly".
## Amendment 2 — Candidate ordering: schema identifiers before keywords (2026-05-21)
This amendment **reverses the candidate-ordering call made in the
handoff-14 ranker discussion** (keywords before schema
identifiers). That call was never recorded in an ADR — it lived
only in `tests/typing_surface/candidate_ordering.rs` — so this
amendment also gives the ordering a decision record.
### The obsolete premise
Handoff-14 ordered command-part keywords before schema
identifiers on the rationale that "grammar parts are read before
the content that fills them," so `add column to table T` reads in
order. That held while candidate lists were short. The SQL surface
(ADR-0030/0031/0032/0033) made lists long — an expression position
such as `where Name ` or `order by ` legitimately offers the
column names *plus* the full expression-continuation keyword run
(`is not like between in and or`, plus `asc`/`desc` in ORDER BY).
The hint panel's candidate line is **single-row and
window-scrolled** (`render_candidate_line`): when it overflows it
centres on the selected item, or on item 0 when nothing is
selected (the ambient, just-typed state). With keywords first, the
schema identifiers sat at the tail and scrolled off behind the `>`
marker — invisible until the user Tab-cycled to them.
### The decision
Schema identifiers (table / column / relationship names) now sort
**before** keywords in the candidate list. A name the user would
otherwise have to look up is the highest-value completion —
valuable even to experts, who come to know the keywords over time —
so it must stay visible by default. Within each section the prior
rules are unchanged: identifiers alphabetised; keywords in
grammar-declaration order (`to` before `table`); then type names,
composite literals, branching punct, flags. The existing colour
split (`tok_identifier` teal vs `tok_keyword` purple, §colour)
makes the section boundary legible once both are on screen.
### Related fix — Repeated trailing optionals
This amendment shipped alongside a `walk_repeated` fix: a
comma-separated list (`Repeated`) was discarding the last matched
item's trailing-optional expectations at a clean item boundary, so
`order by Name ` offered no `asc`/`desc`, `select Name ` no `as`,
and `create table … Code(text) ` no `not`/`unique`/`default`/
`check`. Those now surface (the separator `,` itself is
deliberately not surfaced). This is what made identifier
visibility pressing — the lists these positions produce are now
both correct and long.
### Deferred — two-line hint box
As hint lists grow, a **two-line candidate box** (more candidates
visible without scrolling) is worth considering. Deferred for now
on screen-space grounds; recorded so it is not lost.
### Coverage
`tests/typing_surface/candidate_ordering.rs` rewritten to assert
identifiers precede keywords (header invariant #2 inverted; the
`to`-before-`table` keyword-order invariant #1 retained).
`completion::tests::identifiers_come_before_keywords_in_grammar_order`
and `identifiers_precede_keywords_at_expression_position` lock the
ordering; `order_by_after_sort_item_offers_direction`,
`projection_after_item_offers_alias_keyword`, and
`create_table_after_column_spec_offers_constraints` lock the
trailing-optional fix. ~20 typing-surface snapshots re-baselined.
## Out of scope
Deliberately deferred to keep this ADR shippable as a single
+1 -1
View File
@@ -27,7 +27,7 @@ This directory contains the project's ADRs, recorded per
- [ADR-0019 — Friendly error layer (H1) and i18n message catalog](0019-friendly-error-layer-and-i18n.md)
- [ADR-0020 — Tokenization layer for the DSL parser](0020-tokenization-layer-for-the-dsl-parser.md)
- [ADR-0021 — Parser-as-source-of-truth for H1a (per-command usage in parse errors)](0021-parser-as-source-of-truth-for-h1a.md)
- [ADR-0022 — Ambient typing assistance: colour, hint panel, completion (I3 + I4)](0022-ambient-typing-assistance.md) — **Amendment 1 supersedes §12's simple-mode-only carve-out**: the unified mode-aware walker (ADR-0030/0031/0032) now speaks SQL, so advanced-mode ambient assistance is re-enabled. `ambient_hint_in_mode` + `hint_resolution_at_input_in_mode` + `expected_for_hint_snapshot` thread `Mode`; `render_hint_panel` calls ambient for all modes (no more advanced-mode `None`); the one-shot `:` sigil is stripped before the ambient walk. Fixes a live bug where advanced-mode SQL hinting/completion-preview were dead despite Phase 2 marking them green (validated at the engine layer, not the UI). Simple-mode gating, highlighting, and the §13 performance posture are unchanged; covered by an app-level render test plus ambient-layer regression locks
- [ADR-0022 — Ambient typing assistance: colour, hint panel, completion (I3 + I4)](0022-ambient-typing-assistance.md) — **Amendment 1 supersedes §12's simple-mode-only carve-out**: the unified mode-aware walker (ADR-0030/0031/0032) now speaks SQL, so advanced-mode ambient assistance is re-enabled. `ambient_hint_in_mode` + `hint_resolution_at_input_in_mode` + `expected_for_hint_snapshot` thread `Mode`; `render_hint_panel` calls ambient for all modes (no more advanced-mode `None`); the one-shot `:` sigil is stripped before the ambient walk. Fixes a live bug where advanced-mode SQL hinting/completion-preview were dead despite Phase 2 marking them green (validated at the engine layer, not the UI). Simple-mode gating, highlighting, and the §13 performance posture are unchanged; covered by an app-level render test plus ambient-layer regression locks; **Amendment 2 reverses the handoff-14 keywords-first candidate ordering** — schema identifiers (table/column/relationship names) now sort *before* keywords so a name the user would have to look up stays visible in the single-row, window-scrolled candidate line (keywords are learned over time; the `tok_identifier`/`tok_keyword` colour split marks the boundary); shipped with a `walk_repeated` fix that surfaces a list item's trailing optionals at a clean boundary (`order by Name ``asc`/`desc`, `select Name ``as`, `create table … Code(text) ``not`/`unique`/`default`/`check`; the `,` separator deliberately not surfaced); records a deferred two-line hint box for growing lists
- [ADR-0023 — Unified declarative grammar tree](0023-unified-grammar-tree.md) — direction (superseded for execution detail by ADR-0024)
- [ADR-0024 — Unified grammar tree: execution plan](0024-unified-grammar-tree-execution-plan.md) — **Accepted**, the executable spec — implemented (Phases AF; Phase F shipped "minimal", `parser.rs` retained as the router — see the ADR's Phase F implementation note)
- [ADR-0025 — Indexes](0025-indexes.md) — **Accepted**, `add index` / `drop index`, persistence, rebuild-table preservation, and items-list display (`C3` index portion + `S2`)
+101 -25
View File
@@ -158,8 +158,8 @@ pub struct Completion {
/// Partial prefix the user has typed at the cursor. Empty
/// when the cursor is at a token boundary.
pub partial_prefix: String,
/// Fitting candidates, ordered keywords-first then
/// identifiers, alphabetised within each group, deduplicated.
/// Fitting candidates, ordered schema-identifiers-first then
/// keywords, alphabetised within each group, deduplicated.
pub candidates: Vec<Candidate>,
}
@@ -585,19 +585,26 @@ pub fn candidates_at_cursor_with_in_mode(
// ambiguity in the live render.
identifiers.retain(|name| !keywords.contains(name));
// Keywords first (grammar parts read before content),
// then type names (closed-set grammar — coloured as
// keywords), then composite literals (`1:n`, …), then
// branching punct (`(` opening a sub-shape), then flags
// (own colour), then schema identifiers.
// Schema identifiers first: a column / table name the user
// would otherwise have to look up is the highest-value
// completion (valuable to experts, not just learners, who
// come to know the keywords over time). Keywords and the
// other closed-set grammar parts follow: keywords, then type
// names (closed-set grammar — coloured as keywords), then
// composite literals (`1:n`, …), then branching punct (`(`
// opening a sub-shape), then flags (own colour).
let mut candidates: Vec<Candidate> = Vec::with_capacity(
keywords.len()
identifiers.len()
+ keywords.len()
+ type_names.len()
+ composites.len()
+ punct_candidates.len()
+ flags.len()
+ identifiers.len(),
+ flags.len(),
);
candidates.extend(identifiers.into_iter().map(|text| Candidate {
text,
kind: CandidateKind::Identifier,
}));
candidates.extend(keywords.into_iter().map(|text| Candidate {
text,
kind: CandidateKind::Keyword,
@@ -618,10 +625,6 @@ pub fn candidates_at_cursor_with_in_mode(
text,
kind: CandidateKind::Flag,
}));
candidates.extend(identifiers.into_iter().map(|text| Candidate {
text,
kind: CandidateKind::Identifier,
}));
if candidates.is_empty() {
return None;
@@ -1506,6 +1509,78 @@ mod tests {
}
}
#[test]
fn order_by_after_sort_item_offers_direction() {
use crate::dsl::types::Type;
// walk_repeated trailing-optional fix: after a complete
// sort item the direction keywords surface as
// continuations (previously discarded at the Repeated
// boundary, so completion offered neither).
let cache = schema_with_table(
"Things",
&[("Name", Type::Text), ("Qty", Type::Int)],
);
let input = "select Name from Things order by Name ";
let cs = cands_with(input, input.len(), &cache);
assert!(cs.contains(&"asc".to_string()), "got {cs:?}");
assert!(cs.contains(&"desc".to_string()), "got {cs:?}");
}
#[test]
fn projection_after_item_offers_alias_keyword() {
use crate::dsl::types::Type;
// walk_repeated trailing-optional fix: after a complete
// projection item the `as` alias keyword surfaces.
let cache = schema_with_table(
"Things",
&[("Name", Type::Text), ("Qty", Type::Int)],
);
let input = "select Name ";
let cs = cands_with(input, input.len(), &cache);
assert!(cs.contains(&"as".to_string()), "got {cs:?}");
}
#[test]
fn create_table_after_column_spec_offers_constraints() {
// walk_repeated trailing-optional fix: after a complete
// column spec the optional column constraints surface as
// continuations (was a bare "Submit with Enter" prose).
let input = "create table Customers with pk Code(text) ";
let cs = cands_with(input, input.len(), &SchemaCache::default());
for kw in ["not", "unique", "default", "check"] {
assert!(
cs.contains(&kw.to_string()),
"expected column-constraint `{kw}`; got {cs:?}",
);
}
}
#[test]
fn identifiers_precede_keywords_at_expression_position() {
use crate::dsl::types::Type;
// ADR-0022 Amendment 2: at an expression position offering
// both column names and keywords, every column precedes
// every keyword so the names stay visible by default.
let cache = schema_with_table(
"Things",
&[("Name", Type::Text), ("Qty", Type::Int)],
);
let input = "select * from Things where ";
let cs = cands_with(input, input.len(), &cache);
let pos = |needle: &str| {
cs.iter().position(|c| c == needle).unwrap_or_else(|| {
panic!("{needle:?} not in candidates: {cs:?}")
})
};
// Both columns come before any expression-start keyword.
let last_ident = pos("Name").max(pos("Qty"));
let first_kw = pos("not").min(pos("exists"));
assert!(
last_ident < first_kw,
"identifiers must precede keywords; got {cs:?}",
);
}
#[test]
fn update_where_offers_only_current_table_columns() {
use crate::dsl::types::Type;
@@ -1681,15 +1756,16 @@ mod tests {
}
#[test]
fn keywords_come_before_identifiers_in_grammar_order() {
// "add column " has both keyword candidates and
// schema-identifier candidates. Per the user's stage-8
// feedback round 2: keywords first in *grammar order*
// (so `to` before `table` because the canonical shape
// is `add column [to] [table] <Table>:…`), identifiers
// after, alphabetised. The grammar order falls out of
// chumsky's source-order expected-set traversal — we
// preserve that order through `describe_expected`.
fn identifiers_come_before_keywords_in_grammar_order() {
// "add column " has both schema-identifier candidates and
// keyword candidates. Per ADR-0022 Amendment 2: schema
// identifiers first (alphabetised) so the names the user
// would have to look up stay visible, then keywords in
// *grammar order* (`to` before `table` because the
// canonical shape is `add column [to] [table] <Table>:…`).
// The grammar order falls out of the walker's source-order
// expected-set traversal — we preserve that order through
// `describe_expected`.
let cache = SchemaCache {
tables: vec!["Customers".to_string(), "Orders".to_string()],
..SchemaCache::default()
@@ -1698,10 +1774,10 @@ mod tests {
assert_eq!(
kinds,
vec![
("to".to_string(), CandidateKind::Keyword),
("table".to_string(), CandidateKind::Keyword),
("Customers".to_string(), CandidateKind::Identifier),
("Orders".to_string(), CandidateKind::Identifier),
("to".to_string(), CandidateKind::Keyword),
("table".to_string(), CandidateKind::Keyword),
],
);
}
+29 -8
View File
@@ -698,6 +698,20 @@ fn walk_repeated(
let mut cur = position;
let mut count = 0_usize;
let mut last_expected: Option<Vec<Expectation>> = None;
// Trailing-optional expectations carried by the most recently
// matched item — e.g. `asc`/`desc` after an ORDER BY sort
// item, or a projection's `as` alias. Surfaced when the list
// ends cleanly at an item boundary so completion still offers
// the optional suffix the user could type next (handoff 31 —
// the `desc` follow-up to F5). The separator itself is
// deliberately NOT surfaced.
let mut last_item_skipped: Vec<Expectation> = Vec::new();
// Set when the loop stops because the separator did not match
// at an item boundary (a clean end of list), as opposed to an
// inner mismatch past an already-consumed separator. Only at a
// clean boundary are the last item's trailing optionals valid
// continuations at the cursor.
let mut ended_at_item_boundary = false;
loop {
let saved_path_len = path.items.len();
let saved_byte_len = per_byte.len();
@@ -720,6 +734,7 @@ fn walk_repeated(
NodeWalkResult::NoMatch { .. } => {
path.items.truncate(sep_saved_path);
per_byte.truncate(sep_saved_byte);
ended_at_item_boundary = true;
break;
}
other => return other,
@@ -728,9 +743,10 @@ fn walk_repeated(
walk_node(source, cur, inner, ctx, path, per_byte)
};
match result {
NodeWalkResult::Matched { end, .. } => {
NodeWalkResult::Matched { end, skipped } => {
cur = end;
count += 1;
last_item_skipped = skipped;
}
NodeWalkResult::NoMatch { expected, position: inner_pos } => {
// Mid-typing-the-next-item recovery: if the
@@ -771,13 +787,18 @@ fn walk_repeated(
expected: last_expected.unwrap_or_default(),
};
}
// The "could continue with another inner" expectations
// become this Repeated's `skipped` set so the caller's
// expected-set surfaces them at completion time.
NodeWalkResult::Matched {
end: cur,
skipped: last_expected.unwrap_or_default(),
}
// The "could continue" expectations become this Repeated's
// `skipped` set so the caller's expected-set surfaces them at
// completion time. When the list ended cleanly at an item
// boundary, that is the last item's trailing optionals (e.g.
// `asc`/`desc`); otherwise it is whatever the final inner
// attempt expected.
let skipped = if ended_at_item_boundary {
last_item_skipped
} else {
last_expected.unwrap_or_default()
};
NodeWalkResult::Matched { end: cur, skipped }
}
fn walk_bare_path(
+20
View File
@@ -4844,6 +4844,26 @@ mod order_by_expected_set_tests {
);
}
#[test]
fn order_by_after_sort_item_offers_direction() {
// After a complete sort item (`order by Name`) the
// sort-direction keywords are valid continuations.
// walk_repeated used to discard the item's trailing
// optionals, so completion offered neither.
let words = expected_words("select Name from T order by Name ");
assert!(words.contains(&"asc"), "expected `asc`; got {words:?}");
assert!(words.contains(&"desc"), "expected `desc`; got {words:?}");
// The separator is deliberately not surfaced (user choice).
let full = expected_at_input_in_mode(
"select Name from T order by Name ",
Mode::Advanced,
);
assert!(
!full.iter().any(|e| matches!(e, Expectation::Punct(','))),
"`,` separator should not be surfaced; got {full:?}",
);
}
#[test]
fn order_by_still_offers_a_sort_item() {
// Guard against over-correction: the legitimate sort-item
+30 -27
View File
@@ -1,21 +1,24 @@
//! Matrix coverage for completion-candidate *ordering*.
//!
//! The order candidates appear in is load-bearing for the hint
//! panel: it reads left-to-right, so the sequence must match
//! how the command is spoken. Two invariants the user called
//! out (handoff-14 ranker discussion):
//! panel: the candidate line is single-row and window-scrolls
//! when it overflows, so whatever sits first is what stays
//! visible by default. Two invariants:
//!
//! 1. Connective keywords appear in grammar-declaration / reading
//! order — `to` before `table` so `add column to table T`
//! reads correctly, never the jarring `table` / `to`.
//! 2. Command-part keywords appear before schema identifiers
//! (table / column names) — grammar parts are read before
//! the content that fills them.
//! 2. Schema identifiers (table / column names) appear *before*
//! command-part keywords. A name the user would otherwise
//! have to look up is the highest-value completion — valuable
//! even to experts, who come to know the keywords over time —
//! so it must stay visible by default rather than scroll off
//! behind the keyword run. (ADR-0022 Amendment 2; reverses the
//! earlier handoff-14 keywords-first call, which held only
//! while candidate lists were short.)
//!
//! These hold today via declaration-order preservation +
//! keywords-first sectioning in `candidates_at_cursor`. Nothing
//! pinned them until now, so a future grammar/sort change could
//! silently break the reading order.
//! These hold via declaration-order preservation +
//! identifiers-first sectioning in `candidates_at_cursor`.
use crate::typing_surface::*;
@@ -78,30 +81,30 @@ fn change_column_lists_in_before_table() {
}
// =========================================================
// Keywords-before-identifiers: at a position where both a
// Identifiers-before-keywords: at a position where both a
// connective keyword and schema table names are valid, the
// keyword comes first.
// schema identifiers come first (ADR-0022 Amendment 2).
// =========================================================
#[test]
fn add_column_keyword_precedes_table_identifiers() {
fn add_column_identifiers_precede_table_keywords() {
let schema = schema_multi_table();
let a = assess_at_end("add column ", &schema);
// `to` / `table` are command parts; Customers / Orders are
// schema identifiers — every keyword precedes every ident.
assert_before(&a, "table", "Customers");
assert_before(&a, "to", "Customers");
assert_before(&a, "to", "Orders");
crate::snap!("add_column_keyword_then_idents", a);
// Customers / Orders are schema identifiers; `to` / `table`
// are command parts — every ident precedes every keyword.
assert_before(&a, "Customers", "table");
assert_before(&a, "Customers", "to");
assert_before(&a, "Orders", "to");
crate::snap!("add_column_idents_then_keyword", a);
}
#[test]
fn drop_column_keyword_precedes_table_identifiers() {
fn drop_column_identifiers_precede_table_keywords() {
let schema = schema_multi_table();
let a = assess_at_end("drop column ", &schema);
assert_before(&a, "table", "Customers");
assert_before(&a, "from", "Orders");
crate::snap!("drop_column_keyword_then_idents", a);
assert_before(&a, "Customers", "table");
assert_before(&a, "Orders", "from");
crate::snap!("drop_column_idents_then_keyword", a);
}
#[test]
@@ -116,14 +119,14 @@ fn insert_into_table_keyword_precedes_nothing_when_only_idents() {
}
// =========================================================
// After consuming the first connective, the second still
// surfaces ahead of identifiers.
// After consuming the first connective, identifiers still
// surface ahead of the remaining keyword.
// =========================================================
#[test]
fn add_column_after_to_lists_table_before_identifiers() {
fn add_column_after_to_lists_identifiers_before_table() {
let schema = schema_multi_table();
let a = assess_at_end("add column to ", &schema);
assert_before(&a, "table", "Customers");
assert_before(&a, "Customers", "table");
crate::snap!("add_column_after_to", a);
}
@@ -1,5 +1,6 @@
---
source: tests/typing_surface/candidate_ordering.rs
assertion_line: 131
description: "input=\"add column to \" cursor=14"
expression: "& a"
---
@@ -10,10 +11,6 @@ Assessment {
hint: Some(
Candidates {
items: [
Candidate {
text: "table",
kind: Keyword,
},
Candidate {
text: "Customers",
kind: Identifier,
@@ -22,6 +19,10 @@ Assessment {
text: "Orders",
kind: Identifier,
},
Candidate {
text: "table",
kind: Keyword,
},
],
selected: None,
},
@@ -34,10 +35,6 @@ Assessment {
),
partial_prefix: "",
candidates: [
Candidate {
text: "table",
kind: Keyword,
},
Candidate {
text: "Customers",
kind: Identifier,
@@ -46,6 +43,10 @@ Assessment {
text: "Orders",
kind: Identifier,
},
Candidate {
text: "table",
kind: Keyword,
},
],
},
),
@@ -1,5 +1,6 @@
---
source: tests/typing_surface/candidate_ordering.rs
assertion_line: 98
description: "input=\"add column \" cursor=11"
expression: "& a"
---
@@ -10,14 +11,6 @@ Assessment {
hint: Some(
Candidates {
items: [
Candidate {
text: "to",
kind: Keyword,
},
Candidate {
text: "table",
kind: Keyword,
},
Candidate {
text: "Customers",
kind: Identifier,
@@ -26,6 +19,14 @@ Assessment {
text: "Orders",
kind: Identifier,
},
Candidate {
text: "to",
kind: Keyword,
},
Candidate {
text: "table",
kind: Keyword,
},
],
selected: None,
},
@@ -38,14 +39,6 @@ Assessment {
),
partial_prefix: "",
candidates: [
Candidate {
text: "to",
kind: Keyword,
},
Candidate {
text: "table",
kind: Keyword,
},
Candidate {
text: "Customers",
kind: Identifier,
@@ -54,6 +47,14 @@ Assessment {
text: "Orders",
kind: Identifier,
},
Candidate {
text: "to",
kind: Keyword,
},
Candidate {
text: "table",
kind: Keyword,
},
],
},
),
@@ -1,5 +1,6 @@
---
source: tests/typing_surface/candidate_ordering.rs
assertion_line: 56
description: "input=\"add column \" cursor=11"
expression: "& a"
---
@@ -10,14 +11,6 @@ Assessment {
hint: Some(
Candidates {
items: [
Candidate {
text: "to",
kind: Keyword,
},
Candidate {
text: "table",
kind: Keyword,
},
Candidate {
text: "Customers",
kind: Identifier,
@@ -26,6 +19,14 @@ Assessment {
text: "Orders",
kind: Identifier,
},
Candidate {
text: "to",
kind: Keyword,
},
Candidate {
text: "table",
kind: Keyword,
},
],
selected: None,
},
@@ -38,14 +39,6 @@ Assessment {
),
partial_prefix: "",
candidates: [
Candidate {
text: "to",
kind: Keyword,
},
Candidate {
text: "table",
kind: Keyword,
},
Candidate {
text: "Customers",
kind: Identifier,
@@ -54,6 +47,14 @@ Assessment {
text: "Orders",
kind: Identifier,
},
Candidate {
text: "to",
kind: Keyword,
},
Candidate {
text: "table",
kind: Keyword,
},
],
},
),
@@ -1,5 +1,6 @@
---
source: tests/typing_surface/candidate_ordering.rs
assertion_line: 80
description: "input=\"change column \" cursor=14"
expression: "& a"
---
@@ -10,14 +11,6 @@ Assessment {
hint: Some(
Candidates {
items: [
Candidate {
text: "in",
kind: Keyword,
},
Candidate {
text: "table",
kind: Keyword,
},
Candidate {
text: "Customers",
kind: Identifier,
@@ -26,6 +19,14 @@ Assessment {
text: "Orders",
kind: Identifier,
},
Candidate {
text: "in",
kind: Keyword,
},
Candidate {
text: "table",
kind: Keyword,
},
],
selected: None,
},
@@ -38,14 +39,6 @@ Assessment {
),
partial_prefix: "",
candidates: [
Candidate {
text: "in",
kind: Keyword,
},
Candidate {
text: "table",
kind: Keyword,
},
Candidate {
text: "Customers",
kind: Identifier,
@@ -54,6 +47,14 @@ Assessment {
text: "Orders",
kind: Identifier,
},
Candidate {
text: "in",
kind: Keyword,
},
Candidate {
text: "table",
kind: Keyword,
},
],
},
),
@@ -1,5 +1,6 @@
---
source: tests/typing_surface/candidate_ordering.rs
assertion_line: 107
description: "input=\"drop column \" cursor=12"
expression: "& a"
---
@@ -10,14 +11,6 @@ Assessment {
hint: Some(
Candidates {
items: [
Candidate {
text: "from",
kind: Keyword,
},
Candidate {
text: "table",
kind: Keyword,
},
Candidate {
text: "Customers",
kind: Identifier,
@@ -26,6 +19,14 @@ Assessment {
text: "Orders",
kind: Identifier,
},
Candidate {
text: "from",
kind: Keyword,
},
Candidate {
text: "table",
kind: Keyword,
},
],
selected: None,
},
@@ -38,14 +39,6 @@ Assessment {
),
partial_prefix: "",
candidates: [
Candidate {
text: "from",
kind: Keyword,
},
Candidate {
text: "table",
kind: Keyword,
},
Candidate {
text: "Customers",
kind: Identifier,
@@ -54,6 +47,14 @@ Assessment {
text: "Orders",
kind: Identifier,
},
Candidate {
text: "from",
kind: Keyword,
},
Candidate {
text: "table",
kind: Keyword,
},
],
},
),
@@ -1,5 +1,6 @@
---
source: tests/typing_surface/candidate_ordering.rs
assertion_line: 64
description: "input=\"drop column \" cursor=12"
expression: "& a"
---
@@ -10,14 +11,6 @@ Assessment {
hint: Some(
Candidates {
items: [
Candidate {
text: "from",
kind: Keyword,
},
Candidate {
text: "table",
kind: Keyword,
},
Candidate {
text: "Customers",
kind: Identifier,
@@ -26,6 +19,14 @@ Assessment {
text: "Orders",
kind: Identifier,
},
Candidate {
text: "from",
kind: Keyword,
},
Candidate {
text: "table",
kind: Keyword,
},
],
selected: None,
},
@@ -38,14 +39,6 @@ Assessment {
),
partial_prefix: "",
candidates: [
Candidate {
text: "from",
kind: Keyword,
},
Candidate {
text: "table",
kind: Keyword,
},
Candidate {
text: "Customers",
kind: Identifier,
@@ -54,6 +47,14 @@ Assessment {
text: "Orders",
kind: Identifier,
},
Candidate {
text: "from",
kind: Keyword,
},
Candidate {
text: "table",
kind: Keyword,
},
],
},
),
@@ -1,5 +1,6 @@
---
source: tests/typing_surface/candidate_ordering.rs
assertion_line: 72
description: "input=\"rename column \" cursor=14"
expression: "& a"
---
@@ -10,14 +11,6 @@ Assessment {
hint: Some(
Candidates {
items: [
Candidate {
text: "in",
kind: Keyword,
},
Candidate {
text: "table",
kind: Keyword,
},
Candidate {
text: "Customers",
kind: Identifier,
@@ -26,6 +19,14 @@ Assessment {
text: "Orders",
kind: Identifier,
},
Candidate {
text: "in",
kind: Keyword,
},
Candidate {
text: "table",
kind: Keyword,
},
],
selected: None,
},
@@ -38,14 +39,6 @@ Assessment {
),
partial_prefix: "",
candidates: [
Candidate {
text: "in",
kind: Keyword,
},
Candidate {
text: "table",
kind: Keyword,
},
Candidate {
text: "Customers",
kind: Identifier,
@@ -54,6 +47,14 @@ Assessment {
text: "Orders",
kind: Identifier,
},
Candidate {
text: "in",
kind: Keyword,
},
Candidate {
text: "table",
kind: Keyword,
},
],
},
),
@@ -1,5 +1,6 @@
---
source: tests/typing_surface/constraints.rs
assertion_line: 30
description: "input=\"create table Ages with pk age(int) check (age >= 0)\" cursor=51"
expression: "& a"
---
@@ -8,11 +9,55 @@ Assessment {
cursor: 51,
state: Valid,
hint: Some(
Prose(
"Submit with Enter",
),
Candidates {
items: [
Candidate {
text: "not",
kind: Keyword,
},
Candidate {
text: "unique",
kind: Keyword,
},
Candidate {
text: "default",
kind: Keyword,
},
Candidate {
text: "check",
kind: Keyword,
},
],
selected: None,
},
),
completion: Some(
Completion {
replaced_range: (
51,
51,
),
partial_prefix: "",
candidates: [
Candidate {
text: "not",
kind: Keyword,
},
Candidate {
text: "unique",
kind: Keyword,
},
Candidate {
text: "default",
kind: Keyword,
},
Candidate {
text: "check",
kind: Keyword,
},
],
},
),
completion: None,
parse_result: Ok(
"CreateTable",
),
@@ -1,5 +1,6 @@
---
source: tests/typing_surface/constraints.rs
assertion_line: 19
description: "input=\"create table Books with pk isbn(text) default '000'\" cursor=51"
expression: "& a"
---
@@ -8,11 +9,55 @@ Assessment {
cursor: 51,
state: Valid,
hint: Some(
Prose(
"Submit with Enter",
),
Candidates {
items: [
Candidate {
text: "not",
kind: Keyword,
},
Candidate {
text: "unique",
kind: Keyword,
},
Candidate {
text: "default",
kind: Keyword,
},
Candidate {
text: "check",
kind: Keyword,
},
],
selected: None,
},
),
completion: Some(
Completion {
replaced_range: (
51,
51,
),
partial_prefix: "",
candidates: [
Candidate {
text: "not",
kind: Keyword,
},
Candidate {
text: "unique",
kind: Keyword,
},
Candidate {
text: "default",
kind: Keyword,
},
Candidate {
text: "check",
kind: Keyword,
},
],
},
),
completion: None,
parse_result: Ok(
"CreateTable",
),
@@ -1,5 +1,6 @@
---
source: tests/typing_surface/create_table.rs
assertion_line: 117
description: "input=\"create table Memberships with pk UserId(int), GroupId(int)\" cursor=58"
expression: "& a"
---
@@ -8,11 +9,55 @@ Assessment {
cursor: 58,
state: Valid,
hint: Some(
Prose(
"Submit with Enter",
),
Candidates {
items: [
Candidate {
text: "not",
kind: Keyword,
},
Candidate {
text: "unique",
kind: Keyword,
},
Candidate {
text: "default",
kind: Keyword,
},
Candidate {
text: "check",
kind: Keyword,
},
],
selected: None,
},
),
completion: Some(
Completion {
replaced_range: (
58,
58,
),
partial_prefix: "",
candidates: [
Candidate {
text: "not",
kind: Keyword,
},
Candidate {
text: "unique",
kind: Keyword,
},
Candidate {
text: "default",
kind: Keyword,
},
Candidate {
text: "check",
kind: Keyword,
},
],
},
),
completion: None,
parse_result: Ok(
"CreateTable",
),
@@ -1,5 +1,6 @@
---
source: tests/typing_surface/create_table.rs
assertion_line: 106
description: "input=\"create table Customers with pk Code(text)\" cursor=41"
expression: "& a"
---
@@ -8,11 +9,55 @@ Assessment {
cursor: 41,
state: Valid,
hint: Some(
Prose(
"Submit with Enter",
),
Candidates {
items: [
Candidate {
text: "not",
kind: Keyword,
},
Candidate {
text: "unique",
kind: Keyword,
},
Candidate {
text: "default",
kind: Keyword,
},
Candidate {
text: "check",
kind: Keyword,
},
],
selected: None,
},
),
completion: Some(
Completion {
replaced_range: (
41,
41,
),
partial_prefix: "",
candidates: [
Candidate {
text: "not",
kind: Keyword,
},
Candidate {
text: "unique",
kind: Keyword,
},
Candidate {
text: "default",
kind: Keyword,
},
Candidate {
text: "check",
kind: Keyword,
},
],
},
),
completion: None,
parse_result: Ok(
"CreateTable",
),
@@ -1,5 +1,6 @@
---
source: tests/typing_surface/delete_with_where.rs
assertion_line: 60
description: "input=\"delete from Customers where Email=\" cursor=34"
expression: "& a"
---
@@ -20,18 +21,6 @@ Assessment {
),
partial_prefix: "",
candidates: [
Candidate {
text: "null",
kind: Keyword,
},
Candidate {
text: "true",
kind: Keyword,
},
Candidate {
text: "false",
kind: Keyword,
},
Candidate {
text: "Email",
kind: Identifier,
@@ -44,6 +33,18 @@ Assessment {
text: "id",
kind: Identifier,
},
Candidate {
text: "null",
kind: Keyword,
},
Candidate {
text: "true",
kind: Keyword,
},
Candidate {
text: "false",
kind: Keyword,
},
],
},
),
@@ -1,5 +1,6 @@
---
source: tests/typing_surface/delete_with_where.rs
assertion_line: 39
description: "input=\"delete from Customers where \" cursor=28"
expression: "& a"
---
@@ -10,6 +11,14 @@ Assessment {
hint: Some(
Candidates {
items: [
Candidate {
text: "Name",
kind: Identifier,
},
Candidate {
text: "id",
kind: Identifier,
},
Candidate {
text: "not",
kind: Keyword,
@@ -30,14 +39,6 @@ Assessment {
text: "(",
kind: Punct,
},
Candidate {
text: "Name",
kind: Identifier,
},
Candidate {
text: "id",
kind: Identifier,
},
],
selected: None,
},
@@ -50,6 +51,14 @@ Assessment {
),
partial_prefix: "",
candidates: [
Candidate {
text: "Name",
kind: Identifier,
},
Candidate {
text: "id",
kind: Identifier,
},
Candidate {
text: "not",
kind: Keyword,
@@ -70,14 +79,6 @@ Assessment {
text: "(",
kind: Punct,
},
Candidate {
text: "Name",
kind: Identifier,
},
Candidate {
text: "id",
kind: Identifier,
},
],
},
),
@@ -1,5 +1,6 @@
---
source: tests/typing_surface/delete_with_where.rs
assertion_line: 86
description: "input=\"delete from Things where ts=\" cursor=28"
expression: "& a"
---
@@ -20,18 +21,6 @@ Assessment {
),
partial_prefix: "",
candidates: [
Candidate {
text: "null",
kind: Keyword,
},
Candidate {
text: "true",
kind: Keyword,
},
Candidate {
text: "false",
kind: Keyword,
},
Candidate {
text: "auto",
kind: Identifier,
@@ -72,6 +61,18 @@ Assessment {
text: "ts",
kind: Identifier,
},
Candidate {
text: "null",
kind: Keyword,
},
Candidate {
text: "true",
kind: Keyword,
},
Candidate {
text: "false",
kind: Keyword,
},
],
},
),
@@ -1,5 +1,6 @@
---
source: tests/typing_surface/drop_column.rs
assertion_line: 19
description: "input=\"drop column from \" cursor=17"
expression: "& a"
---
@@ -10,10 +11,6 @@ Assessment {
hint: Some(
Candidates {
items: [
Candidate {
text: "table",
kind: Keyword,
},
Candidate {
text: "Customers",
kind: Identifier,
@@ -22,6 +19,10 @@ Assessment {
text: "Orders",
kind: Identifier,
},
Candidate {
text: "table",
kind: Keyword,
},
],
selected: None,
},
@@ -34,10 +35,6 @@ Assessment {
),
partial_prefix: "",
candidates: [
Candidate {
text: "table",
kind: Keyword,
},
Candidate {
text: "Customers",
kind: Identifier,
@@ -46,6 +43,10 @@ Assessment {
text: "Orders",
kind: Identifier,
},
Candidate {
text: "table",
kind: Keyword,
},
],
},
),
@@ -1,5 +1,6 @@
---
source: tests/typing_surface/drop_relationship.rs
assertion_line: 37
description: "input=\"drop relationship \" cursor=18"
expression: "& a"
---
@@ -10,14 +11,14 @@ Assessment {
hint: Some(
Candidates {
items: [
Candidate {
text: "from",
kind: Keyword,
},
Candidate {
text: "Orders_CustId_to_Customers",
kind: Identifier,
},
Candidate {
text: "from",
kind: Keyword,
},
],
selected: None,
},
@@ -30,14 +31,14 @@ Assessment {
),
partial_prefix: "",
candidates: [
Candidate {
text: "from",
kind: Keyword,
},
Candidate {
text: "Orders_CustId_to_Customers",
kind: Identifier,
},
Candidate {
text: "from",
kind: Keyword,
},
],
},
),
@@ -1,5 +1,6 @@
---
source: tests/typing_surface/explain.rs
assertion_line: 54
description: "input=\"explain show data Customers where \" cursor=34"
expression: "& a"
---
@@ -10,6 +11,14 @@ Assessment {
hint: Some(
Candidates {
items: [
Candidate {
text: "Name",
kind: Identifier,
},
Candidate {
text: "id",
kind: Identifier,
},
Candidate {
text: "not",
kind: Keyword,
@@ -30,14 +39,6 @@ Assessment {
text: "(",
kind: Punct,
},
Candidate {
text: "Name",
kind: Identifier,
},
Candidate {
text: "id",
kind: Identifier,
},
],
selected: None,
},
@@ -50,6 +51,14 @@ Assessment {
),
partial_prefix: "",
candidates: [
Candidate {
text: "Name",
kind: Identifier,
},
Candidate {
text: "id",
kind: Identifier,
},
Candidate {
text: "not",
kind: Keyword,
@@ -70,14 +79,6 @@ Assessment {
text: "(",
kind: Punct,
},
Candidate {
text: "Name",
kind: Identifier,
},
Candidate {
text: "id",
kind: Identifier,
},
],
},
),
@@ -1,5 +1,6 @@
---
source: tests/typing_surface/update_with_where.rs
assertion_line: 152
description: "input=\"update Customers set Email='x' where id=\" cursor=40"
expression: "& a"
---
@@ -20,18 +21,6 @@ Assessment {
),
partial_prefix: "",
candidates: [
Candidate {
text: "null",
kind: Keyword,
},
Candidate {
text: "true",
kind: Keyword,
},
Candidate {
text: "false",
kind: Keyword,
},
Candidate {
text: "Email",
kind: Identifier,
@@ -44,6 +33,18 @@ Assessment {
text: "id",
kind: Identifier,
},
Candidate {
text: "null",
kind: Keyword,
},
Candidate {
text: "true",
kind: Keyword,
},
Candidate {
text: "false",
kind: Keyword,
},
],
},
),
@@ -1,5 +1,6 @@
---
source: tests/typing_surface/update_with_where.rs
assertion_line: 135
description: "input=\"update Customers set Name='x' where \" cursor=36"
expression: "& a"
---
@@ -10,6 +11,14 @@ Assessment {
hint: Some(
Candidates {
items: [
Candidate {
text: "Name",
kind: Identifier,
},
Candidate {
text: "id",
kind: Identifier,
},
Candidate {
text: "not",
kind: Keyword,
@@ -30,14 +39,6 @@ Assessment {
text: "(",
kind: Punct,
},
Candidate {
text: "Name",
kind: Identifier,
},
Candidate {
text: "id",
kind: Identifier,
},
],
selected: None,
},
@@ -50,6 +51,14 @@ Assessment {
),
partial_prefix: "",
candidates: [
Candidate {
text: "Name",
kind: Identifier,
},
Candidate {
text: "id",
kind: Identifier,
},
Candidate {
text: "not",
kind: Keyword,
@@ -70,14 +79,6 @@ Assessment {
text: "(",
kind: Punct,
},
Candidate {
text: "Name",
kind: Identifier,
},
Candidate {
text: "id",
kind: Identifier,
},
],
},
),
@@ -1,5 +1,6 @@
---
source: tests/typing_surface/where_expression.rs
assertion_line: 42
description: "input=\"delete from Customers where not \" cursor=32"
expression: "& a"
---
@@ -10,6 +11,18 @@ Assessment {
hint: Some(
Candidates {
items: [
Candidate {
text: "Email",
kind: Identifier,
},
Candidate {
text: "Name",
kind: Identifier,
},
Candidate {
text: "id",
kind: Identifier,
},
Candidate {
text: "not",
kind: Keyword,
@@ -30,18 +43,6 @@ Assessment {
text: "(",
kind: Punct,
},
Candidate {
text: "Email",
kind: Identifier,
},
Candidate {
text: "Name",
kind: Identifier,
},
Candidate {
text: "id",
kind: Identifier,
},
],
selected: None,
},
@@ -54,6 +55,18 @@ Assessment {
),
partial_prefix: "",
candidates: [
Candidate {
text: "Email",
kind: Identifier,
},
Candidate {
text: "Name",
kind: Identifier,
},
Candidate {
text: "id",
kind: Identifier,
},
Candidate {
text: "not",
kind: Keyword,
@@ -74,18 +87,6 @@ Assessment {
text: "(",
kind: Punct,
},
Candidate {
text: "Email",
kind: Identifier,
},
Candidate {
text: "Name",
kind: Identifier,
},
Candidate {
text: "id",
kind: Identifier,
},
],
},
),
@@ -1,5 +1,6 @@
---
source: tests/typing_surface/where_expression.rs
assertion_line: 50
description: "input=\"delete from Things where k between \" cursor=35"
expression: "& a"
---
@@ -20,18 +21,6 @@ Assessment {
),
partial_prefix: "",
candidates: [
Candidate {
text: "null",
kind: Keyword,
},
Candidate {
text: "true",
kind: Keyword,
},
Candidate {
text: "false",
kind: Keyword,
},
Candidate {
text: "auto",
kind: Identifier,
@@ -72,6 +61,18 @@ Assessment {
text: "ts",
kind: Identifier,
},
Candidate {
text: "null",
kind: Keyword,
},
Candidate {
text: "true",
kind: Keyword,
},
Candidate {
text: "false",
kind: Keyword,
},
],
},
),
@@ -1,5 +1,6 @@
---
source: tests/typing_surface/where_expression.rs
assertion_line: 58
description: "input=\"delete from Things where k in (\" cursor=31"
expression: "& a"
---
@@ -20,18 +21,6 @@ Assessment {
),
partial_prefix: "",
candidates: [
Candidate {
text: "null",
kind: Keyword,
},
Candidate {
text: "true",
kind: Keyword,
},
Candidate {
text: "false",
kind: Keyword,
},
Candidate {
text: "auto",
kind: Identifier,
@@ -72,6 +61,18 @@ Assessment {
text: "ts",
kind: Identifier,
},
Candidate {
text: "null",
kind: Keyword,
},
Candidate {
text: "true",
kind: Keyword,
},
Candidate {
text: "false",
kind: Keyword,
},
],
},
),