When editing Ruby code, everything after the first "/" in code turns yellow. For example, in the code
class Foo def bletch(num) @foo = num / 12 end end
everything from the "/" to the end of the file is yellow.
Is this a known issue? What can I do to fix it?
Jim
On Oct 7, 2004, at 5:57 AM, Jim Menard wrote:
When editing Ruby code, everything after the first "/" in code turns yellow. For example, in the code
class Foo def bletch(num) @foo = num / 12 end end
everything from the "/" to the end of the file is yellow.
Looks to me like it thinks it's a regexp literal.
Probably changing the syntax coloring for regexp literals to require a non-space after them would do it.
Gavin Kistner wrote:
On Oct 7, 2004, at 5:57 AM, Jim Menard wrote:
When editing Ruby code, everything after the first "/" in code turns yellow. For example, in the code
class Foo def bletch(num) @foo = num / 12 end end
everything from the "/" to the end of the file is yellow.
Looks to me like it thinks it's a regexp literal.
Probably changing the syntax coloring for regexp literals to require a non-space after them would do it.
Nope. The following could wouldn't work:
foo =~ / space_at_front/
Jim
OK, I've just recently downloaded TextMate and have so far only used it for woking on a new OCaml bundle for TextMate (I'll let ya'll know whan it's finished), but here are some of my impressions (mostly centered around the syntax section of the bundles).
1: Well, I'm pretty sure it's already passed BBEdit in my eyes -- BBEdit is really nice for doing HTMLish stuff, but not so good for general programming or even *TeX work -- TM seems to be much more flexible.
2: Am I wrong, or are the start/stop folding markers only available as a single pair? I would love to be able to supply a list of pairs to mark folds. For example, I would like to fold sections that match the following regex pairs (and probably others as well): <let>.*(?!<in>),(in|;;)$ <struct>,end(;;)? <sig>,end(;;)? <object>,end(;;)?
So that, given the following OCaml snippets:
Nested function Class definition ---------------------------------- -------------------------------- 1: let f x y = 1: class c = 2: let g z = z * x + y in 2: object 3: let h p r = 3: val mutable x 4: if x > y then 4: method moveSq y = 5: begin 5: let sq x = x * x in 6: p := g !p; 6: x <- x + (sq y) 7: r := g !r; 7: method where = x 8: g x 8: end 9: end 10: else 11: g y in 12: h (ref (g 0)) (ref (g 1));;
In the nested function, I can fold lines 3-11 and/or 1-12 without worrying about the end in line 9 short circuiting things, and similarly, with the class definition, I'd like to be able to fold lines 2-8 without worrying about the in from line 5 short circuiting things.
Right now, these are sort of saved by the whole "same indent level" constraint, but that also keeps me from easily doing things like folding 1-11 of the nested function. Since folding is naturally a pair oriented thing, using lists of stop start markers would make writing/modifying fold definitions a breeze (i.e. no more super hairy regexes).
3: I'd like to second, third, or nth the suggestion of global names for colors and text styles. I really like the way Vim does it, separating color schemes from syntax/indentation schemes.
4: I'd also like to see a decreaseIndentPattern available as well. For example, in the snippets above, the lines with end or method should be able to automatically snap back to the proper indentation when I type them in. I really think Vim has it dead on when it comes to the flexibility of syntax, indent, and color definitions -- you guys should really take a look at what they've done.
5: Damn it's hard to see the line wrap indicator... Please make it more visible.
6: Ummm... how do I print from TM? And if you do add printing, I would *love* the ability to pass the text through something like a2ps or enscript before printing it, without having to resort to writing a command to do it.
Well, my memory seems to be shot at the moment, so I'll stop the list there, but I'll keep plugging away at TM to see if I can finally unseat Vim as my everyday text editor.
And if anyone knows an easy workaround to any of the above issues, please help a poor doofus out and let me know what they are...
William D. Neumann wdnx@unm.edu
--- Dear Lord, please make me the kind of person my dog thinks I am.
On 7. Oct 2004, at 18:03, William Douglas Neumann wrote:
2: Am I wrong, or are the start/stop folding markers only available as a single pair? I would love to be able to supply a list of pairs to mark folds. [...] these are sort of saved by the whole "same indent level" constraint, but that also keeps me from easily doing things like folding 1-11 of the nested function.
You can select line 1-11 and fold the selection. But not the same as automatic fold markers, I know!
Since folding is naturally a pair oriented thing, using lists of stop start markers would make writing/modifying fold definitions a breeze (i.e. no more super hairy regexes).
The problem with the pair oriented approach is that you can have code like:
1 namespace { 2 class foo { 3 void bar { 4 // I'm about to write it... 5 }; 6 }
If we match on the {, } pair, then it may show line 3-5 as foldable and 2-6.
As of such, showing incorrect potential fold markers while editing code is not that much of a problem, but what is a problem is, if the text already had collapsed sections, and you start to add/remove fold markers (since it's pretty difficult to maintain foldings when the "tree" is manipulated).
3: I'd like to second, third, or nth the suggestion of global names for colors and text styles. I really like the way Vim does it, separating color schemes from syntax/indentation schemes.
I think I'll do something similar to style sheets for the next version of the syntax highlight system (which will be a major upgrade, no ETA yet though -- I can send a full description to this list for comments when all details are settled) -- global names alone has the problem that "string" may appear as a name in e.g. both HTML and the embedded PHP (where they should probably differ in color), and/or that in some languages, it does make sense to color strings differently than what's generally wanted.
But style sheets a la CSS with selectors would probably be pretty flexible. Initially we postponed this, because we figured it would come off as too complex. But given the proper GUI editor, it'll probably appear as a huge simplification for most ;)
4: I'd also like to see a decreaseIndentPattern available as well. [...]
Added to the to do.
5: Damn it's hard to see the line wrap indicator... Please make it more visible.
I'll do as Luc Heinrich suggested and darken the background to the right of the wrap border. Not sure though if I should then lighten it, if the background is set to a very dark color (like black).
6: Ummm... how do I print from TM? And if you do add printing, I would *love* the ability to pass the text through something like a2ps or enscript before printing it, without having to resort to writing a command to do it.
I'll keep that in mind for when printing is added (yes, it's currently missing).
Kind regards Allan
On Oct 7, 2004, at 1:55 PM, Allan Odgaard wrote:
But style sheets a la CSS with selectors would probably be pretty flexible. Initially we postponed this, because we figured it would come off as too complex. But given the proper GUI editor, it'll probably appear as a huge simplification for most ;)
INDEED. All these syntax highlighting examples (wat language are they in) are like Greek to me.
The syntax highlighting is done with regular expressions. There's an Oreilly book on the subject, or the java.util.regex.Pattern Javadoc page has a reasonably good introduction to the subject. It's at
http://java.sun.com/j2se/1.4.2/docs/api/java/util/regex/Pattern.html
Ian.
On Oct 8, 2004, at 01:05, timothy martens wrote:
On Oct 7, 2004, at 1:55 PM, Allan Odgaard wrote:
But style sheets a la CSS with selectors would probably be pretty flexible. Initially we postponed this, because we figured it would come off as too complex. But given the proper GUI editor, it'll probably appear as a huge simplification for most ;)
INDEED. All these syntax highlighting examples (wat language are they in) are like Greek to me. _______________________________________________ textmate mailing list textmate@lists.macromates.com http://lists.macromates.com/mailman/listinfo/textmate
#ifndef __COMMON_SENSE__ | Ian Phillips #include <std_disclaimer> | http://ianp.org #endif