JavaScript - syntax highlight alternate function definitions

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

JavaScript - syntax highlight alternate function definitions

Jon Trelfa
I have javascript code that uses 2 different function definition styles:

function foo()
{
  alert('bar');
}

And

var master =
{
  foo:function()
  {
    alert('bar');
  }
};

The syntax highlighting gets a little weird on the second one (with the object literal).  I'm very new and not 100% sure how to edit syntax highlighting files to adjust for this - any ideas?

Thanks,

Jon

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: JavaScript - syntax highlight alternate function definitions

Charles Campbell

Jon Trelfa wrote:

> I have javascript code that uses 2 different function definition styles:
>
> function foo()
> {
>   alert('bar');
> }
>
> And
>
> var master =
> {
>   foo:function()
>   {
>     alert('bar');
>   }
> };
>
> The syntax highlighting gets a little weird on the second one (with
> the object literal).  I'm very new and not 100% sure how to edit
> syntax highlighting files to adjust for this - any ideas?
One easy thing to do is to attempt to contact the syntax highlighting
maintainer for java:

 1)  in vim, type  :echo &rtp  .  The third directory is likely your
system directory.
 2) assuming that your system directory is /usr/local/share/vim/vim72,
change directory to /usr/local/share/vim/vim72/syntax
 3) vim java.vim
 4) On or about the third line you'll find the maintainer's name and email
 5) Send him/her a note about how to elicit the problem like you've done
above.

Not all syntax maintainers are active on this list, and oftentimes
they're willing to help you get the syntax highlighting correct.

Regards,
Chip Campbell


--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: JavaScript - syntax highlight alternate function definitions

Doug Kearns
In reply to this post by Jon Trelfa

On 6/2/09, Jon Trelfa <[hidden email]> wrote:
<snip>

> The syntax highlighting gets a little weird on the second one (with the
> object literal).  I'm very new and not 100% sure how to edit syntax
> highlighting files to adjust for this - any ideas?

There's a number of alternative files available. Try searching vim.org
and elsewhere.

For example, Yi Zhao's works quite well and Nikolai Weibull sent me a
version some time ago but I'm not sure if he ever released that.

Doug

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---