Home Download Buy Blog Forum Support

Editing a syntax coloring

Re: Editing a syntax coloring

Postby agibsonsw on Wed Apr 04, 2012 5:00 pm

Thank you @atomi. Is this a document fragment, with the matches included within <patterns>.. </patterns>, or do I need all the other trimmings - like the DOCTYPE and a UUID?
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
agibsonsw
 
Posts: 901
Joined: Fri Jan 27, 2012 9:11 pm

Re: Editing a syntax coloring

Postby nick. on Wed Apr 04, 2012 5:56 pm

That's a fragment. You'll need at least the following to make it useful:
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
   <key>fileTypes</key>
   <array>
      <string>FILETYPE</string>
   </array>

   <key>name</key>
   <string>NAME</string>

   <key>scopeName</key>
   <string>SCOPENAME</string>

   <key>patterns</key>
   <array>
      [...]
   </array>

</dict>
</plist>
nick.
 
Posts: 266
Joined: Wed Jan 18, 2012 3:45 am

Re: Editing a syntax coloring

Postby agibsonsw on Wed Apr 04, 2012 6:30 pm

Thank you @nick.

I found a jQuery.tmLanguage file, which just needs to be updated with more recent jQuery methods :)

[BTW I couldn't have taken this approach with my additions to the Python language, as it's tmLanguage file is.. a minefield :lol:]
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
agibsonsw
 
Posts: 901
Joined: Fri Jan 27, 2012 9:11 pm

Re: Editing a syntax coloring

Postby nick. on Wed Apr 04, 2012 6:36 pm

agibsonsw wrote:Thank you @nick.

I found a jQuery.tmLanguage file, which just needs to be updated with more recent jQuery methods :)

[BTW I couldn't have taken this approach with my additions to the Python language, as it's tmLanguage file is.. a minefield :lol:]


Seems that a lot of the language files are very dense, and many are not up to date. I'm working through Perl from scratch (see signature), and have plans to continue through other languages. Feel free to push/pull from my repo; maybe we can get such a repo added to the Sublime organization on github?
nick.
 
Posts: 266
Joined: Wed Jan 18, 2012 3:45 am

Re: Editing a syntax coloring

Postby agibsonsw on Wed Apr 04, 2012 6:54 pm

@nick. I've managed to create a repo and update it, but I haven't yet discovered what pulling/ forking, etc. mean :lol: (grokking and borking also sound unpleasant..)

I've (eventually) managed to persuade Python.tmLanguage to behave as I'd like; in particular, I'm able to colour-match brackets - which is kinda cool :D. But I'm still tempted to delete the whole of the repository, remove, temporarily, all includes and delete any reference to dotted or generic names! This file is 2000+ lines, whereas JS is 700+ - and they are not that different..
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
agibsonsw
 
Posts: 901
Joined: Fri Jan 27, 2012 9:11 pm

Re: Editing a syntax coloring

Postby nick. on Wed Apr 04, 2012 7:06 pm

I've found it helpful to immediately fold at level 3 when working with language files. Even my Perl from scratch is approaching 3000 lines, that seems to be a byproduct of XML and the many different ways to do things in Perl. Python may be of similar syntactic complexity. I think my file is better simply for the whitespace and comments, and because I'm making better use of the repository.

I could be wrong, but I believe a pull means you're downloading someone's repo to your own system. If you then make changes and submit them (to your repo) that's a push. Then the original repo can pull from your changes. It's described better here.

Edit: I decided to learn it a bit more in depth. This page has more information about the process.
nick.
 
Posts: 266
Joined: Wed Jan 18, 2012 3:45 am

Re: Editing a syntax coloring

Postby agibsonsw on Wed Apr 04, 2012 7:31 pm

Thank you @nick. I shall read through those links.
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
agibsonsw
 
Posts: 901
Joined: Fri Jan 27, 2012 9:11 pm

Re: Editing a syntax coloring

Postby atomi on Sun Apr 08, 2012 6:21 am

@agibsonsw Sorry for the tmLanguage fragment. I had just guessed you were more familiar with the basic tmLanguage format.
Regardless, I should have definitely posted the complete file.

Also based on your posts, I figured the jquery repo you decided to contribute to is on GitHub, but I wasn't able to find it.
I'd love to check out your work on this too.

@nick I saw your Perl.tmlanguage file. It is really nice work and nicely (really nicely) documented too. :D

I decided to develop the ColdFusion.tmLanugage, ColdFusionComponent.tmLanguage and CFscript.tmLanguage files in somewhat of an unorthodox manner.
One which I feel may make nesting scopes, in this particular case, superfluous.

For example ColdFusioComponent.tmLanuage defaults to source.cfscript defined in the CFScript.tmLanguage file but includes cfml scope defined in the ColdFusion.tmLanguage when a cfcomponent tag is encountered. If you could comment on this particular strategy I would really love to hear your thoughts.

https://github.com/SublimeText/ColdFusion
atomi
 
Posts: 342
Joined: Thu Jan 20, 2011 5:06 pm
Location: Los Angeles CA US

Re: Editing a syntax coloring

Postby agibsonsw on Sun Apr 08, 2012 10:38 am

@atomi

Here's the jQuery bundle I found, although I haven't attempted to update it yet.

I'm still wrestling with tmLanguage ;). I've managed to hack the Python language syntax so that it behaves for me. In particular, I achieved colour-coordinated brackets :D. But it is, I believe, unnecessarily complicated. (There are 600+ lines to handle single-quoted strings, and this is repeated for double-quoted strings.)

I wish you well with your ColdFusion endeavours. Andy.
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
agibsonsw
 
Posts: 901
Joined: Fri Jan 27, 2012 9:11 pm

Re: Editing a syntax coloring

Postby atomi on Sun Apr 08, 2012 3:22 pm

@agibsonsw Thanks.

Oh okay I asked because I see another jquery bundle.
This one is available through package control https://github.com/SublimeText/jQuery and it's actively maintained.
atomi
 
Posts: 342
Joined: Thu Jan 20, 2011 5:06 pm
Location: Los Angeles CA US

PreviousNext

Return to General Discussion

Who is online

Users browsing this forum: Exabot [Bot], Yahoo [Bot] and 22 guests