feat: increment suggested module tags - #111
Conversation
|
| Filename | Overview |
|---|---|
| crates/analysis/src/completion.rs | Adds scope-aware numeric module-tag suggestions, but direct-child traversal misses tagged modules in reentrant sub-blocks and the u32 boundary can repeat an existing tag. |
Reviews (1): Last reviewed commit: "feat: increment suggested module tags" | Re-trigger Greptile
| let highest = scope_node | ||
| .children() |
There was a problem hiding this comment.
Nested module tags are skipped
When a reentrant sub-block such as AddModule or ReplaceModule contains a numeric module tag, scanning only the object's direct children excludes that tag. Completion can therefore insert the same tag for a direct module, causing a duplicate-module-tag diagnostic and making tag-based module removal ambiguous.
Knowledge Base Used: Completion and code actions
| }) | ||
| .max() | ||
| .unwrap_or(0); | ||
| format!("ModuleTag_{:02}", highest.saturating_add(1)) |
There was a problem hiding this comment.
Saturating increment repeats maximum tag
With an existing ModuleTag_4294967295, saturating_add(1) returns the same value, so completion suggests an already-used tag and produces an avoidable duplicate-tag diagnostic.
Knowledge Base Used: Completion and code actions
|
Addressed the review: completion now scans genuine module slots throughout the enclosing Object, including re-entrant AddModule scopes, and supports values past u32::MAX. Added regression tests for both. |
Suggest next numeric ModuleTag completion; ignores descriptive tags and sub-block arguments. Closes #108.