Skip to content

ADFA-4980: Filter __removedN placeholder attrs from XML completion - #1623

Merged
davidschachterADFA merged 2 commits into
stagefrom
bugfix/ADFA-4980-xml-attr-completion-removed
Aug 4, 2026
Merged

ADFA-4980: Filter __removedN placeholder attrs from XML completion#1623
davidschachterADFA merged 2 commits into
stagefrom
bugfix/ADFA-4980-xml-attr-completion-removed

Conversation

@davidschachterADFA

Copy link
Copy Markdown
Collaborator

Summary

  • Filters AOSP's __removed0/__removed1/... placeholder attrs (kept so retired attribute IDs aren't reused, b/131100106) out of android: attribute completion in AttrCompletionProvider. They have no <public> entry in public-final.xml and were leaking into the completion popup.
  • Excludes testing/resources/test-project/**/*_template.xml from 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 existing strings.xml exclusion).

Fixes ADFA-4980.

Test plan

  • Added removed placeholder attributes must not be included to LayoutAttributeCompletionProviderTest, with a new TestNoRemovedPlaceholderAttrs_template.xml fixture; confirmed it fails without the fix and passes with it.
  • :lsp:xml:testV8DebugUnitTest passes.
  • spotlessCheck passes.

🤖 Generated with Claude Code

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.

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.

@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: f1859d27-8410-4eb2-a78b-9097b4ec209f

📥 Commits

Reviewing files that changed from the base of the PR and between 84c0363 and 304443b.

📒 Files selected for processing (1)
  • testing/resources/test-project/app/src/main/res/layout/TestNoRemovedPlaceholderAttrs_template.xml
🚧 Files skipped from review as they are similar to previous changes (1)
  • testing/resources/test-project/app/src/main/res/layout/TestNoRemovedPlaceholderAttrs_template.xml

📝 Walkthrough
  • Filters AOSP __removed0, __removed1, and similar placeholder attributes from android: XML attribute completion.
  • Adds a regression test and layout fixture for removed-attribute filtering.
  • Excludes XML LSP test templates containing @@cursor@@ markers from Spotless formatting.
  • Reformats affected Kotlin files with Spotless.
  • Risk: Broad formatting changes increase review noise and may obscure functional changes.
  • Validation: :lsp:xml:testV8DebugUnitTest and spotlessCheck pass.

Walkthrough

The 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.

Changes

XML completion filtering

Layer / File(s) Summary
Removed-attribute filtering
lsp/xml/src/main/java/com/itsaky/androidide/lsp/xml/providers/completion/AttrCompletionProvider.kt
AttrCompletionProvider detects AAPT removed-attribute placeholders and skips matching Android styleable attributes during completion. Existing completion flow remains unchanged.
Fixture and formatting support
testing/resources/test-project/app/src/main/res/layout/TestNoRemovedPlaceholderAttrs_template.xml, lsp/xml/src/test/java/com/itsaky/androidide/lsp/xml/providers/completion/LayoutAttributeCompletionProviderTest.kt, build.gradle.kts
The layout fixture adds an attribute cursor placeholder. Spotless excludes XML templates. The completion test is reformatted without behavior changes.

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
Loading

Poem

I’m a rabbit guarding XML’s lane,
Removed names vanish from the train.
A cursor hops through layout space,
Spotless skips the template place.
Tabs align, and tests remain—
Clean completions sprout again.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes filtering __removedN placeholder attributes from XML completion.
Description check ✅ Passed The description directly explains the attribute filtering, Spotless exclusion, regression test, fixture, and validation results.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch bugfix/ADFA-4980-xml-attr-completion-removed

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

📥 Commits

Reviewing files that changed from the base of the PR and between 5305e52 and 84c0363.

📒 Files selected for processing (4)
  • build.gradle.kts
  • lsp/xml/src/main/java/com/itsaky/androidide/lsp/xml/providers/completion/AttrCompletionProvider.kt
  • lsp/xml/src/test/java/com/itsaky/androidide/lsp/xml/providers/completion/LayoutAttributeCompletionProviderTest.kt
  • testing/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.
@davidschachterADFA
davidschachterADFA merged commit ba381bb into stage Aug 4, 2026
4 checks passed
@davidschachterADFA
davidschachterADFA deleted the bugfix/ADFA-4980-xml-attr-completion-removed branch August 4, 2026 12:48
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.

2 participants