Hello,
I'm evaluating TextMate (coming from Vim) and I really like what I see. I'm now trying to create my first Bundle, to deal with some editing I do every week to create the Caml Weekly News. The format I'm using is xml, so I'd like to have a Bundle with the same language syntax, a few new snippets, and a command stolen from the HTML bundle.
About the language syntax, I'm a little confused by what the manual says (http://macromates.com/textmate/manual/ language_grammars#language_grammars) about scopeName:
"scopeName (line 1) — this should be a unique name for the grammar, following the convention of being a dot-separated name where each new part specializes the name. Normally it would be a two-part name where the first is either text or source, and the second is the name of the language or document type. But if you are specializing an existing type, you probably want to derive the name from the type you are specializing. E.g. Markdown is text.html.markdown and Ruby on Rails (rhtml files) is text.html.rails. The advantage of deriving it from (in this case) text.html is that everything which works in the text.html scope will also work in the text.html.«something» scope (but with a lower precedence than something specifically targeting text.html.«something»)."
So I tried a scopeName of "text.xml.CWN" to see if I would get XML like syntax hilighting for free, but it did not work. I had to do:
{ scopeName = 'text.xml.cwn'; fileTypes = ( ); patterns = ( { include = 'text.xml'; } ); }
including the text.xml language.
Is this the correct way to proceed?
Another question is about the presence of a support directory in a tmbundle (as there is one in the html bundle). Do they need to be created by hand in the Finder, or is there a way to add a Support file using the Bundle Editor?
My last question is about snippets: it seems that it's not possible to invoke a snippet while completing one (that is, in the middle of tabbing through all the fields to fill). Is it the case?
Thanks a lot,
Alan
On 12/02/2006, at 12:33, Alan Schmitt wrote:
"scopeName (line 1) — this should be a unique name [...] The advantage of deriving it from (in this case) text.html is that everything which works in the text.html scope will also work in the text.html.«something» scope (but with a lower precedence than something specifically targeting text.html.«something»)." So I tried a scopeName of "text.xml.CWN" to see if I would get XML like syntax hilighting for free, but it did not work.
What the explanation refers to, is that commands, macros and snippets with scope set to text.xml will now work in your derived language as well. This would be stuff designed to manipulate or assist in writing xml. Syntax highlight, is a different matter and getting it to work as you want, is (AFAIK) achieved the way you subsequently explain.
Is this the correct way to proceed?
So that would be a yes on that one :-).
-- Sune.
On 12 févr. 06, at 13:15, Sune Foldager wrote:
On 12/02/2006, at 12:33, Alan Schmitt wrote:
"scopeName (line 1) — this should be a unique name [...] The advantage of deriving it from (in this case) text.html is that everything which works in the text.html scope will also work in the text.html.«something» scope (but with a lower precedence than something specifically targeting text.html.«something»)." So I tried a scopeName of "text.xml.CWN" to see if I would get XML like syntax hilighting for free, but it did not work.
What the explanation refers to, is that commands, macros and snippets with scope set to text.xml will now work in your derived language as well. This would be stuff designed to manipulate or assist in writing xml.
Ah, thank you very much for this clarification.
Alan
On 12/2/2006, at 12:33, Alan Schmitt wrote:
[...] Another question is about the presence of a support directory in a tmbundle (as there is one in the html bundle). Do they need to be created by hand in the Finder, or is there a way to add a Support file using the Bundle Editor?
They need to be created by hand.
My last question is about snippets: it seems that it's not possible to invoke a snippet while completing one (that is, in the middle of tabbing through all the fields to fill). Is it the case?
Yes, nested snippets are not supported (but planned).