gandm / language-babel

ES2017, flow, React JSX and GraphQL grammar and transpilation for ATOM
https://atom.io/packages/language-babel
MIT License
476 stars 83 forks source link

Targeting property of a `type` in Flow? #382

Closed saadq closed 7 years ago

saadq commented 7 years ago

Firstly, thanks for this great package.

I'm trying to change the syntax highlighting from the keys that have a type of function here:

screen shot 2017-06-15 at 5 36 20 pm

EDIT: Here is the code in case you want to copy/paste it to try it out:

type Props = {
  isOn: boolean,
  startTime?: number,
  stopTime?: number,
  startTimer: Function,
  stopTimer: Function,
  resetTimer: Function
}

I can do that by doing something like:

.syntax--type.syntax--function.syntax--storage {
  color: white;
}

which yields:

screen shot 2017-06-15 at 5 37 28 pm

This is the result I'm looking for, however this also messes up the syntax highlighting for normal usage of the function keyword:

screen shot 2017-06-15 at 5 37 37 pm

It doesn't look like there is any flowtype specific selector on the type example I posted above. Is this expected behavior?

gandm commented 7 years ago

No it doesn't. Maybe I should use a meta flowtype for object flowtype defs. Would that do the trick?

saadq commented 7 years ago

Thanks for the quick reply. I believe that should work.

gandm commented 7 years ago

OK leave it with me.

gandm commented 7 years ago

@saadq Can you try the latest master version in this git repo? If it does the trick I will publish.

saadq commented 7 years ago
screen shot 2017-06-16 at 5 04 38 am

Everything looking good! Thanks very much.

gandm commented 7 years ago

published