[TxMt] Java language grammar problems
Daniel Harple
dharple at generalconsumption.org
Wed Mar 29 16:17:53 UTC 2006
On Mar 29, 2006, at 9:02 AM, Steve Lianoglou wrote:
> When the cursor is immediately outside of a block comment, the
> scope still shows "comment.documentation.java" or
> "comment.block.java" when I don't think it should be (imagine the ^
> character to be the cursor):
>
> Example:
> /* some comment here */^
I had this issue too -- here is Allan's reply (it was off-list):
On Mar 29, 2006, at 1:02 PM, Allan Odgaard wrote:
>> The attached pictures show an issue with scope. The cursor is
>> outside the comment, but scope is still reported as
>> comment.block.c. When the cursor is moved one more space then the
>> scope reported is correct.
>
> The scope of the caret is that of the character to the left of the
> caret.
>
> This is a trade-off, but it makes sense most of the time. The
> alternative would be to use the scope of the character to the right
> of the caret, but this has disadvantageous as well.
>
>> This is an issue for me because I use a macro to insert a newline
>> and '*' bound to the return key. When I move outside the comment
>> and press return that macro is run because TM thinks it is inside
>> the comment.block scope.
>
> The only solution is to modify the language grammar to markup
> things differently. For example you could assign a name to the last
> slash (see about language grammars / captures ) and then give a
> scope selector like: comment.block - meta.end-of-comment.
Regards,
-- Daniel
More information about the textmate
mailing list