[2006-04-10: REVISION 961] ... [CHANGED] The scope of the caret is now that of the character to the right of the caret, rather than that on the left side.
I have a snippet that inserts a '_' in 'variable.other.php' scopes with the spacebar. However, now that the scope is that which is to the right of the caret, it doesn't work!
Shouldn't the current scope be set to "that text which is currently being typed?" Either way, maybe you setup a pseudo selector to specify which side of the caret to use, for example:
variable.other.php< -variable.other.php variable.other.php[left]
... for left side of caret, and ...
variable.other.php> +variable.other.php variable.other.php[right]
...for the right side?
Q
On 16/4/2006, at 7:55, Quinn Comendant wrote:
Shouldn't the current scope be set to "that text which is currently being typed?"
Well, for constructs with an open/close character, not always, e.g.:
/* comment */ <tag attr="value"> "quoted string"
But there are (dis)advantages with both. See my longer comments (and reasoning) here:
http://lists.macromates.com/pipermail/textmate/2006-April/ 009681.html
Either way, maybe you setup a pseudo selector to specify which side of the caret to use, for example:
A pseudo-selector might be a good solution. It does currently clash a bit with the canonical notion of a scope, e.g. there is a TM_SCOPE variable which gives the current scope, which will not alone be enough to decide a match then, if such pseudo selector was introduced.
But I will give it some thoughts.
Shouldn't the current scope be set to "that text which is currently being typed?"
Well, for constructs with an open/close character, not always, e.g.:
[...]
Yes, I suppose that makes sense. If you used a block caret (like the Terminal) it would overlap the chars on the right.
Any way you can think of resurrecting the scope of the char left of caret? My need is to know when I'm typing $a_php_variable and my cursor is at the end. I tried defining a scope match patter with a look-behind pattern, but couldn't get it working.
Q
On 20/4/2006, at 21:07, Quinn Comendant wrote:
Any way you can think of resurrecting the scope of the char left of caret? My need is to know when I'm typing $a_php_variable and my cursor is at the end. I tried defining a scope match patter with a look- behind pattern, but couldn't get it working.
The only way would be to add \s? to the variable matching rule. Maybe put that in a capture so it could be named something like meta.after- variable.