It seems to me that there is a bug in the smarty bundle. Any time you have a ' in a comment or as an apostrophe in text (as in don't) it thinks it's the start of a string and throws off the hilighting for the rest of the page.
Is this the right place to report this?
On 22. Oct 2006, at 08:11, Rick Gigger wrote:
It seems to me that there is a bug in the smarty bundle. Any time you have a ' in a comment or as an apostrophe in text (as in don't) it thinks it's the start of a string and throws off the hilighting for the rest of the page.
The Smarty bundle itself contains only a grammar to be embedded in HTML, not a root-level-grammar.
So you should still use HTML as the language, but you need to make one edit to the HTML grammar to activate the Smarty blocks.
Unfortunately the image links are broken here [1], so locate this rule in the HTML grammar:
smarty = { patterns = ( { begin = '({(literal)})'; end = '({/(literal)})'; captures = { 1 = { name = 'source.smarty.embedded.html'; }; 2 = { name = 'support.function.built-in.smarty'; }; }; }, { name = 'source.smarty.embedded.html'; begin = '{{|{'; end = '}}|}'; patterns = ( { include = 'source.smarty'; } ); disabled = 1; }, ); };
Then change that last disabled to ‘= 0’ or remove it.
[1] http://clickablebliss.com/blog/2006/01/04/ teach_textmate_about_smarty/
Allan Odgaard wrote:
On 22. Oct 2006, at 08:11, Rick Gigger wrote:
It seems to me that there is a bug in the smarty bundle. Any time you have a ' in a comment or as an apostrophe in text (as in don't) it thinks it's the start of a string and throws off the hilighting for the rest of the page.
The Smarty bundle itself contains only a grammar to be embedded in HTML, not a root-level-grammar.
So you should still use HTML as the language, but you need to make one edit to the HTML grammar to activate the Smarty blocks.
Unfortunately the image links are broken here [1], so locate this rule in the HTML grammar:
smarty = { patterns = ( { begin = '(\{(literal)\})'; end = '(\{/(literal)\})'; captures = { 1 = { name = 'source.smarty.embedded.html'; }; 2 = { name = 'support.function.built-in.smarty'; }; }; }, { name = 'source.smarty.embedded.html'; begin = '{{|{'; end = '}}|}'; patterns = ( { include = 'source.smarty'; } ); disabled = 1; }, ); };
Then change that last disabled to ‘= 0’ or remove it.
Thanks! That worked great! Is there any reason it's disabled by default? Any plans to make that sort of thing more user friendly in the future?
On 27. Oct 2006, at 00:22, Rick Gigger wrote:
[...] Then change that last disabled to ‘= 0’ or remove it.
Thanks! That worked great! Is there any reason it's disabled by default? Any plans to make that sort of thing more user friendly in the future?
Yes, having { start embedding of smarty code gives a hell of a lot false positives for people who e.g. have code listings in their HTML.
As for the future: with scope injection this will just be installing/ enabling the Smarty bundle, and then it will magically work all the places where HTML is allowed -- though with some new attributes in the scope, it will be possible to limit it to only HTML files with a given extension, for certain projects, etc.
That said, changing ‘disabled = 0;’ to ‘disabled = 1;’ is not exactly rocket science, just requires to RTFM ;)
Allan Odgaard wrote:
On 27. Oct 2006, at 00:22, Rick Gigger wrote:
[...] Then change that last disabled to ‘= 0’ or remove it.
Thanks! That worked great! Is there any reason it's disabled by default? Any plans to make that sort of thing more user friendly in the future?
Yes, having { start embedding of smarty code gives a hell of a lot false positives for people who e.g. have code listings in their HTML.
As for the future: with scope injection this will just be installing/enabling the Smarty bundle, and then it will magically work all the places where HTML is allowed -- though with some new attributes in the scope, it will be possible to limit it to only HTML files with a given extension, for certain projects, etc.
That said, changing ‘disabled = 0;’ to ‘disabled = 1;’ is not exactly rocket science, just requires to RTFM ;)
No, actually doing it was not rocket science at all. Figuring out that that was what needed to be done, well that's another matter.
I hope this doesn't at all sound like complaining but rather trying to give my perspective on this. Maybe I'm just slow but...
Figuring out what to do required me to make the following leaps:
1) The Smarty module was not enabled when in HTML mode. This was not intuitive to me because if I understand correctly the PHP is also just another language embedded in HTML but "just works" without any fiddling.
2) That simply viewing things as Smarty files doesn't work because it needs to start off in HTML mode.
3) How exactly to enable it.
It all makes sense now but I couldn't for the life of me figure out how to get it to work before.
I'm looking at the manual located at: http://macromates.com/textmate/manual/ and I'm not really seeing where any of that is located. I haven't read the whole thing but I also don't see a search feature anywhere.
Don't get me wrong, the only frustrating thing about Textmate is that it has progressed so quickly and has so many features that it has not been possible (as far as I can tell) for the docs to keep up. Or maybe I just haven't figured out how to quickly find things in the docs or maybe there are more complete or up to date docs somewhere. But I have had a lot of trouble just trying to RTFM and find the answers to my questions.
Not that it really matters though since the mailing list is so responsive.
Thanks!
On 27. Oct 2006, at 07:11, Rick Gigger wrote:
[...] I'm looking at the manual located at: http://macromates.com/textmate/manual/ and I'm not really seeing where any of that is located. I haven't read the whole thing but I also don't see a search feature anywhere.
The manual does not cover bundles -- instead look for a help file in the Bundles → «name of bundle» menu.
Allan Odgaard wrote:
On 27. Oct 2006, at 07:11, Rick Gigger wrote:
[...] I'm looking at the manual located at: http://macromates.com/textmate/manual/ and I'm not really seeing where any of that is located. I haven't read the whole thing but I also don't see a search feature anywhere.
The manual does not cover bundles -- instead look for a help file in the Bundles → «name of bundle» menu.
Ahhhh. That explains a lot.
I think section 5.6 in the manual, titled "Assorted Bundles" threw me off, because it looked like a section dedicated to documenting the bundles. I figured it was just way, way behind.
Thanks for the tip.
Rick