Skip to content

feat: increment suggested module tags - #111

Merged
ViTeXFTW merged 2 commits into
devfrom
feat/increment-module-tag-suggestions
Sep 1, 2026
Merged

feat: increment suggested module tags#111
ViTeXFTW merged 2 commits into
devfrom
feat/increment-module-tag-suggestions

Conversation

@ViTeXFTW

@ViTeXFTW ViTeXFTW commented Sep 1, 2026

Copy link
Copy Markdown
Owner

Suggest next numeric ModuleTag completion; ignores descriptive tags and sub-block arguments. Closes #108.

@greptile-apps

greptile-apps Bot commented Sep 1, 2026

Copy link
Copy Markdown

Greptile Summary

The PR changes module-name completion snippets to derive the next numeric module tag from tags already present in the enclosing scope.

  • Carries the enclosing syntax scope through module-name completion classification.
  • Filters existing tags to genuine module slots while ignoring descriptive tags and sub-block arguments.
  • Adds tests for numeric sequencing, case-insensitive prefixes, and ignored descriptive tags.

Confidence Score: 4/5

The nested-module tag collision should be fixed before merging because completion can insert a tag already used elsewhere in the same object.

The new search considers only direct object children even though valid tagged modules and uniqueness enforcement span nested reentrant sub-blocks; it also repeats the maximum u32 tag at the numeric boundary.

Files Needing Attention: crates/analysis/src/completion.rs

Important Files Changed

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

Comment thread crates/analysis/src/completion.rs Outdated
Comment on lines +835 to +836
let highest = scope_node
.children()

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 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

Comment thread crates/analysis/src/completion.rs Outdated
})
.max()
.unwrap_or(0);
format!("ModuleTag_{:02}", highest.saturating_add(1))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 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

@ViTeXFTW

ViTeXFTW commented Sep 1, 2026

Copy link
Copy Markdown
Owner Author

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.

@ViTeXFTW
ViTeXFTW merged commit d354bac into dev Sep 1, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] Automatically increment the suggested moduletag number

1 participant