EDIT: After working on it I’m fairly convinced the regex is correct, and the issue lies in the grammar system, the package code, or Atom.
EDIT2: Further testing: I disabled all the patterns in the grammar file except the variable.other.lua. What I’ve discovered is that the grammar is working: the syntax highlighting shows all the places which are variable.other.lua in the relevant colour, even while the scope the package sees is reported as undefined.
What’s happening is the scope being delivered to the package (via a scopeDescriptor parameter) is being sent for the character to the right of the cursor, instead of the one preceding it. Alternatively the cursor exists after the scope and before the next character.
What I don’t know is if this is what it’s supposed to be doing (and I need a match pattern which extends to the right of the cursor?), or if this is a bug somewhere.
I’m working on a package that uses a lua grammar to enable autocompletion. I’m new to how grammar files work, but I think I have the gist of it. I’m running into a problem where a match isn’t being made even though I think it should, and I don’t know enough to know if its an issue with the code I’m looking at, how grammars work, or maybe (unlikelily) a bug in atom, so I’m hoping someone with more knowledge can help me:
The match in question is this one:
Which (I think) means: not a ‘.’ then a ‘.’ OR ‘:’ -> word break -> standard variable characters.
Anyway, what I’m seeing in the console is if I type any of the following it’ll match and the scope at the cursor will be variable.other.lua (I’ll use ‘¦’ to represent the cursor):
does not match; the scope remains undefined. If another scope was matching it first I’d understand, but because its undefined I don’t get it. How does adding a bracket at the end invalidate the above regexp?
The entire grammar is here: