On 21/5/2006, at 21:50, Oliver Taylor wrote:
[...] My question is this: How can I get the 3rd capture of the first example to work when I'm working on the last line of a document?
When at the last position of the document, the scope becomes that of the character to the left of the caret (since there is nothing to the right).
What you can do is detect this case and use a slightly different pattern.
For example something like this rule:
{ name = 'meta.end-of-file'; match = '.(?!\n)$'; },
Will make the caret, when at the end of the file, give a scope of `meta.end-of-file`, although since it actually assigns the scope name to the character to the left of the caret, there a) needs to be such character (so if the last line is empty, it won’t work), and b) the second-last position in the document will also get this scope name.