TODO §68.2: an unfinished port connection stays in its own entry, and its errors wait until you pause

Parser (tolerant mode only, parser/recover_list.rs): a lone '.', a
'.name(' left open at its line end and a trailing ',' in a named list are
recovered inside their entry — always a diagnostic, never silent; strict
mode and valid code are unchanged (1 026 inputs old vs new: identical
strict results and trees, byte-identical CLI output; corpus 814/6).
Server (state/port_grace.rs): diagnostics that start inside the entry the
last edit touched, in a named-connection list of an instance, are withheld
for 1.5 s and released by the loop's timeout, an edit elsewhere or a save;
a pulling client that supports it gets workspace/diagnostic/refresh.
A trailing ',' in a named list is now reported in tolerant mode too.
Dev + QA (Opus 5.5); QA failed one gate (lucisv_mcp qa_f1), one fix
round, re-check passed: parser 521, server 1954, mcp 383, formatter 352.
Not yet seen in a running VS Code. docs/features/port-entry-grace; topo
rows for §68.1 and §68.2.

Co-Authored-By: Claude Mythos 5.2 <[email protected]>
This commit is contained in:
lucioandClaude Mythos 5.2 committed 2026-11-17 15:40:58 -08:00
1 parent c1076f9405
commit 14213f6a93
19 files changed
+2396 -25

No files matched your search

+15 -6
View File
@@ -320,12 +320,13 @@ impl<'a> Parser<'a> {
if !self.cur().is_sym(")") {
loop {
let at = self.pos;
list.push(self.element_or_recover(|p| p.parse_connection())?);
list.push(self.connection_or_recover()?);
let recovered = list.last().is_some_and(ListElem::is_error);
if let Some(ListElem::Ok(last)) = list.last_mut() {
self.take_before_sep(&mut last.meta, ",");
}
let comma = self.eat_sym(",");
self.note_trailing_comma(comma);
if let Some(ListElem::Ok(last)) = list.last_mut() {
last.comma = comma;
if comma && last.meta.trailing.is_none() {
@@ -338,7 +339,7 @@ impl<'a> Parser<'a> {
// the list, and after a directive only the closing bracket
// does — an `` `ifdef`` arm may end without a comma and
// still be followed by an `` `else`` arm.
if self.list_ends(at, comma, dirs.any, recovered) {
if self.connection_list_ends(at, comma, dirs.any, recovered) {
break;
}
}
@@ -437,12 +438,13 @@ impl<'a> Parser<'a> {
let mut conns = Vec::new();
loop {
let at = self.pos;
conns.push(self.element_or_recover(|p| p.parse_connection())?);
conns.push(self.connection_or_recover()?);
let recovered = conns.last().is_some_and(ListElem::is_error);
if let Some(ListElem::Ok(last)) = conns.last_mut() {
self.take_before_sep(&mut last.meta, ",");
}
let comma = self.eat_sym(",");
self.note_trailing_comma(comma);
if let Some(ListElem::Ok(last)) = conns.last_mut() {
last.comma = comma;
if comma && last.meta.trailing.is_none() {
@@ -450,7 +452,7 @@ impl<'a> Parser<'a> {
}
}
let dirs = self.take_list_directives(directives, conns.len());
if self.list_ends(at, comma, dirs.any, recovered) {
if self.connection_list_ends(at, comma, dirs.any, recovered) {
break;
}
}
@@ -560,8 +562,15 @@ impl<'a> Parser<'a> {
// arguments — so the greedy parse swallows the instance and the
// whole instantiation collapses into one error item. Failing the
// element here costs the one connection and keeps everything
// else. See `docs/features/small-items-3/README.md`.
if self.tolerant && self.cur().is_sym("(") && self.value_runs_into_next_instance() {
// else. See `docs/features/small-items-3/README.md`. The same
// failure covers a `.NAME(` left open at the end of its line while
// the next line goes on with the list (`.po(` ⏎ `.b(y));`): the
// entry ends with its line, and the diagnostic is on its `(`
// (`docs/features/port-entry-grace/README.md`).
if self.tolerant
&& self.cur().is_sym("(")
&& (self.value_runs_into_next_instance() || self.value_left_open())
{
return self.error("unclosed `(` in a port or parameter connection");
}
let mut close_comments = Vec::new();