Mxml support

Elenahx 12 years ago in General updated 12 years ago 8

It would be very nice to create .MXML files for Flex!!! :)

You can add your own TextMate-compatible syntax definitions to Textastic. Have a look at the manual: http://www.textasticapp.com/v4/manual/lessons/How_can_I_add_my_own_syntax_definitions__themes_and_templates.html

You can find a Flex TextMate bundle with an .mxml language definition at https://github.com/simongregory/flex-tmbundle

I already try this but it doesn't work for me...

What exactly does not work?

The instructions of the manual: If you want to create a new template, create a UTF-8 .json file in the "#Textastic/Templates" folder in Textastic and choose the template called "Template" in the "Textastic" category... 

I did this but changing 
  • uuid
  • category
  • templates

    • name
    • fileExtension
    • snippet

      then I reload the app but can't see my new MXML template... I'm confused probably I'm not following the instructions right and I tried many times 

Ok I know what it's happening, I made a new example with putting: Hola, in the snippet part.. And the color is red.. But I want to put: <?xml version="1.0" encoding="utf-8"?>

<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009" 
and the color change... How do I need to write this correctly?

Ah, ok. My answer above was for adding syntax highlighting support for .mxml files. I didn't realize you wanted to add a template.

You need to json-encode the snippet string. So in your case, you need to escape the quote characters and newlines. 

Replace " with \" and newlines with \n

It would something like this:

snippet = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<s:WindowedApplication xmlns:fx=\"http://ns.adobe.com/mxml/2009\" \n                       xmlns:s=\"library://ns.adobe.com/flex/spark\" \n                       xmlns:mx=\"library://ns.adobe.com/flex/m\""

Oh, and for new templates to be picked up by Textastic, you do not need to restart the app. It's sufficient to just add a new file and select the template.

Thanks a lot, now it works!! Thank you so much