Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Multiline YARD highlighting for tag–comment styles #228

Closed
cbothner opened this issue Jan 23, 2018 · 1 comment · Fixed by #234
Closed

Multiline YARD highlighting for tag–comment styles #228

cbothner opened this issue Jan 23, 2018 · 1 comment · Fixed by #234

Comments

@cbothner
Copy link
Contributor

Description

YARD supports multiline comments for tags as long as the following lines are indented but atom-language-ruby does not extend syntax highlighting beyond the line. Namely, I expect the text on the second line to be green.

screen shot 2018-01-23 at 10 23 45

I am interested in implementing this but am looking for some guidance.

I tried naively to extend the yard_name_types pattern to match multiple lines, like this. But as y’all more experienced syntax highlighters already know, you can’t use multiline patterns.

I think the begin and end keys are promising, but while I can figure that maybe the begin pattern would be something like # @(attr|etc.), there’s no natural end key. How do you match “the lack of a comment line with two more spaces of indentation than this one” precisely enough?

Any ideas? Am I totally off base here? Is there a better dev workflow for language grammars than painstakingly restarting Atom after every change?

@50Wliu
Copy link
Contributor

50Wliu commented Jan 26, 2018

How do you match “the lack of a comment line with two more spaces of indentation than this one”

Oh boy, do I have experience with this. I believe you essentially want something like ^(?!\\s*#\\1\\s{2,}) as your end pattern where \\1 refers to the capture group in ^\\s*#(\\s*) which you'll stick at the beginning of your begin pattern.

Is there a better dev workflow for language grammars than painstakingly restarting Atom after every change?

I've found that restarting Atom using the window:reload command is fairly quick.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants