ADFA-4980: Filter __removedN placeholder attrs from XML completion - #1623
Conversation
AOSP's bundled attrs.xml keeps __removed0/__removed1/... as placeholders for retired attribute-ID slots (b/131100106); they have no <public> entry but were leaking into android: attribute completion. Skip names matching __removed\d+ when the source package is android. AttrCompletionProvider.kt and its test got fully reformatted to tabs by Spotless's ratchet, which reformats a whole file once any line in it changes (see CLAUDE.md) -- both files predated the tabs requirement. Also exclude testing/resources/test-project/**/*_template.xml from the XML Spotless target: those LSP test fixtures embed an "@@cursor@@" marker inside attribute-like text, and the Eclipse WTP formatter splits it across lines, silently breaking the cursor lookup the harness relies on. Same class of issue as the existing strings.xml exclusion.
There was a problem hiding this comment.
Claude Code Review
This repository is configured for manual code reviews. Comment @claude review for a one-time review, or @claude review always to subscribe this PR to a review on every future push.
Tip: disable this comment in your organization's Code Review settings.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 Walkthrough
WalkthroughThe XML completion provider now filters removed Android styleable placeholders. Spotless excludes XML templates. A layout template adds a cursor placeholder, and the existing completion test is reformatted without behavior changes. ChangesXML completion filtering
Estimated code review effort: 2 (Simple) | ~10 minutes Sequence Diagram(s)sequenceDiagram
participant AttrCompletionProvider
participant ResourceTableRegistry
participant AndroidStyleables
participant CompletionItems
AttrCompletionProvider->>ResourceTableRegistry: identify Android resource package
AttrCompletionProvider->>AndroidStyleables: collect styleable attributes
AndroidStyleables-->>AttrCompletionProvider: return attribute names
AttrCompletionProvider->>CompletionItems: create items for non-placeholder attributes
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@testing/resources/test-project/app/src/main/res/layout/TestNoRemovedPlaceholderAttrs_template.xml`:
- Around line 17-29: Update the XML indentation in
TestNoRemovedPlaceholderAttrs_template.xml to use tabs for the nested TextView
and its attributes, while preserving the existing android:__@@cursor@@ marker
and Spotless exclusion.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 09716d9a-dcba-491d-883e-ec20c2043068
📒 Files selected for processing (4)
build.gradle.ktslsp/xml/src/main/java/com/itsaky/androidide/lsp/xml/providers/completion/AttrCompletionProvider.ktlsp/xml/src/test/java/com/itsaky/androidide/lsp/xml/providers/completion/LayoutAttributeCompletionProviderTest.kttesting/resources/test-project/app/src/main/res/layout/TestNoRemovedPlaceholderAttrs_template.xml
…fixture Matches the repo's tabs convention; the file is Spotless-excluded so it won't be auto-formatted, so fix it by hand. Cursor marker unaffected.
Summary
__removed0/__removed1/... placeholder attrs (kept so retired attribute IDs aren't reused, b/131100106) out ofandroid:attribute completion inAttrCompletionProvider. They have no<public>entry inpublic-final.xmland were leaking into the completion popup.testing/resources/test-project/**/*_template.xmlfrom the XML Spotless target — these 43 LSP test fixtures embed an@@cursor@@marker inside attribute-like text, and the Eclipse WTP formatter splits it across lines, silently breaking the cursor lookup the test harness relies on (same class of issue as the existingstrings.xmlexclusion).Fixes ADFA-4980.
Test plan
removed placeholder attributes must not be includedtoLayoutAttributeCompletionProviderTest, with a newTestNoRemovedPlaceholderAttrs_template.xmlfixture; confirmed it fails without the fix and passes with it.:lsp:xml:testV8DebugUnitTestpasses.spotlessCheckpasses.🤖 Generated with Claude Code