Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
23e2e4bca5 | ||
|
|
a2a22adad8 | ||
|
|
9d1eb1671e | ||
|
|
5d70cb89cc |
No files matched your search
@@ -4,6 +4,51 @@ All notable changes to lucisv are recorded here. Versions follow
|
||||
[semantic versioning](https://semver.org/); until 1.0 the CLI's exit codes
|
||||
(see `README.md`) are the only frozen contract.
|
||||
|
||||
## 0.55.0 — 2026-09-17
|
||||
|
||||
### Loop 3, round 2 — find-references reaches a module's internals
|
||||
|
||||
- **References see every cross-file use of a module's nets, variables
|
||||
and instances.** With `module leaf` declaring `logic sig` and another
|
||||
file writing `assign w = u_leaf.sig;` (or a `bind` directive naming
|
||||
`sig` in a connection), Find All References from the declaration
|
||||
answered `leaf.sv` alone — while a rename already edited both files.
|
||||
The two index questions behind references asked the module's
|
||||
*connection* surface (ports and parameters), which cannot hold an
|
||||
internal net; they now ask the *hierarchical* surface, the one a path
|
||||
in another file actually reaches the declaration by. Every answer for
|
||||
a port, parameter, package member, class field or struct field is
|
||||
byte-for-byte what it was. Hover's declaration snippet uses the same
|
||||
lookup and now shows the live line for such a signal in an edited
|
||||
buffer. On the opentitan tree, references on `aes.sv`'s
|
||||
`entropy_masking_req` now list `aes_bind.sv`, and `state_q` in
|
||||
`entropy_src_main_sm.sv` lists its use in `entropy_src_core.sv`.
|
||||
(`docs/features/references-hierarchical-surface/README.md`.)
|
||||
- **A closed declaring file's own uses are in the answer.** The index
|
||||
deliberately posts no in-file references for a module's internal
|
||||
signals (a table sized by every RTL body, for a rarely asked
|
||||
question), so a request from another file into a declaring file
|
||||
nobody has open used to list the cross-file sites and silently omit
|
||||
that file's own `assign … = sig;` lines. That one file is now parsed
|
||||
once, on exactly that request shape — 0.4–1.5 ms on a real design
|
||||
file, the same trade a rename already makes.
|
||||
- **A stale index may omit a location; it can never point at a wrong
|
||||
line.** Three QA rounds found that a span recorded at index time, or
|
||||
computed against one read of a closed file, could be rendered against
|
||||
a different read of the same file after an external edit (another
|
||||
tool, `git checkout`, a build step) and land on a line that no longer
|
||||
holds the name. Each closed file is now read exactly once per
|
||||
request, and every index-time span — closed files and the
|
||||
open-buffer declaration fallback alike — must still spell the name
|
||||
exactly where it is rendered, or it is dropped. Escaped identifiers,
|
||||
UTF-8 boundaries, a deleted declaring file and a name that is both a
|
||||
port and a net are covered by tests; references and rename are
|
||||
asserted to agree with the whole-scope engine.
|
||||
- Cost, accepted and recorded in `docs/perf/README.md`: a references
|
||||
request on a heavily used local net in a 40 000-line buffer now
|
||||
walks the indexed path, 1.22 → 1.54 ms median; every other harness
|
||||
row unchanged.
|
||||
|
||||
## 0.54.0 — 2026-09-12
|
||||
|
||||
### Loop 3, round 1 — a rename correctness fix and a faster first edit
|
||||
|
||||
Generated
+8
-8
@@ -97,7 +97,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "lucisv"
|
||||
version = "0.54.0"
|
||||
version = "0.55.0"
|
||||
dependencies = [
|
||||
"lucisv_core",
|
||||
"rayon",
|
||||
@@ -108,11 +108,11 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "lucisv_core"
|
||||
version = "0.54.0"
|
||||
version = "0.55.0"
|
||||
|
||||
[[package]]
|
||||
name = "lucisv_server"
|
||||
version = "0.54.0"
|
||||
version = "0.55.0"
|
||||
dependencies = [
|
||||
"lsp-server",
|
||||
"lsp-types",
|
||||
@@ -248,14 +248,14 @@ checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75"
|
||||
|
||||
[[package]]
|
||||
name = "vlog_formatter"
|
||||
version = "0.54.0"
|
||||
version = "0.55.0"
|
||||
dependencies = [
|
||||
"vlog_parser",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "vlog_linter"
|
||||
version = "0.54.0"
|
||||
version = "0.55.0"
|
||||
dependencies = [
|
||||
"lucisv_core",
|
||||
"vlog_formatter",
|
||||
@@ -265,11 +265,11 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "vlog_parser"
|
||||
version = "0.54.0"
|
||||
version = "0.55.0"
|
||||
|
||||
[[package]]
|
||||
name = "vlog_refactor"
|
||||
version = "0.54.0"
|
||||
version = "0.55.0"
|
||||
dependencies = [
|
||||
"vlog_formatter",
|
||||
"vlog_parser",
|
||||
@@ -278,7 +278,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "vlog_semantic"
|
||||
version = "0.54.0"
|
||||
version = "0.55.0"
|
||||
dependencies = [
|
||||
"vlog_parser",
|
||||
]
|
||||
+1
-1
@@ -12,7 +12,7 @@ members = [
|
||||
]
|
||||
|
||||
[workspace.package]
|
||||
version = "0.54.0"
|
||||
version = "0.55.0"
|
||||
authors = ["Guoliang Chen"]
|
||||
edition = "2021"
|
||||
license = "MIT"
|
||||
|
||||
@@ -6810,5 +6810,126 @@ code_action.rs}`, `crates/vlog_parser/src/{lexer.rs,parser/,lib.rs}`,
|
||||
|
||||
### 63.3 Closing
|
||||
|
||||
- [ ] `docs/perf/README.md` entry; topo rows for every contract amended;
|
||||
release 0.54.0 with assets verified
|
||||
- [x] `docs/perf/README.md` entry; topo rows for every contract amended;
|
||||
release 0.54.0 with assets verified — done 2026-09-12: **0.54.0**
|
||||
(da32237, v0.54.0), 8 assets, the darwin-arm64 vsix at 0.54.0 with
|
||||
both binaries, `hierarchySections.js`, `extract.js`, no `*_test.js`.
|
||||
|
||||
## 64. Loop 3, round 2 (planned 2026-09-12) — cross-file references for hierarchical-surface-only declarations
|
||||
|
||||
One lane. The dev half runs in the owner's spawned session
|
||||
(`task_d8afe80f`, its own worktree); QA (Sonnet) and the lead's review run
|
||||
on that result in the main tree after it lands. Same rules as §63: guard
|
||||
every suite and sweep, no `sleep` over 60 s, no `pgrep -f`, opentitan
|
||||
read-only. Ships as 0.55.0.
|
||||
|
||||
### 64.1 `references` stops at the connection surface (QA §63.1, `task_d8afe80f`)
|
||||
|
||||
`crates/lucisv_server/src/nav.rs`: `leaves_this_file` (~148) and
|
||||
`indexed_def_in_file` (~235; `indexed_def_for_symbol` is shared with
|
||||
`hover.rs`) decide whether a declaration can be referenced from another file
|
||||
by `WorkspaceIndex::member(unit, name)` — the **connection** surface, ports
|
||||
and parameters. A module's net, variable or instance lives on the
|
||||
**hierarchical** surface only (`workspace/hierarchy.rs`, since 2026-09-05), so
|
||||
both functions treat such a declaration as unable to leave its file. Two
|
||||
symptoms, pinned by
|
||||
`nav.rs::a_binds_connection_expression_is_reachable_by_definition_not_yet_by_references`:
|
||||
`references` from the *declaration* of a hierarchically reached net falls to
|
||||
the single-file fallback and never sees a cross-file use (a `bind`
|
||||
connection or an ordinary `u_x.sig` tail alike); `references` from a *use*
|
||||
that does resolve cross-file cannot re-identify the open buffer's own
|
||||
in-file use of the same declaration, because `indexed_def_in_file` maps the
|
||||
live symbol back the same wrong way. Not `bind`-specific; reproduced with a
|
||||
plain `assign w = u_leaf.sig;`.
|
||||
|
||||
The contract to reach: a declaration's cross-file reachability is judged on
|
||||
the surface a use can actually reach it by — `member_in(unit, name,
|
||||
Surface::Hierarchical)` in both call sites (the connection answer is a prefix
|
||||
of the hierarchical one, so package/class/struct members and ports keep
|
||||
their answers byte-for-byte). `references_are_ambiguous` and the
|
||||
single-record rule (`defs.len() != 1`) keep their meaning over the wider
|
||||
answer — a name declared both as a port and as an internal net of the same
|
||||
unit is ambiguous, not silently the port. Hover and definition, which share
|
||||
`indexed_def_for_symbol`, must not change what they say for anything they
|
||||
already answered. No new index field, so no `FACTS_FORMAT` bump; if one
|
||||
turns out to be needed, say why in the README.
|
||||
|
||||
Feature README: `docs/features/references-hierarchical-surface/README.md`.
|
||||
Files: `crates/lucisv_server/src/{nav.rs,hover.rs}` and the server's wire
|
||||
tests (`server/tests/`), `crates/vlog_semantic/src/workspace/hierarchy.rs`
|
||||
only if `member_in` needs a case it lacks (a Handshake entry either way).
|
||||
Nothing else.
|
||||
|
||||
- [x] the fixture sweep first, asserting today's answers, then flipped:
|
||||
`definition`, `references` (from the declaration and from each use,
|
||||
`includeDeclaration` both ways), `hover`, `documentHighlight` over
|
||||
(a) a `bind` connection's bare name, (b) a `u_x.sig` tail from an
|
||||
instantiating file, (c) a two-level tail, (d) a port of the same
|
||||
unit (unchanged answers), (e) a package member (unchanged), (f) a
|
||||
name that is both a port and an internal net of one unit (ambiguous
|
||||
— the single-file fallback, as today), (g) an unsaved buffer
|
||||
(`untitled:`), (h) the open buffer's own in-file use seen from a
|
||||
cross-file use
|
||||
- [x] the fix in both call sites; the §63.1 QA test renamed to say what it
|
||||
now asserts
|
||||
- [x] on the real opentitan tree (read-only): `references` on
|
||||
`entropy_masking_req` from `aes.sv` lists `aes_bind.sv`; on
|
||||
`state_q` from `entropy_src_main_sm.sv` lists `entropy_src_core.sv`;
|
||||
the `nav`/`navqueue` harness rows within noise (the hierarchical
|
||||
lookup is one more map probe)
|
||||
- [x] QA: fixtures re-attacked (a generate-scoped net; a net shadowed by a
|
||||
port of the same name in a *different* unit; a class member — must
|
||||
stay on the connection answer), opentitan census, gates. Verdict:
|
||||
rework needed — three findings in the closed-declaring-file repair's
|
||||
handling of a stale-on-disk file (one new to this lane, two
|
||||
pre-existing and general); see the feature README's QA log.
|
||||
- [x] rework (dev, per the lead's ruling on QA findings 1–3): one fresh read
|
||||
per closed file per request, threaded to the rendering step
|
||||
(`file_view`'s cache is no longer on this path); a re-analysed closed
|
||||
file's declaration reported at its live span; every index-time
|
||||
closed-file span guarded with `hover::spells_exactly` (now `pub(crate)`)
|
||||
and dropped rather than misrendered. `qa_finding_1/2/3` flipped to the
|
||||
fixed answers and renamed, plus one attack on the guard itself. QA's
|
||||
+25 % on a local-net request in a 40 000-line file accepted as-is, for
|
||||
§64.2 to note in `docs/perf/README.md`.
|
||||
- [x] QA re-check (same worktree): findings 1–3 re-derived by hand and
|
||||
confirmed fixed (a use-only shift, a deleted declaring file, a UTF-8
|
||||
boundary, two independent closed files, an escaped port and an
|
||||
escaped hierarchical net all attacked and held). **Finding 4, new**:
|
||||
the `include_declaration` fallback's index-time span is rendered with
|
||||
**no guard** when the file is *open* (only the closed path calls
|
||||
`spells_exactly`) — reproduced with a renamed live buffer, a stale
|
||||
3-byte span lands on the first three characters of the live token
|
||||
`sig2`. Verdict: rework needed again; see the feature README's QA log
|
||||
for the fix suggestion. Gates green (4453 passed), opentitan
|
||||
re-confirmed byte-identical, size 423 lines.
|
||||
- [x] rework 2 (dev, finding 4): the `include_declaration` chain lifted into
|
||||
`nav::declaration_site`; an open buffer's index-time fallback span is
|
||||
emitted only if `hover::spells_exactly` holds against the live text,
|
||||
else the declaration is omitted (the closed path keeps its single guard
|
||||
in `closed_locations`). QA's finding-4 test flipped and renamed, plus a
|
||||
control (an unsaved edit above the declaration still reports the live
|
||||
line). Gates green through `tools/guard.sh`.
|
||||
- [x] QA final (escalated, same worktree): the finding-4 test re-derived
|
||||
by hand (a real unsaved rename; honest omission, tails unchanged) and
|
||||
the control shown to come from the live path; the declaration-site
|
||||
ladder attacked rung by rung — five `qa_final_*` tests (a failed live
|
||||
lookup with the name still in place → emitted; a suffix of a longer
|
||||
live name → dropped; off a UTF-8 boundary → dropped, no panic;
|
||||
`includeDeclaration: false` on the closed rungs; one observation, a
|
||||
different exact `sig` at the old bytes is reported, for the lead).
|
||||
`nav.rs` 433 production lines, no unwrap/expect/panic,
|
||||
`indexed_references` 71 lines (reported). Gates green (4459 passed),
|
||||
opentitan rows re-confirmed read-only, checkout status identical.
|
||||
Verdict: **pass**.
|
||||
|
||||
### 64.2 Closing
|
||||
|
||||
- [x] `docs/perf/README.md` note if any harness number moved; topo row
|
||||
(`lucisv_server ──▶ vlog_semantic`: nav asks the hierarchical
|
||||
surface) — done 2026-09-12 (the perf entry records the +25 % on a
|
||||
local-net `references` and the closed-file parse; the
|
||||
`references-nav ──▶ workspace-index` row amended)
|
||||
- [ ] release 0.55.0 with assets verified — owner's call; not run from the
|
||||
`task_d8afe80f` session (a release chain never runs while a lane is
|
||||
in flight, and the lane merges first)
|
||||
@@ -455,7 +455,7 @@ fn span_text(text: &str, span: TextRange) -> Option<&str> {
|
||||
/// to not continue an identifier turns that prefix/suffix match back into a
|
||||
/// miss, without needing anything more than the same "is this still a name
|
||||
/// character" question a lexer already answers for `$`, `_` and alnum.
|
||||
fn spells_exactly(text: &str, span: TextRange, name: &str) -> bool {
|
||||
pub(crate) fn spells_exactly(text: &str, span: TextRange, name: &str) -> bool {
|
||||
if span_text(text, span) != Some(name) {
|
||||
return false;
|
||||
}
|
||||
@@ -1313,6 +1313,45 @@ endmodule
|
||||
let _ = fs::remove_dir_all(&dir);
|
||||
}
|
||||
|
||||
/// TODO §64.1. The same live-span read for a declaration only a
|
||||
/// **hierarchical** path can reach — a module's internal net, named from
|
||||
/// another file as `u_leaf.sig`.
|
||||
///
|
||||
/// `declaration_snippet` reaches it through `live_symbol` →
|
||||
/// `nav::indexed_def_for_symbol`, which asked `WorkspaceIndex::member`
|
||||
/// (the *connection* surface) until §64.1 and so mapped no live symbol
|
||||
/// back to this `Def` at all: the card came out with its heading and no
|
||||
/// fence, on a file that was open and perfectly readable. It now shows the
|
||||
/// live line, which is the same guarantee the port above gets — and the
|
||||
/// guard is untouched, so a buffer whose live text no longer declares the
|
||||
/// name still prints nothing (asserted below).
|
||||
#[test]
|
||||
fn a_hierarchical_only_declaration_is_read_at_its_live_span_too() {
|
||||
let top =
|
||||
"module top;\n leaf u_leaf ();\n wire w;\n assign w = u_leaf.sig;\nendmodule\n";
|
||||
let saved = "module leaf;\n logic [7:0] sig;\nendmodule\n";
|
||||
let (dir, mut ws, uri) = included("livehier", &[("leaf.sv", saved), ("top.sv", top)]);
|
||||
let leaf_uri = path_to_uri(&dir.join("leaf.sv")).expect("uri");
|
||||
let edited =
|
||||
"// two lines\n// pushed it down\nmodule leaf;\n logic [15:0] sig;\nendmodule\n";
|
||||
ws.set_document(leaf_uri.clone(), edited.to_string());
|
||||
|
||||
let body = text_of(&hover(&ws, &uri, at(top, "u_leaf.sig") + 7).expect("hover"));
|
||||
assert!(
|
||||
body.contains("```systemverilog\n logic [15:0] sig;\n```"),
|
||||
"the live line, width and all: got {body}"
|
||||
);
|
||||
assert!(!body.contains("[7:0]"), "not the saved one: got {body}");
|
||||
|
||||
// The guard half, on the same shape: the net renamed away in the
|
||||
// buffer leaves the heading and no fence.
|
||||
ws.set_document(leaf_uri, "module leaf;\n logic [15:0] renamed;\nendmodule\n".to_string());
|
||||
let guarded = text_of(&hover(&ws, &uri, at(top, "u_leaf.sig") + 7).expect("hover"));
|
||||
assert!(guarded.contains("— declared in"), "today's card, intact: got {guarded}");
|
||||
assert!(!guarded.contains("```"), "and no snippet at all: got {guarded}");
|
||||
let _ = fs::remove_dir_all(&dir);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_stale_indexed_span_drops_the_snippet_rather_than_showing_the_wrong_line() {
|
||||
// The file changed on disk under a live index — a rescan the server has
|
||||
|
||||
+1723
-99
File diff suppressed because it is too large.
Load diff
@@ -8631,3 +8631,113 @@ fn organize_imports_is_offered_under_its_own_kind_and_runs_as_a_command() {
|
||||
|
||||
let _ = std::fs::remove_dir_all(&dir);
|
||||
}
|
||||
|
||||
/// TODO §64.1 over the wire. `leaf` declares an internal net; `top.sv` names it
|
||||
/// through a hierarchical tail and `leaf.sv` uses it itself. Before §64.1
|
||||
/// `textDocument/references` answered `leaf.sv`'s two lines from the
|
||||
/// declaration and never the tail, while `textDocument/rename` at the same
|
||||
/// position edited both files — lucisv could change a reference it could not
|
||||
/// list. Asserted here from both ends, with `leaf.sv` the only open buffer, so
|
||||
/// the tail comes out of the persisted postings and `leaf.sv`'s own use out of
|
||||
/// the live one; then from `top.sv` with `leaf.sv` closed, where that file's
|
||||
/// own use is served by one re-analysis of it.
|
||||
#[test]
|
||||
fn a_hierarchical_nets_references_and_rename_agree_over_the_wire() {
|
||||
let dir = temp_dir("hierrefs");
|
||||
let leaf = dir.join("leaf.sv");
|
||||
let leaf_text = "\
|
||||
module leaf (input logic clk_i);
|
||||
logic sig;
|
||||
assign sig = clk_i;
|
||||
endmodule
|
||||
";
|
||||
std::fs::write(&leaf, leaf_text).expect("write");
|
||||
let top = dir.join("top.sv");
|
||||
let top_text = "\
|
||||
module top;
|
||||
leaf u_leaf (.clk_i(1'b0));
|
||||
wire w;
|
||||
assign w = u_leaf.sig;
|
||||
endmodule
|
||||
";
|
||||
std::fs::write(&top, top_text).expect("write");
|
||||
|
||||
let root = format!("file://{}", dir.display());
|
||||
let leaf_uri = format!("file://{}", leaf.display());
|
||||
let top_uri = format!("file://{}", top.display());
|
||||
|
||||
// `sig` is declared at line 1 column 8 of `leaf.sv`, used at line 2
|
||||
// column 9 there, and named at line 3 column 20 of `top.sv`.
|
||||
let session = [
|
||||
frame(&format!(
|
||||
r#"{{"jsonrpc":"2.0","id":1,"method":"initialize","params":{{"processId":null,"rootUri":"{root}","capabilities":{{}}}}}}"#
|
||||
)),
|
||||
frame(r#"{"jsonrpc":"2.0","method":"initialized","params":{}}"#),
|
||||
frame(WIDE_SCOPE),
|
||||
frame(&format!(
|
||||
r#"{{"jsonrpc":"2.0","method":"textDocument/didOpen","params":{{"textDocument":{{"uri":"{leaf_uri}","languageId":"systemverilog","version":1,"text":{}}}}}}}"#,
|
||||
serde_json::to_string(leaf_text).expect("json")
|
||||
)),
|
||||
frame(&format!(
|
||||
r#"{{"jsonrpc":"2.0","id":2,"method":"textDocument/references","params":{{"textDocument":{{"uri":"{leaf_uri}"}},"position":{{"line":1,"character":8}},"context":{{"includeDeclaration":true}}}}}}"#
|
||||
)),
|
||||
frame(&format!(
|
||||
r#"{{"jsonrpc":"2.0","id":3,"method":"textDocument/rename","params":{{"textDocument":{{"uri":"{leaf_uri}"}},"position":{{"line":1,"character":8}},"newName":"renamed"}}}}"#
|
||||
)),
|
||||
// Now from the other side, with `leaf.sv` shut.
|
||||
frame(&format!(
|
||||
r#"{{"jsonrpc":"2.0","method":"textDocument/didClose","params":{{"textDocument":{{"uri":"{leaf_uri}"}}}}}}"#
|
||||
)),
|
||||
frame(&format!(
|
||||
r#"{{"jsonrpc":"2.0","method":"textDocument/didOpen","params":{{"textDocument":{{"uri":"{top_uri}","languageId":"systemverilog","version":1,"text":{}}}}}}}"#,
|
||||
serde_json::to_string(top_text).expect("json")
|
||||
)),
|
||||
frame(&format!(
|
||||
r#"{{"jsonrpc":"2.0","id":4,"method":"textDocument/references","params":{{"textDocument":{{"uri":"{top_uri}"}},"position":{{"line":3,"character":20}},"context":{{"includeDeclaration":true}}}}}}"#
|
||||
)),
|
||||
frame(r#"{"jsonrpc":"2.0","id":9,"method":"shutdown","params":null}"#),
|
||||
frame(r#"{"jsonrpc":"2.0","method":"exit","params":null}"#),
|
||||
]
|
||||
.concat();
|
||||
|
||||
let messages = talk(&session);
|
||||
let response = |id: u32| -> &serde_json::Value {
|
||||
messages
|
||||
.iter()
|
||||
.find(|m| m["id"] == id)
|
||||
.unwrap_or_else(|| panic!("no response {id} in {messages:#?}"))
|
||||
};
|
||||
|
||||
// Every place naming the net, as `(file, line)`.
|
||||
let places = |id: u32| -> Vec<(String, i64)> {
|
||||
let mut out: Vec<(String, i64)> = response(id)["result"]
|
||||
.as_array()
|
||||
.expect("a list")
|
||||
.iter()
|
||||
.map(|location| {
|
||||
let uri = location["uri"].as_str().expect("a uri");
|
||||
let name = uri.rsplit('/').next().unwrap_or("?").to_string();
|
||||
(name, location["range"]["start"]["line"].as_i64().expect("a line"))
|
||||
})
|
||||
.collect();
|
||||
out.sort();
|
||||
out
|
||||
};
|
||||
let everywhere =
|
||||
vec![("leaf.sv".to_string(), 1), ("leaf.sv".to_string(), 2), ("top.sv".to_string(), 3)];
|
||||
assert_eq!(places(2), everywhere, "from the declaration");
|
||||
assert_eq!(places(4), everywhere, "from the tail, with `leaf.sv` closed");
|
||||
|
||||
// And the rename that was already editing both files edits exactly those
|
||||
// places — the asymmetry §64.1 was filed for, closed from both sides.
|
||||
let changes = &response(3)["result"]["changes"];
|
||||
let own = changes[&leaf_uri].as_array().expect("edits for the declaring file");
|
||||
assert_eq!(own.len(), 2, "{own:#?}");
|
||||
let elsewhere = changes[&top_uri].as_array().expect("edits for the naming file");
|
||||
assert_eq!(elsewhere.len(), 1, "{elsewhere:#?}");
|
||||
assert_eq!(elsewhere[0]["range"]["start"]["line"], 3);
|
||||
assert_eq!(elsewhere[0]["range"]["start"]["character"], 20);
|
||||
assert!(elsewhere.iter().all(|e| e["newText"] == "renamed"), "{elsewhere:#?}");
|
||||
|
||||
let _ = std::fs::remove_dir_all(&dir);
|
||||
}
|
||||
@@ -347,13 +347,22 @@ fn facts_from_analysis(
|
||||
}
|
||||
// The **connection** surface only. A `Local` posting exists so that a
|
||||
// declaration another file can point at carries its own file's uses
|
||||
// without that file being re-read, and every consumer of the postings
|
||||
// that matters here — the rename, which re-analyses the declaring file
|
||||
// anyway — already has them. Posting a module's every internal net use
|
||||
// would multiply the reference table by the size of an RTL body for an
|
||||
// answer nothing reads; the hierarchical surface is what a *cross-file*
|
||||
// tail resolves through, and that half is an `External` fact below.
|
||||
// See `docs/features/hierarchical-tail/README.md`, "what did not widen".
|
||||
// without that file being re-read. Posting a module's every internal net
|
||||
// use would multiply the reference table by the size of an RTL body; the
|
||||
// hierarchical surface is what a *cross-file* tail resolves through, and
|
||||
// that half is an `External` fact below.
|
||||
//
|
||||
// Two consumers read the postings for a hierarchical-only declaration,
|
||||
// and each supplies the missing local half by re-analysing that one file:
|
||||
// a rename (`vlog_refactor`), which re-analyses the declaring file
|
||||
// anyway, and — since §64.1 — `lucisv_server`'s
|
||||
// `nav::declaring_file_uses`, which parses exactly the declaring file
|
||||
// when it is closed and a `references` request arrived from a cross-file
|
||||
// use. So the narrow table costs one file's parse on one request shape,
|
||||
// paid by the caller that needs it, instead of a reference table sized by
|
||||
// every RTL body in the workspace. See
|
||||
// `docs/features/hierarchical-tail/README.md`, "what did not widen", and
|
||||
// `docs/features/references-hierarchical-surface/README.md`.
|
||||
// Which kind lands on which surface is `hierarchy::surface_of`, the one
|
||||
// rule this filter and the member tables both read (§49's QA asked for
|
||||
// the pointer).
|
||||
|
||||
@@ -128,10 +128,26 @@ The `propagate-ports` engine reads `member`/`members_of` and is untouched.
|
||||
- **Reference postings.** `facts_from_analysis` records a `Local` posting only
|
||||
for a use whose declaration is on the **connection** surface. Posting a
|
||||
module's every internal-net use would multiply the reference table by the
|
||||
size of an RTL body for an answer nothing reads: the only consumer is a
|
||||
rename, which re-analyses the declaring file anyway. The *cross-file* half —
|
||||
the tail in the other file — is an `External` fact, and that is what makes
|
||||
the rename work.
|
||||
size of an RTL body. The *cross-file* half — the tail in the other file —
|
||||
is an `External` fact, and that is what makes the rename work.
|
||||
|
||||
**Amended 2026-09-12 (§64.1).** This bullet used to end "for an answer
|
||||
nothing reads: the only consumer is a rename, which re-analyses the
|
||||
declaring file anyway". There are two consumers now, and the sentence is
|
||||
true again only with the second one named: `textDocument/references` reads
|
||||
the postings too, and since §64.1 it answers for a hierarchical-only
|
||||
declaration. It is served the way the rename is —
|
||||
`lucisv_server`'s `nav::declaring_file_uses` parses **exactly the declaring
|
||||
file, exactly once**, and only when that file has no open buffer and the
|
||||
request came in from a cross-file use; an open buffer's own uses come from
|
||||
the live overlay as they always did. Measured on opentitan: `references`
|
||||
from `u_entropy_src_main_sm.state_q` with `entropy_src_main_sm.sv` closed
|
||||
costs 1.0–1.5 ms against the 0.1–0.2 ms of the incomplete answer it
|
||||
replaces, and every connection-surface row of the `nav` harness is
|
||||
unchanged in both result count and time. So the decision stands, with its
|
||||
cost now written down: one file's parse on one request shape, instead of a
|
||||
reference table sized by every RTL body in the workspace. See
|
||||
`docs/features/references-hierarchical-surface/README.md`.
|
||||
- **`workspace/symbol`.** An internal net is still not a workspace symbol: the
|
||||
request answers what a user can name from outside, and a design with 20 000
|
||||
modules has hundreds of thousands of internal signals.
|
||||
|
||||
@@ -142,6 +142,17 @@ The character cap counts `char`s and cuts on a boundary.
|
||||
|
||||
## Work log
|
||||
|
||||
### 2026-09-12 — dev (§64.1: `spells_exactly` is now `pub(crate)`)
|
||||
|
||||
Visibility only, no behaviour change here. `nav.rs` needed the same
|
||||
agreement check for a closed file's *span* that this feature applies to a
|
||||
closed file's *snippet* — after §64.1 an index-time `references` span can be
|
||||
rendered against bytes that moved — and QA's lesson above (a fixed-length
|
||||
span still spelling the old name as a **prefix** of a longer identifier) is
|
||||
exactly the case a second copy of the check would have got wrong. So
|
||||
`hover::spells_exactly` is shared rather than duplicated; see
|
||||
`docs/features/references-hierarchical-surface/README.md`.
|
||||
|
||||
### 2026-08-27 — dev
|
||||
|
||||
- Read the brief, `hover.rs`, `nav.rs`, `state.rs` and `convert.rs`. Confirmed
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -22,13 +22,35 @@ predicate, and three handlers.
|
||||
|
||||
- **The workspace index is the authority on what can be named from another
|
||||
file.** `nav::leaves_this_file` decides whether a references request walks
|
||||
the workspace by asking `WorkspaceIndex::units` / `::member` about the name
|
||||
under the cursor — not by re-deriving `is_unit`/`is_exported`, which are
|
||||
private to `vlog_semantic` and would be language knowledge in the protocol
|
||||
layer. Consequence: a declaration the index has not seen yet (a buffer
|
||||
edited but not saved, when the file is new) is answered in-file until the
|
||||
next rebuild. That is the same staleness window every other cross-file
|
||||
answer already has, documented in `docs/features/lucisv-server/README.md`.
|
||||
the workspace by asking `WorkspaceIndex::units` / `::member_in(…,
|
||||
Surface::Hierarchical)` about the name under the cursor — not by re-deriving
|
||||
`is_unit`/`is_exported`, which are private to `vlog_semantic` and would be
|
||||
language knowledge in the protocol layer. **The surface matters** (amended
|
||||
2026-09-12, §64.1): the question is which declarations a *use* in another
|
||||
file can reach, and a hierarchical path may name anything a module declares
|
||||
(IEEE 1800 §23.6) where a connection list may name only its ports and
|
||||
parameters (§23.3). Asking `::member` — the connection surface — was what
|
||||
made `assign w = u_x.sig;` in another file invisible to `references` while
|
||||
a rename was already editing it. The connection answer is the first, whole
|
||||
part of the hierarchical one, so nothing else moved; see
|
||||
`docs/features/references-hierarchical-surface/README.md`. Consequence: a
|
||||
declaration the index has not seen yet (a buffer edited but not saved, when
|
||||
the file is new) is answered in-file until the next rebuild. That is the
|
||||
same staleness window every other cross-file answer already has, documented
|
||||
in `docs/features/lucisv-server/README.md`.
|
||||
- **A stale index can omit a location; it can never point at a wrong one**
|
||||
(added 2026-09-12, §64.1 rework, QA findings 1–3). Until then this feature's
|
||||
staleness story stopped at the sentence above, which undersold it: a span
|
||||
recorded at index time and rendered against a **closed** file's current
|
||||
bytes — a `references_to` posting, or the `include_declaration` fallback —
|
||||
had no agreement check, so an external edit to that file (another tool,
|
||||
`git checkout`, a build step: none of the five events that drop a cached
|
||||
view) could put a true-looking `Location` on a line that no longer holds the
|
||||
name. `nav::closed_locations` now applies `hover::spells_exactly` to every
|
||||
closed-file span before emitting it and drops the ones that no longer spell
|
||||
the target's name — the same guarantee `hover-declarations` gives a snippet.
|
||||
Open buffers are not guarded and pay nothing: their spans come from the very
|
||||
text they are rendered against.
|
||||
- **A references answer is an indexed lookup.** Each `FileFacts` record stores
|
||||
compact facts for references to externally reachable declarations. The
|
||||
finished `WorkspaceIndex` resolves those facts once into declaration-to-use
|
||||
@@ -230,6 +252,33 @@ decision.
|
||||
|
||||
## Work log
|
||||
|
||||
### 2026-09-12 — dev (TODO §64.1: the gate asks the hierarchical surface)
|
||||
|
||||
`leaves_this_file` and `indexed_def_in_file` — this feature's two index
|
||||
questions — asked `WorkspaceIndex::member`, the **connection** surface. Since
|
||||
`hierarchical-tail` (0.45.0) a module's net, variable and instance live on the
|
||||
**hierarchical** surface only, so both functions judged such a declaration
|
||||
unable to leave its file: `references` from the declaration fell to the
|
||||
single-file answer and never saw a cross-file `u_x.sig` tail or a `bind`
|
||||
connection expression, and a request that *did* go cross-file could not
|
||||
re-identify the declaring buffer's own in-file uses. Both now ask
|
||||
`member_in(owner, name, Surface::Hierarchical)`. Every connection-surface
|
||||
answer is byte-identical (the connection records come first and whole from
|
||||
that read); the `nav` harness rows are unchanged in count and within noise in
|
||||
time. The closed-declaring-file half of the completeness problem, the new
|
||||
`nav::declaring_file_uses`, the fixture sweep and the attack cases are all
|
||||
written up in `docs/features/references-hierarchical-surface/README.md`, which
|
||||
is this change's feature README. `documentHighlight`'s "a document answer even
|
||||
for a cross-file name" assumption was untouched and is now pinned from both
|
||||
ends (`definition_and_document_highlight_over_a_hierarchical_tail_are_unchanged`).
|
||||
|
||||
**Rework the same day**, on QA's findings 1–3: the closed-file path reads each
|
||||
closed file exactly once per request, with `text_of` rather than the
|
||||
`file_view` cache, and every index-time span about a closed file is guarded by
|
||||
`hover::spells_exactly` before it is rendered. That is the new Assumptions
|
||||
bullet above; the derivation and the flipped QA tests are in
|
||||
`docs/features/references-hierarchical-surface/README.md`.
|
||||
|
||||
### 2026-08-28 — documentHighlight answered nothing on a cross-file name
|
||||
|
||||
**The report.** `performance.md` §7: `documentHighlight` returned 0 results at
|
||||
|
||||
@@ -1390,3 +1390,36 @@ is read for comments), `analyze` (9.4 ms), `resolve_external` (4.7 ms),
|
||||
and ~6 ms dropping the previous revision's products on the request path.
|
||||
`docs/features/perf-first-after-edit/README.md`; evidence
|
||||
`~/.cache/lucisv-perf/63-2/`.
|
||||
### 2026-09-12 — loop 3, round 2 (TODO §64)
|
||||
|
||||
**§64.1 is a correctness lane, not a performance one**, recorded here
|
||||
because it moves one harness row on purpose. `textDocument/references`
|
||||
now judges a declaration's cross-file reach on the **hierarchical**
|
||||
surface (`nav::leaves_this_file` / `indexed_def_in_file` ask
|
||||
`member_in(…, Surface::Hierarchical)` instead of `member`), so a module's
|
||||
net, variable or instance — which a `bind` connection or a `u_x.sig`
|
||||
tail names from another file — is answered workspace-wide instead of
|
||||
silently in-file. Two costs, both measured on the real opentitan tree:
|
||||
|
||||
- **A local net's `references` in a 40 267-line open buffer** now walks
|
||||
the indexed path (two map probes plus the name-prefiltered pass over
|
||||
open buffers) instead of returning the in-file answer directly:
|
||||
**1.22 → 1.54 ms median** (QA, throwaway worktree at 9d1eb16 for the
|
||||
before). Accepted: the gate still saves the walk for every name the
|
||||
index holds nowhere.
|
||||
- **A cross-file request into a *closed* declaring file** (the shape that
|
||||
used to answer incompletely) parses exactly that file once, fresh from
|
||||
disk: 0.1–0.2 ms → **0.4–1.5 ms** on `state_q` from
|
||||
`entropy_src_core.sv` with `entropy_src_main_sm.sv` shut — the price
|
||||
of the in-file uses that answer used to omit. The index deliberately
|
||||
posts no `Local` reference for a hierarchical-only member (the §49
|
||||
ruling: a reference table sized by every RTL body for a rarely-asked
|
||||
answer), so the one-file re-analysis is the same trade the rename
|
||||
already makes.
|
||||
|
||||
Every connection-surface row of the `nav` harness is unchanged in result
|
||||
count and within noise in time (`aes` 14 locations / 9 files, `.clk_i`
|
||||
12 / 9). Every closed-file span is now guarded by `hover::spells_exactly`
|
||||
before it is rendered — one slice compare per location, unmeasurable —
|
||||
so a stale index can omit a location but never point at a wrong line
|
||||
(QA findings 1–4). `docs/features/references-hierarchical-surface/README.md`.
|
||||
+1
-1
@@ -628,7 +628,7 @@ engine-lane features are listed above; this table is the server-internal web.
|
||||
| `on-type-formatting ──▶ range-formatting, editor-scopes` | depends | `;` goes through `format::range_formatting` unchanged; `\n` answers indent only, computed from `pairs.rs`'s own keyword tables (three items widened to `pub(crate)`) — one reader's answer for "what opens a scope". |
|
||||
| `interactive-latency ──▶ change-debounce, editor-scopes, selection-range, on-type-formatting, completion-core, inline-templates` | depends | Round 2 of the perf work (`docs/perf/README.md`). It measures the flush change-debounce coalesces and the round trip it defers, and it replaces one token *sweep* with one token *binary search* in `selection.rs`, `on_type.rs`, `completion.rs` and `inline.rs`. No answer moved — each swap is pinned against the sweep it replaced at every byte — so none of those five features' contracts changed; what they now share is `state.rs`'s two search primitives and the ordering property of `tokenize`'s output they rest on. |
|
||||
| `interactive-latency ◀──▶ lucisv-server` | handshake | Two free functions, `first_token_reaching` and `first_token_from`, are published from `state.rs` beside `Document::token_at`; that is where the monotonicity argument every caller depends on is written down, and `state::tests::the_token_stream_rises_and_never_overlaps` is the test that fails first if `vlog_parser` ever breaks it. `tests/e2e.rs`'s `Live::finish` now returns its publish count (existing callers ignore it), and `perf::generated_module` has a copy in `tests/e2e.rs` — a binary crate's modules are unreachable from an integration test — which must stay the same shape as the original. |
|
||||
| `references-nav ──▶ workspace-index / hover-line-index` | depends | Cross-file references resolve an indexed target first and consume declaration postings directly; same-file local references stay on `Semantics`. Locations use the shared `FileView`. `documentHighlight` now also follows the document's external overlay for names declared elsewhere, fixing the old “references works, highlight is empty” split without widening highlights beyond the current file. |
|
||||
| `references-nav ──▶ workspace-index / hover-line-index` | depends | Cross-file references resolve an indexed target first and consume declaration postings directly; same-file local references stay on `Semantics`. Since §64.1 (2026-09-12) the two index questions (`leaves_this_file`, `indexed_def_in_file`) ask `member_in(…, Surface::Hierarchical)`, so a module's net/variable/instance named by a `bind` connection or a `u_x.sig` tail is answered workspace-wide; a hierarchical-only declaration in a *closed* file has no `Local` postings, so `nav::declaring_file_uses` parses exactly that file once per request. Every closed-file span and the open-buffer declaration fallback are guarded by `hover::spells_exactly` (now `pub(crate)`): a stale index may omit a location, never mislocate one. Locations for closed files are rendered from one `text_of` read per file per request (not the `FileView` cache, whose entry could differ from the same request's re-analysis). `documentHighlight` now also follows the document's external overlay for names declared elsewhere, fixing the old “references works, highlight is empty” split without widening highlights beyond the current file. |
|
||||
| `selection-range / linked-editing ──▶ spans, name-spans` | depends | Pure arrangements of existing ranges; linked-editing's table documents exactly which constructs carry both spans (and which verbatim ones can't — `program`, property/sequence, covergroup). |
|
||||
| `type-definition ──▶ nav / overlay-promotion / ansi-first-port` | depends + 2 delivered handshakes | Now literally `nav::definition` at the type name's offset; both of its filed requests landed (§2.2, §2.5). |
|
||||
| `hierarchy ◀──▶ inlay-hints` | handshake (shared walk) | The instantiation walk was lifted out of `inlay.rs` into a shared module (now `vlog_semantic::instantiations`) rather than copied — the two answers cannot drift; inlay's 34 tests are the regression net. |
|
||||
|
||||
@@ -5,6 +5,17 @@ for you. The extension and its bundled language server share one version
|
||||
number; the full engineering notes live in the
|
||||
[project changelog](https://git.luci.ooo/lucio/lucisv/src/branch/master/CHANGELOG.md).
|
||||
|
||||
## 0.55.0 — 2026-09-17
|
||||
|
||||
- Find All References on a module's internal signal now lists every use
|
||||
in other files — a `bind` connection or a `u_x.sig` hierarchical path
|
||||
— from the declaration or from any use, and includes the declaring
|
||||
file's own uses even when that file is not open. Hover shows the live
|
||||
declaration line for such signals too.
|
||||
- When a file changed on disk behind the editor's back, a reference
|
||||
that no longer sits where the index remembers it is left out rather
|
||||
than reported on the wrong line.
|
||||
|
||||
## 0.54.0 — 2026-09-12
|
||||
|
||||
- Rename now edits the `bind` files that name the renamed signal — bare
|
||||
|
||||
@@ -30,7 +30,7 @@ Install **lucisv — Verilog/SystemVerilog** from the VS Code Extensions view,
|
||||
then open a Verilog or SystemVerilog file. There is no separate server or CLI
|
||||
setup.
|
||||
|
||||
The current release is **0.54.0**. Its platform packages include both
|
||||
The current release is **0.55.0**. Its platform packages include both
|
||||
`lucisv-server` and the `lucisv` command-line tool:
|
||||
|
||||
| Package target | Machines |
|
||||
@@ -374,6 +374,13 @@ Every nesting color is a proper VS Code theme color:
|
||||
}
|
||||
```
|
||||
|
||||
## Release 0.55.0 highlights
|
||||
|
||||
Version 0.55.0 makes Find All References see every cross-file use of a
|
||||
module's internal signals — a `bind` connection or a `u_x.sig` path in
|
||||
another file — and guarantees a stale index can omit a location but
|
||||
never point at the wrong line.
|
||||
|
||||
## Release 0.54.0 highlights
|
||||
|
||||
Version 0.54.0 makes rename edit `bind` files (or warn, never stay
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"name": "lucisv",
|
||||
"displayName": "lucisv — Verilog/SystemVerilog",
|
||||
"description": "Fast Verilog/SystemVerilog formatting, linting, navigation, refactoring, semantic highlighting and RTL design intelligence.",
|
||||
"version": "0.54.0",
|
||||
"version": "0.55.0",
|
||||
"publisher": "guoliangchen",
|
||||
"author": "Guoliang Chen",
|
||||
"license": "MIT",
|
||||
|
||||
Reference in new issue
Block a user