Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add scopes for a number of items. #267

merged 1 commit into from Aug 2, 2019


Copy link

commented Jul 27, 2019

Description of the Change

There are a number of scopes missing from the tree-sitter grammar that are present in its TM-style sibling. Many of these aren't used by one-dark-syntax or other common syntax themes, which is probably why they've been overlooked. Here's what I've added:

  1. All strings, regardless of type, were scoped simply as string. I fleshed out these scope names to match the TM-style grammar: string.quoted.single, string.quoted.double.interpolated, et cetera.
  2. Global variables had no scope name. Now they're scoped as
  3. Operators weren't scoped at all. Now they're all given keyword.operator scope names equivalent to what they get in the TM-style grammar.
  4. Ordinary method parameters were scoped as variable.parameter, but method parameters with default values got no scope. Fixed this oversight.
  5. A number of punctuation scopes were added, including single- and double-quotes around strings, as well as the . and &. operators.

The atom-light-syntax theme is the first builtin theme I found that actually shows these differences. The existing grammar is on the left, and the updated grammar is on the right:


Alternate Designs

One thing worth mentioning: the distinguishing quotation marks via :nth-child selectors seems brittle. I'd love it if an :nth-last-child selector were available, but I've seen the code that implements :nth-child and I'm not sure I understand it well enough to try yet.


Better syntax highlighting and richer contextual information for commands.

Possible Drawbacks

Hard to think of any. If this were a bold new direction for scope naming, perhaps there'd be some, but this is just about parity with the old grammar. The changes aren't even visible in most of the common syntax themes; the ones that are visible are obviously improved in consistency.

Applicable Issues

Can't find any among the open issues.

Add scopes for a number of items.
(Operators, punctuation, global variables, and method parameters. Also
further distinguishes the scope names of strings so that they can be
treated differently from one another. Used the TM-style grammar as

@jasonrudolph jasonrudolph self-assigned this Aug 1, 2019


This comment has been minimized.

Copy link

commented Aug 2, 2019

Thanks for this, @savetheclocktower! 💟

@jasonrudolph jasonrudolph merged commit aaaa7ac into atom:master Aug 2, 2019

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
continuous-integration/travis-ci/pr The Travis CI build passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
2 participants
You can’t perform that action at this time.