Recent Changes‎ > ‎

XML Code Completion Improvements

posted Mar 18, 2011, 8:48 AM by Tor Norbye
We've improved the XML code completion in a number of ways:
  • Improved sorting: When completing resources, the type of the current attribute will be consulted, so if you are for example editing an android:text attribute, then @string/ and @android:string/ items will appear before other types of resources.

  • Flag completion: When entering flag attributes, such as the android:gravity attribute, you will be offered completion on adding additional flags

  • Suffix completion: When entering dimensions, you get completion on the various units (dp, mm, in, etc along with descriptions).
  • When entering a new attribute, we automatically insert the   =" " part to enter the value, and place the caret inside the value quotes.
  • We've fixed a number of bugs in this area. This was actually the bulk of the work - fixing corner cases here and there, handling replacement completion (such that invoking code completion on top of an existing attribute or element would replace the existing item.)  One notable fix is that we filter out some code completion items from the default XML editor. In particular, the editor would always add the current value of the attribute as a completion item - even if that value was just a prefix you had typed in, or if it contained a typo - which was confusing and not helpful.