XCode syntax highlighting for Javascript/Ruby

Posted:
in Genius Bar edited January 2014
There is no choice under the "New File" menu to create a Javascript, Ruby, Python, or Perl script, yet most of those apparently are supported by the syntax highlighting. I *assume* that XCode figures this out by the filename extension, so I created a file and saved it with the proper extension. What happened is I got very little syntax color support until I closed the file and reopened it. Then it seemed to start working.



Is this what everyone else is experiencing, or am I just doing something wrong?

Comments

  • Reply 1 of 1
    thuh freakthuh freak Posts: 2,664member
    i get a very similar action, when i start writing a shell script inside project builder/xcode. The first line of a shell script is often:

    Code:


    #!/bin/sh





    Or something similar. If I open a new file, that won't be hilited, nor will anything else. If I save that and open it up, everything from then on will be properly hilited. I guess that it goes by the contents of the file, but only checks it when opening the file. So, it reads a little, says "isa shell script?" "no." "isa ruby/javascript/..?" "yes, i'ma color for that." but that conversation only happens when the file opens.



    .



    also, you can save template files to make ruby and javascript and any thing else a possibility. If you look in /Developer and find a folder that has *Projects* in its path and *Templates* in its folder name, then you can inspect it. its trivial to learn how to create your own template after poking through these templates.
Sign In or Register to comment.