From 3132c24b21758c933b32f96a23a3ee72b6fea319 Mon Sep 17 00:00:00 2001 From: Guoliang Chen Date: Wed, 11 Nov 2026 14:19:24 -0800 Subject: [PATCH] =?UTF-8?q?TODO=20=C2=A767:=20sticky=20scroll=20pins=20eve?= =?UTF-8?q?ry=20layer's=20header=20(VS=20Code=20follows=20the=20folding=20?= =?UTF-8?q?ranges,=20ten=20lines=20deep)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit configurationDefaults for verilog and systemverilog: editor.stickyScroll.defaultModel = foldingProviderModel and editor.stickyScroll.maxLineCount = 10. The outline model pinned only the module header; the server's folds already start on each layer's first line. A folding test pins the owner's example (module, always, case, case item, if). Not yet seen in a running VS Code. Co-Authored-By: Claude Fable 5.2 --- TODO.md | 21 ++++++++++++++++++ crates/lucisv_server/src/folding.rs | 33 +++++++++++++++++++++++++++++ editors/vscode/README.md | 1 + editors/vscode/package.json | 8 +++++-- 4 files changed, 61 insertions(+), 2 deletions(-) diff --git a/TODO.md b/TODO.md index 70f64ad..cc4e900 100644 --- a/TODO.md +++ b/TODO.md @@ -7172,3 +7172,24 @@ parser and the CLI's `--lines` are not touched. `generate`, inside a function), off-grid and tab indentation, partial selections, comments, fences, broken files, masked-corruption attacks on the splice. + +## 67. Sticky scroll shows every layer (planned 2026-11-11, owner's order) + +VS Code pinned only the module header, because sticky scroll follows the +document-symbol outline by default and the outline stops at declarations. +The server's folding ranges already carry every `begin`/`end`, `case`, +`fork`, `generate` and function — one fold per layer, starting on its header +line. + +- [x] `editors/vscode/package.json` `configurationDefaults` for both language + ids: `editor.stickyScroll.defaultModel` = `foldingProviderModel` and + `editor.stickyScroll.maxLineCount` = 10 (VS Code's default of 5 is the + owner's example exactly, with nothing to spare). A user's own setting + still wins. +- [x] `crates/lucisv_server/src/folding.rs`: a test pinning that each layer + of the owner's example (module, `always`, `case`, case item, `if`) + starts a fold on its header line. +- [ ] Seen in a running VS Code (owner). +- Known limit: a layer with no `begin` (a one-statement `if`, a case item + without `begin`) has no fold and so no pinned line; a `begin` written on + its own line pins that `begin` line, not the `always` above it. diff --git a/crates/lucisv_server/src/folding.rs b/crates/lucisv_server/src/folding.rs index 2872039..d9abb55 100644 --- a/crates/lucisv_server/src/folding.rs +++ b/crates/lucisv_server/src/folding.rs @@ -148,6 +148,39 @@ mod tests { assert_eq!(folds(text), vec![(0, 5, "region"), (1, 4, "region"), (2, 3, "region")]); } + #[test] + fn every_layer_a_reader_is_inside_starts_a_fold_on_its_header_line() { + // VS Code's sticky scroll is told (the extension's + // `editor.stickyScroll.defaultModel`) to pin the first line of every + // fold around the top of the viewport. So the header of each layer — + // module, `always`, `case`, the case item, the `if` — must be a fold's + // start line, and each fold must reach the innermost statement. + let text = concat!( + "module m (\n", // 0 + " input a\n", // 1 + ");\n", // 2 + " always @(*) begin\n", // 3 + " case (st)\n", // 4 + " st_1: begin\n", // 5 + " if (cond_1) begin\n", // 6 + " x = 1;\n", // 7 + " y = 2;\n", // 8 + " end\n", // 9 + " end\n", // 10 + " endcase\n", // 11 + " end\n", // 12 + "endmodule\n", // 13 + ); + let ranges = folds(text); + for header in [0, 3, 4, 5, 6] { + let fold = ranges.iter().find(|(start, _, _)| *start == header); + let Some((_, end, _)) = fold else { + panic!("no fold starts on line {header}: {ranges:?}") + }; + assert!(*end >= 8, "the fold from line {header} must cover line 8, got {ranges:?}"); + } + } + #[test] fn a_scope_that_opens_and_closes_on_one_line_folds_nothing() { // `end_line <= start_line` means there is no hidden line to gain. diff --git a/editors/vscode/README.md b/editors/vscode/README.md index eb649cb..6058fde 100644 --- a/editors/vscode/README.md +++ b/editors/vscode/README.md @@ -142,6 +142,7 @@ enabling both paths formats twice. | Document and workspace symbols | Hierarchical outline plus indexed symbol search across the design | | Include links | Resolvable `` `include`` paths become clickable using local and filelist `+incdir+` search rules | | Folding | Modules, classes, blocks, regions, and multiline comments fold on syntax-aware boundaries | +| Sticky scroll | The first line of every block you are inside — the module, the `always`, the `case`, the case item, the `if` — stays pinned at the top of the editor, up to ten lines deep | | Inlay hints | Adds port and parameter names to ordered instantiations without guessing at ambiguous sites | | Code lenses | Shows the workspace-wide instantiation count above every module/interface; click to jump to a site | | Call hierarchy | Incoming calls answer “who instantiates this?”; outgoing calls answer “what does this instantiate?” | diff --git a/editors/vscode/package.json b/editors/vscode/package.json index 29fc63a..09c043c 100644 --- a/editors/vscode/package.json +++ b/editors/vscode/package.json @@ -192,10 +192,14 @@ }, "configurationDefaults": { "[verilog]": { - "editor.defaultColorDecorators": "never" + "editor.defaultColorDecorators": "never", + "editor.stickyScroll.defaultModel": "foldingProviderModel", + "editor.stickyScroll.maxLineCount": 10 }, "[systemverilog]": { - "editor.defaultColorDecorators": "never" + "editor.defaultColorDecorators": "never", + "editor.stickyScroll.defaultModel": "foldingProviderModel", + "editor.stickyScroll.maxLineCount": 10 } }, "languages": [