JamesRitchie / language-matlab

MATLAB/Octave language support for Atom
15 stars 9 forks source link

Question about adding matlab.less for extra syntax support #9

Open KCErb opened 9 years ago

KCErb commented 9 years ago

Hi all,

I've been using the language-matlab package for some time now. Thanks for porting this!

Today I learned that I can customize my favorite syntax theme in a languages/matlab.less file. The one I just created looks like this:

.source.matlab {
  .keyword {
    &.mathematics {
      color: black;
      font-weight: bold;
    }
    &.desktop {
      color: rgb(214, 56, 56);
      font-weight: bold;
    }
  }
  .storage {
    &.control {
      color: rgb(214, 56, 56);
      font-weight: bold;
    }
  }
  .support {
    &.graphics {
      color: rgb(214, 56, 56);
      font-weight: bold;
    }
  }
}

You might see that I just copied my bold-red style from keyword.desktop.matlab over to storage.control.matlab and support.graphics.matlab.

I'm wondering how to DRY this kind of thing up. For example, in your grammars/m.cson I see a few groupings like `all_matlab_keywords'.

Does anyone know how I can select for that in a less file like the one above? I would hope I could do something like

.source.matlab {
  .all_matlab_keywords {
    color: red;
  }
}

(but I can't).

Cheers,

KC