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

Discuss: Rename className to scope #3085

Closed
joshgoebel opened this issue Mar 27, 2021 · 4 comments · Fixed by #3135
Closed

Discuss: Rename className to scope #3085

joshgoebel opened this issue Mar 27, 2021 · 4 comments · Fixed by #3135
Labels
discuss/propose Proposal for a new feature/direction enhancement An enhancement or new feature language parser
Milestone

Comments

@joshgoebel
Copy link
Member

joshgoebel commented Mar 27, 2021

Is your request related to a specific problem you're having?

Yes, once we add nested scope then technically className is no longer accurate, plus it's length has always bothered me.

The solution you'd prefer / feature you'd like to see added...

I propose we rename it scope...

Before:

      {
        className: 'title.class',
        match: '^\\w+(?=:)'
      },

After:

      {
        scope: 'title.class',
        match: '^\\w+(?=:)'
      },

Of course we'd continue to support className (deprecated)... this would be an alias essentially.

Any alternative solutions you considered...

Nope. TextMate grammars calls this captures/name in the grammar and "scopes" is the concept I believe.

 {  match = '(@selector\()(.*?)(\))';
    captures = {
       1 = { name = 'storage.type.objc'; };
       3 = { name = 'storage.type.objc'; };
    };
 };

Additional context...

None.

@joshgoebel joshgoebel added enhancement An enhancement or new feature language parser discuss/propose Proposal for a new feature/direction labels Mar 27, 2021
@joshgoebel joshgoebel changed the title Discuss: Change className to scope Discuss: Rename className to scope Mar 27, 2021
@joshgoebel
Copy link
Member Author

CC @highlightjs/core

@allejo
Copy link
Member

allejo commented Apr 3, 2021

No objections here, makes sense to me

@joshgoebel joshgoebel added this to the 11.0 milestone Apr 13, 2021
@NullVoxPopuli
Copy link
Contributor

Would this still support multiple classes? I've been adding multiple classes for debugging. Otherwise I'm 👍

@joshgoebel
Copy link
Member Author

Same behavior, just a name change since technically "function.title.call" is NOT a class name. And I've never loved the verbosity of className...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discuss/propose Proposal for a new feature/direction enhancement An enhancement or new feature language parser
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants