Results 1 to 7 of 7

Thread: gedit syntax highlight

  1. #1
    Join Date
    Nov 2009
    Location
    Mexico
    Beans
    8
    Distro
    Ubuntu 9.10 Karmic Koala

    gedit syntax highlight

    Hello, I'm trying to make gedit automatically highlight *.as files when I open them. Here is what I've done so far:

    1) I created a custom highlight spec in /usr/share/gtksourceview-2.0/language-specs/actionscript3.lang. This is the head of the file:

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE language SYSTEM "language.dtd">
    <language id="actionscript3" _name="ActionScript 3" version="1.0" _section="Sources">
    <metadata>
    <property name="mimetypes">text/x-actionscript3</property>
    <property name="globs">*.as</property>
    <property name="line-comment-start">//</property>
    <property name="block-comment-start">/*</property>
    <property name="block-comment-end">*/</property>
    </metadata>
    .
    .
    .

    Now I can select it inside gedit with View > Highlight Mode > Sources > ActionScript 3 and it works fine.

    2) I created a custom mimetype in the following locations with the following data

    ~/.mime.types

    text/x-actionscript3 as
    /usr/share/mime/packages/freedesktop.org.xml

    <mime-type type="text/x-actionscript3">
    <comment>AS3 source code</comment>
    <generic-icon name="text-x-generic"/>
    <glob pattern="*.as"/>
    <sub-class-of type="text/plain"/>
    </mime-type>

    ~/.local/share/mime/packages/actionscript3.xml

    <mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
    <mime-type type="text/x-actionscript3">
    <comment>ActionScript 3 Source</comment>
    <!-- more translated comment elements -->
    <glob pattern="*.as"/>
    </mime-type>
    </mime-info>

    and restarted. Now both nautilus and gedit recognize .as files as text/x-actionscript3. However I still have to manually select ActionScript Highlight from the menu. Is there something else I can try?

    Thank you for your time.
    Heron Anzures.

  2. #2
    Join Date
    May 2006
    Location
    Victoria, Australia
    Beans
    648
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: gedit syntax highlight

    hello,

    You need to update the mime database

    Third part of this http://ubuntuforums.org/showthread.php?t=742981 shows you how to do that

    Also, you can find some syntax files here : http://code.google.com/p/flashbsm/so...anguage-specs/

    if u find some of my ideas weird...look at my avatar for the reason
    http://delfick.storage.googlepages.c...ycfuserbar.png

  3. #3
    Join Date
    Nov 2009
    Location
    Mexico
    Beans
    8
    Distro
    Ubuntu 9.10 Karmic Koala

    Re: gedit syntax highlight

    Thank you delfick. I just updated the mime database as you suggested, but nothing happened. I still have to manually pick the syntax highlight. I believe the mimetype is not the problem, because both nautilus and gedit recognize *.as files as text/x-actionscript3 as expected. The same goes for gnomevfs-info command. I don't know where the problem lies though. But thank you I'll keep looking.

    Heron Anzures

  4. #4
    Join Date
    May 2006
    Location
    Victoria, Australia
    Beans
    648
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: gedit syntax highlight

    hmmm, I'm not sure then........... sorry
    if u find some of my ideas weird...look at my avatar for the reason
    http://delfick.storage.googlepages.c...ycfuserbar.png

  5. #5
    Join Date
    Nov 2009
    Location
    Mexico
    Beans
    8
    Distro
    Ubuntu 9.10 Karmic Koala

    Re: gedit syntax highlight

    I found the problem!. Looks like there is something wrong in my actionscript3.lang file, maybe some deprecated tags or something, because I tried one of yours and it worked. It's strange though, that I was able to select it from inside gedit and reported no problems. Now I'll just try different highlight specs.
    Thank you.
    Heron Anzures.
    Last edited by oviorus; February 23rd, 2010 at 01:43 AM.

  6. #6
    Join Date
    May 2006
    Location
    Victoria, Australia
    Beans
    648
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: gedit syntax highlight

    Quote Originally Posted by oviorus View Post
    I found the problem!
    Awesome
    . Looks like there is something wrong in my actionscript3.lang file, maybe some deprecated tags or something, because I tried one of yours and it worked. It's strange though, that I was able to select it from inside gedit and reported no problems.
    weird....

    Thank you.
    Heron Anzures.
    no probs
    if u find some of my ideas weird...look at my avatar for the reason
    http://delfick.storage.googlepages.c...ycfuserbar.png

  7. #7
    Join Date
    Jun 2010
    Beans
    49

    Re: gedit syntax highlight

    Where's the lang definition you downloaded? I can't find it in any of the links mentioned above.

    The one at http://code.google.com/p/flashbsm/so...anguage-specs/ is 2.0

    thanks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •