Custom grammar - how to make a line ending in backslash not increment the next line's number in the editor


#1

Hi, I’ve created a package which performs syntax highlighting for a little language with no issues.

The language has a line continuation character - (line ending in backslash). creating a regexp for that and giving it a name is simple enough, but what do I need to do to make atom not display a different line number on the next line?

The reason I’m asking is that my associated linter will report any errors as the first line of the set of wrapped lines, and the users of my DSL aren’t very technical.


#2

I don’t believe that it’s possible without some deep edits inside Atom’s code. I’m not an expert on that, but none of the language-related features I’ve seen include skipping a line number based on the contents of the previous line. It might be easier to make your linter expand the error to the entire set of wrapped lines. How deep does this wrapping go?


#3

…the (?)tokenizer is probably going to be an issue.
The one Atom uses evaluates on per line.

I cannot see a way to make a virtual file that combines all the broken lines only for the processing.
Or perhaps in some way use:
https://atom.io/docs/api/v1.20.0/Grammar#instance-tokenizeLine


#4

Typically, only one line. I guess this won’t be an issue. There are some parts of the language which can have quite a few, but those are in separate files, written by more technical folks.

Just curious is there is an easy way. Thanks for your reply


#5

thanks for your reply. perhaps your suggestion would work, but it’s a bit beyond my current understanding of the atom api - at this point I simply know how to create regexp and name them so that different keywords get different colors.