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

[JavaScript] Highlight Class in imports #3676

Closed
53v3n3d4 opened this issue Mar 10, 2023 · 4 comments
Closed

[JavaScript] Highlight Class in imports #3676

53v3n3d4 opened this issue Mar 10, 2023 · 4 comments

Comments

@53v3n3d4
Copy link

53v3n3d4 commented Mar 10, 2023

What happened?

Hi,

I was trying to highlight imported Class but I could not achieved.

With this scope meta.import variable.other.readwrite, it is possible to highlight all imported methods and classes. But not possible to select only Classes.

I added two matches to achieve highlighting only class

Screenshot 2023-03-10 at 7 02 07 PM

  # JavaScript.sublime-syntax
  # line 319
  import-item:
  ...
    - match: '{{constant_identifier}}'
      scope: variable.other.constant.js
      pop: 1
  ...

  # line 331
   import-brace:
  ...
    - match: '{{constant_identifier}}'
      scope: variable.other.constant.js
      push: import-export-alias

Would a pull be welcome? In github we have class highlighting.

@53v3n3d4 53v3n3d4 changed the title [JavaScript] Suggestion to highli [JavaScript] Suggestion to highlight Mar 10, 2023
@53v3n3d4 53v3n3d4 changed the title [JavaScript] Suggestion to highlight [JavaScript] Suggestion to highlight Class Mar 10, 2023
@FichteFoll
Copy link
Collaborator

Related: #1842

@michaelblyons michaelblyons changed the title [JavaScript] Suggestion to highlight Class [JavaScript] Highlight Class in imports Mar 20, 2023
@53v3n3d4
Copy link
Author

Hi FichteFoll,

Thanks for your reply. I read the RFC from 2019 and few links mentioned.I will post a user opinion there.

I read Thom1729 post regarding entity.name.import and your post where you mention variable.other use cases. I read that RFC is not implemented, although I recognize some of scopes names that you guys are talking there.

From what I read, here I am only suggesting another scope with variable.other.readwrite.js that already exist in file.

My question is, sorry if I do not understood after reading the RFC, it is not acceptable small changes?

And do you know if it is possible to have this part only in a file extending the st js syntax?

I tried to extend with only the modifications but could not make it work. I had to duplicate the whole JavaScript.sublime-syntax and TypeScript.sublime-syntax.

Should I close this?

@FichteFoll
Copy link
Collaborator

My comment was primarily meant as a reference for further reading and to show that we're still undecided about what the exact name of such a scope should be. but that there has been some discussion about this. Specifically, variable.other.constant is not appopriate since classes are not constants like e.g. values of an enum.

The closest comparison for a related syntax currently highlighting class names in import statements would be the Java syntax, which has more or less recently been updated to do that, so I recommend using that for inspiration.

@53v3n3d4
Copy link
Author

Yes I notice after post about related. I used variable.other.constant because it is already implemented so I did not make more changes.

// variable.other.constant used in st js syntax
const Bar = new ToBar()

I wil close this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants