atom-tasks
atom-tasks copied to clipboard
"About:" keyword "does something"
Hi all, I was trying to set a section title with "something(space)about(possible space):", but something weird happened. The title was moved to the right, and I don't know why. About word can be upper or lowercase, but when you put a space before and a colon after it "pops away". Is it a feature that I don't know or a bug?
I think this comes from how classes are dynamically added to the element for syntax highlighting! When you add a title, it gets its own class so that it can be customized in the stylesheet and it seems that having a space isn't accounted for in the transform. This happens here: https://github.com/irrationalistic/atom-tasks/blob/master/lib/tasks.cson#L12 This uses downcase to set everything to lowercase, so i'm trying to see if there's a way to also override spaces so that we don't get this weird behavior.
Hi @irrationalistic , the weird thing is that this occurs only when you write About (upper or lowercase) after the space. If you write something(space)somethingelse: everything works as expected
@massic80: it's mostly just a weird coincidence that there is a special style for anything with the "about" class! You can try it with test cursor: or test indent-guide: or any of the classes available in that context. Essentially, to help with custom styling for groupings or headings, the text of the heading is added to the resulting syntax as a class (which you can target in your custom stylesheet). This ends up having conflicts since a space is actually a delimiter in class names, so if you use a single word as header, it ends up something like class="syntax--source syntax--myheader, but if you put a space in the header, it'd end up like class="syntax--source syntax--my header, which is actually three classes!
So it looks like the only transforms supported are downcase and upcase in the first-mate library: https://github.com/atom/first-mate/blob/254d43b7a941a7fe63a4ad85a7766108561fec7c/src/pattern.coffee#L3
This means that fixing this particular issue could take a few different paths:
- Do nothing and just try to avoid using "about" as the second word
- Remove the custom classname functionality from headers
- Submit PR to first-mate to add more support for textmate transforms (https://macromates.com/textmate/manual/references#format-string)
I'm inclined to go with 2 on this one, but i'm not sure of the usage of custom styles that might break. I think i just added the functionality when building this, so i don't think it was a requested feature and folks may not even know about it. What are your thoughts?
Whoops, I didn't notice you asked a question :) Don't know what's best: is option 2 hard to implement?
Hi! I also found out that "console" keyword pushed the ":" to a new line