aboutsummaryrefslogtreecommitdiff
path: root/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-completion12.txt
diff options
context:
space:
mode:
authorTor Norbye <tnorbye@google.com>2011-03-14 21:03:56 -0700
committerTor Norbye <tnorbye@google.com>2011-03-15 11:08:23 -0700
commitbfe50d0630041bbc3e3b2b5182d18e139f2879bf (patch)
treeb991c8b0a228521a594eaa5c8f1156de4d20d141 /eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-completion12.txt
parentccae5afa5372704e222ed4462bb72b4f22be5429 (diff)
downloadsdk-bfe50d0630041bbc3e3b2b5182d18e139f2879bf.tar.gz
XML code completion improvements
This changeset contains a number of improvements to the code completion in XML files. (1) Add suffix completion in attribute values. For dimensional attributes, this will add in (or complete prefixes of) units like "dp", "sp", etc. For fractional attributes, the % and %p suffixes are completed. (In both cases, there is also a tooltip message provided shown in the completion documentation popup). In addition, for flag values, when completing at the end of a flag, then the separator character (|) along with the other flag values (except those already set) are offered. (2) Handle completion when the caret is not at the end. For example, if you have the following source: layout_w^idth="wrap_content" (^ = caret position) then if you invoke code completion you will also be offered the attribute layout_weight, and selecting it will -replace- the layout_width attribute with layout_height, it will not insert layout_weight in the middle of layout_width. This handling is done not just for attribute names as shown here but for attribute values and element tag names as well. (3) Improve @resource/ completion sorting. When completing resources, consider which attribute is being completed, and use that information to sort the resources. For example, if completing a "text" attribute then @string/, and @android:string/ resources will be listed first. For attributes like margins @dimen will be first, for include layout the @layout attributes will be listed first, and so on. Also, the resources are sorted alphabetically as the second sort key. (4) Hide some builtin Eclipse code completion items. In particular, the default code completion provider for Eclipse will always add the current attribute value as a completion. This is extremely confusing since if you have a typo, code completion will tell you that what you have is okay. I personally witnessed this confusing a user who had typed something from memory and code completion seemed to him to "confirm" that he had it right. To fix this, the code which installs completion providers, will identify the builting WST completion provider, and when found, replace it with a "filtering" wrapper. This completion provider delegates all its calls to the WST completion provider, but it recognizes a few patterns, in particular the above attribute value completion proposal as well as some namespace and schema ones, and removes these. (The reason we only filter out these items instead of removing it completely is that the completion provider also appears to be responsible for inserting code templates defined by the user, and we don't want to neuter those if defined by the user.) (5) Fix a bunch of corner cases - flags could only have a single separator (|), resource attribute completion items were missing icons, and completion in some positions was not working. (6) Unit tests. There are now comprehensive unit tests for code completion. Each unit test points to a particular source file and a particular position within the source file, and code completion is invoked for that position. A set of unit tests dump out the allowed completion items for each such position, and these are compared against golden files. A second set of unit tests then specify a particular code completion item among the choices to be applied, and then applies that completion item to the document. This, along with the caret position (indicated as ^) is written into a golden file and used for comparisons. To make it easy to see what these tests do, the golden file is actually recorded as a diff, so in the test you will see something like this: Code completion in completion1.xml for android:gravity="left|b^ottom" selecting bottom: < android:gravity="left|bottom" --- > android:gravity="left|bottom^" (6) There are some other misc changes. We had some code which used "dip" for device indepdendent pixels (such as the AbsoluteLayout handler). Since "dp" seems to be preferred, the code will now use that instead. Change-Id: I8bd5c8336d8747dac1f10a9269ea4197f304cb70
Diffstat (limited to 'eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-completion12.txt')
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-completion12.txt60
1 files changed, 60 insertions, 0 deletions
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-completion12.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-completion12.txt
new file mode 100644
index 000000000..4af986bd7
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-completion12.txt
@@ -0,0 +1,60 @@
+Code completion in completion1.xml for btn_default">^</FrameLayout>:
+<AbsoluteLayout ></AbsoluteLayout>
+<AdapterViewFlipper ></AdapterViewFlipper>
+<DialerFilter ></DialerFilter>
+<ExpandableListView ></ExpandableListView>
+<FrameLayout ></FrameLayout>
+<GridView ></GridView>
+<HorizontalScrollView ></HorizontalScrollView>
+<ImageSwitcher ></ImageSwitcher>
+<LinearLayout ></LinearLayout>
+<ListView ></ListView>
+<MediaController ></MediaController>
+<RadioGroup ></RadioGroup>
+<RelativeLayout ></RelativeLayout>
+<ScrollView ></ScrollView>
+<SearchView ></SearchView>
+<SlidingDrawer ></SlidingDrawer> : SlidingDrawer specific attributes.
+<StackView ></StackView>
+<TabHost ></TabHost>
+<TabWidget ></TabWidget>
+<TableLayout ></TableLayout>
+<TableRow ></TableRow>
+<TextSwitcher ></TextSwitcher>
+<ViewAnimator ></ViewAnimator>
+<ViewFlipper ></ViewFlipper>
+<ViewSwitcher ></ViewSwitcher>
+<GestureOverlayView /> : GestureOverlayView specific attributes.
+<SurfaceView />
+<View /> : Attributes that can be used with android.view.View or any of its subclasses.
+<ViewStub /> : A android.view.ViewStub lets you lazily include other XML layouts inside your application at runtime.
+<WebView />
+<AnalogClock />
+<AutoCompleteTextView />
+<Button />
+<CalendarView />
+<CheckBox />
+<CheckedTextView />
+<Chronometer />
+<DatePicker />
+<DigitalClock />
+<EditText />
+<Gallery />
+<ImageButton />
+<ImageView />
+<MultiAutoCompleteTextView />
+<NumberPicker />
+<ProgressBar />
+<QuickContactBadge />
+<RadioButton />
+<RatingBar />
+<SeekBar />
+<Spinner />
+<TextView />
+<TimePicker />
+<ToggleButton />
+<TwoLineListItem />
+<VideoView />
+<ZoomButton />
+<ZoomControls />
+<include /> : Lets you statically include XML layouts inside other XML layouts.