I was wondering how to handle snippets for various XML types. For example, I'm developing some snippets for the Quotation Exchange Language [1]. Although QEL is just XML with a specific schema, its snippets are totally unique and would be useless in any other XML file. That makes me inclined to give the QEL snippets their own scope (to avoid potential naming conflicts between tag triggers). But how can this be done? It seems like I'd have to create a new language type for QEL, but I'd simply be duplicating the XML bundle -- not just for QEL but for all the XML file types I'm writing snippets for. The thought of all that redundancy bothers me; perhaps there's some way of "subclassing" the XML language type? Or is there an entirely different way to handle this kind of thing?
Trevor
On Mar 29, 2006, at 2:58 AM, Trevor Harmon wrote:
The thought of all that redundancy bothers me; perhaps there's some way of "subclassing" the XML language type? Or is there an entirely different way to handle this kind of thing?
It's called: include='text.xml'; just create a new language with this in its patterns, that should do it, I think. You could even override some of the scopes to get finer results, if desired.
Trevor
Haris
On Mar 29, 2006, at 11:01 AM, Charilaos Skiadas wrote:
On Mar 29, 2006, at 2:58 AM, Trevor Harmon wrote:
The thought of all that redundancy bothers me; perhaps there's some way of "subclassing" the XML language type? Or is there an entirely different way to handle this kind of thing?
It's called: include='text.xml'; just create a new language with this in its patterns, that should do it, I think. You could even override some of the scopes to get finer results, if desired.
Interesting; that works, but only if I put it in the XML bundle. If I try to put the QEL language definition into its own bundle, then TextMate starts thinking all XML files are QEL files. (Is this a bug or a feature?)
Also, include='text.xml' only seems to work for the patterns field. I find that I have to cut-and-paste the XML definitions of folding*Marker, firstLineMatch_disabled, and repository into the QEL language definition, instead of just including them. Or am I missing something? Thanks,
Trevor
On 5/4/2006, at 2:42, Trevor Harmon wrote:
Interesting; that works, but only if I put it in the XML bundle. If I try to put the QEL language definition into its own bundle, then TextMate starts thinking all XML files are QEL files. (Is this a bug or a feature?)
The placement of the language grammar should have no effect on what TM thinks about files. The TM_MODE environment variable is set to the bundles name, but this variable is deprecated, and likely this is not what you refer to.
However, if QEL files and XML files have the same extension, TM will treat them as either the one or the other, it can’t spot the difference (unless you use the firstLineMAtch).
Also, include='text.xml' only seems to work for the patterns field. I find that I have to cut-and-paste the XML definitions of folding*Marker, firstLineMatch_disabled, and repository into the QEL language definition, instead of just including them. Or am I missing something? Thanks,
That is correct.