hint: replace misleading "null true false" suggestions at value slots
At value-literal slots (`insert into T values (`, `update T set
col=`, `where col=`, comma positions) the expected-token set
contains null/true/false/number/string-literal. The completion
engine was surfacing the three keyword candidates as Tab options
— actively misleading because the user is usually about to enter
a number, quoted text, or date, and seeing "null true false"
implies those are *the* options. User report (round-6 testing):
"especially not when I'm trying to insert a datetime value and
don't know the correct format for the literal".
Fix: detect the value-literal slot by its expected-set
fingerprint. Suppress Tab candidates at empty prefix. Surface a
prose hint listing all literal forms with format examples
('YYYY-MM-DD' for dates, 'YYYY-MM-DDTHH:MM:SS' for datetimes).
Once the user starts typing a prefix (n / tr / fa), normal
keyword completion still applies.
Schema-aware narrowing (show ONLY the datetime format at a
datetime column) waits on ADR-0023.
Tests: 769 -> 777 passing (+8). Clippy clean.
This commit is contained in:
@@ -188,6 +188,13 @@ pub fn ambient_hint(
|
||||
selected: None,
|
||||
});
|
||||
}
|
||||
// Value-literal slot at empty prefix: candidates_at_cursor
|
||||
// returned None (it suppresses null/true/false here to avoid
|
||||
// implying they're the only options). Surface a prose hint
|
||||
// that names all valid literal forms with format examples.
|
||||
if let Some(prose) = crate::completion::value_literal_hint_at_cursor(input, cursor) {
|
||||
return Some(AmbientHint::Prose(prose));
|
||||
}
|
||||
// User typing into a NewName slot — show the friendlier
|
||||
// "type a name" hint rather than the technical "next: …"
|
||||
// that the post-consumed-partial parse would otherwise
|
||||
|
||||
Reference in New Issue
Block a user