Uploaded image for project: 'Alloy'
  1. Alloy
  2. ALOY-388

TiStudio code completion for Alloy view files (XML)



      Alloy view files, which are XML, need code completion in TiStudio. There are 2 primary points at which code completion should be shown:

      1. When a user types an opening angle bracket (<) and begins to type the name of a Titanium API, a list of possible code completions should appear
      2. When a user has already typed the name of the element, code completion should help with typing the attributes of the XML element, based on the name of the element.

      To do this, I assume TiStudio can continue to use the jsca documentation that it currently uses for code completion in traditional Titanium javascript files. This same method of code completion would then be applied instead to the creation of the Alloy XML views.

      There are a couple special considerations when dealing with Alloy view XML. I will list them below, in order from least to highest priority in terms of determining which API is being created in the XML.

      1. By default, all XML elements are assumed to be using the Ti.UI namespace. For example:


        would assume that the Titanium API to be created would be Ti.UI.Label.

      2. Alloy has a set of "implicit namespaces" to make XML creation easier. For example:


        will not assume Ti.UI, but will instead assume Ti.UI.iOS as the namespace for the created component. Alloy has a listing of all "implicit namespaces" and will provide a means of generating the listing that TiStudio can use to improve the autocompletion for attributes.

      3. Finally, Alloy allows for a ns attribute which will explicitly set the namespace of the API to be created. For example:

        <View ns="Ti.Map"/>

        would create a Ti.Map.View and autocompletion for attributes should apply to this API.

      From initial conversations about Alloy view autocompletion, it sounds as though the TiStudio team will need to establish criteria for determining that they are autcompleting for Alloy XML vs. generic XML, as they share the same extension. Hopefully there is additional criteria that can be used to make this distinction.


      A list of implicit namespaces can now be retrieved from Alloy by issuing the following command:

      alloy info namespaces

      The list of implicit namespaces will returned as a JSON object. The object will look like this and will update as necessary with Alloy versions. The format will remain the same.

          "Collection": "Alloy",
          "Model": "Alloy",
          "Require": "Alloy",
          "Widget": "Alloy",
          "ButtonNames": "Alloy.Abstract",
          "ButtonName": "Alloy.Abstract",
          "BarItemTypes": "Alloy.Abstract",
          "BarItemType": "Alloy.Abstract",
          "CoverFlowImageTypes": "Alloy.Abstract",
          "CoverFlowImageType": "Alloy.Abstract",
          "FlexSpace": "Alloy.Abstract",
          "Images": "Alloy.Abstract",
          "Item": "Alloy.Abstract",
          "Items": "Alloy.Abstract",
          "Labels": "Alloy.Abstract",
          "Option": "Alloy.Abstract",
          "Options": "Alloy.Abstract",
          "Menu": "Ti.Android",
          "MenuItem": "Ti.Android",
          "Annotation": "Ti.Map",
          "VideoPlayer": "Ti.Media",
          "MusicPlayer": "Ti.Media",
          "AdView": "Ti.UI.iOS",
          "CoverFlowView": "Ti.UI.iOS",
          "TabbedBar": "Ti.UI.iOS",
          "Toolbar": "Ti.UI.iOS",
          "DocumentViewer": "Ti.UI.iPad",
          "Popover": "Ti.UI.iPad",
          "SplitWindow": "Ti.UI.iPad",
          "NavigationGroup": "Ti.UI.iPhone",
          "StatusBar": "Ti.UI.iPhone"


          Issue Links



              • Assignee:
                tlukasavage Tony Lukasavage
              • Watchers:
                3 Start watching this issue


                • Created:

                  Backbone Issue Sync

                  • Backbone Issue Sync is enabled for your project, but we do not have any synchronization info for this issue.

                    Git Integration