[SOLVED] Syntax style gets overwritten by Atom?


#1

I’m trying to get correct syntax highlighting for Rust, specifically the lifetimes, but haven’t been able accomplish that so far.

I’ve discussed this with the maintainer of the language-rust package, but I’m not sure if he has the time or knowledge on how to address this.

If you could look at my last reply in that issue, you can see where I’m stuck. For some reason the custom style gets overwritten by some cyan default color. This happens regardless of the syntax theme I use.


#2

p.s If you want to replicate this for yourself, you can download aforementioned language package and simply type 'sometext, which is the syntax for lifetime annotations in Rust. I would have edited my original post, but that feature seems to be disabled.


#3

Here’s a good tutorial on CSS specificity. You can either make your override more specific, or just use the !important tag.


#4

Thanks for the response, but I’m not asking how to use CSS, I’m asking why this particular selector gets overwritten when the rest of them (like parents .syntax--storage and .syntax-modifier) don’t. Using !important doesn’t make a difference (gets overwritten all the same), and shouldn’t be necessary for styling.


#5

Hi Adrian, I am not able to help… but I have a suggestion to make.

How about you give the Community…

  1. a piece of sample code
  2. show in a picture what the code colouring looks like
  3. indicate in the picture what should change

Maybe someone can have a look even if he is not familiar with RUST:

  1. Confirm what you are seeing
  2. Investigate Atom working to suggest a solution.

I hope to see your issue resolved.
dP


#6

Hello Dan,

Not to sound impolite, but I think the Github link I posted explains it fairly well, along with pictures. Anyone could test this by installing the rust language package and typing e.g. 'something. For me such a element turns cyan colored, regardless of the color scheme used.

I tried a “fresh” Atom (renaming my ~/.atom folder) to no avail.

Here another screenshot of the style being overridden. color: yellow !important; is the test style I inserted:

The statement by the rust-language maintainer:

However, I don’t know of any syntax theme that does so, so in most cases it will fall back to the more generic storage modifier or entity name color of the syntax scheme.

…seems to be false, as these styles are well defined in most themes (not cyan) and do not receive the styling override (seen in lines 1 & 2 of my screenshot) to begin with.

I didn’t want to file an Atom Github issue before getting more feedback, since they seem flooded with requests.


#7

It gets overridden because of how specificity works in CSS.

Using !important doesn’t make a difference (gets overwritten all the same), and shouldn’t be necessary for styling.

I agree that !important shouldn’t be necessary, but that applies to web sites where you control all the styling rules. For Atom, where you don’t control the packages applying the CSS, you may have to either use it or make extremely specific rules. If !important doesn’t work, I will need to see your styles.less.


#8

It gets overridden because of how specificity works in CSS.

Right, but that’s only an issue in the first place, because there’s a rule that overrides it. The other elements don’t have this narrow selector applied to them, and I can’t figure out where it originates. Anyway, I think I’ll file an issue report after all and see if the developers have any idea what this is about. A (dis)confirmation from others would have been helpful.


#9

I took a look at language-rust and found that it has its own set of style rules. That would be what’s changing the color.


#10

Yes, that’s the cause! And the 70% mix with cyan ends up still looking very much cyan with any theme, to the degree that I thought I’m looking at an unchanging color. Mystery solved, thanks!