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

[D] Make in a word operator #3964

Closed
wants to merge 2 commits into from
Closed

Conversation

ichordev
Copy link
Contributor

Changes:

  • Marked in as a word operator so that it can be highlighted as-such.

jfcherng
jfcherng previously approved these changes Apr 25, 2024
keith-hall
keith-hall previously approved these changes Apr 25, 2024
@jwortmann
Copy link
Contributor

I wonder, would this stacking of keyword.operator.word keyword.operator.comparison (or other keyword.operator.* subscopes) serve as an accepted solution to #3694 in general?

I remember previous discussions leading to no solutions, and iirc keyword.operator.word was deemed to be an outdated scope which shouldn't be used anymore, because word doesn't carry any semantic meaning. So previous similar PRs were refused, e.g. #2089, #2090.

Also see #3694 (comment)

  • stacking same kind of scopes (e.g. keyword) turned out to have unwanted implications in the past

@jfcherng
Copy link
Collaborator

I wonder, would this stacking of keyword.operator.word keyword.operator.comparison (or other keyword.operator.* subscopes) serve as an accepted solution to #3694 in general?

Agree shouldn't be stacked after I searched the current code base.
https://github.com/search?q=repo%3Asublimehq%2FPackages%20keyword.operator.word%20&type=code
None of them is stacked.

@ichordev
Copy link
Contributor Author

I wonder, would this stacking of keyword.operator.word keyword.operator.comparison (or other keyword.operator.* subscopes) serve as an accepted solution to #3694 in general?

Agree shouldn't be stacked after I searched the current code base. https://github.com/search?q=repo%3Asublimehq%2FPackages%20keyword.operator.word%20&type=code None of them is stacked.

I'll change it to just use keyword.operator.word then?

@jfcherng
Copy link
Collaborator

I'll change it to just use keyword.operator.word then?

That will make this PR to more likely be merged.

@ichordev ichordev dismissed stale reviews from keith-hall and jfcherng via 4d13331 April 25, 2024 11:21
@deathaxe
Copy link
Collaborator

Primarily expected issues with regards to possible over-use of stacked scopes is the limit of at most 64 stacked scopes per token. Each additional scope may increase risk to break syntax highlighting in deeply nested statements. Now that syntax based folding really requires each block to provide its own meta scope to make sure each bracket is scoped uniquely, chances may even grow further - theoretically. (D doesn't follow this guideline at all, though)

Using only keyword.operaotr.word in a syntax with mixed operator styles but scoping all operators keyword.operator.[logical|...] in a syntax which only uses word-like operators (e.g. Python), introduces the requirement for syntax-specific color scheme rules to ensure same highlighting. On the other hand we probably don't want to scope all keywords in e.g. python keyword.operator.word as we'd loose semantic meaning.

If at all - the initial (stacked) solution would probably be the only accepteble one without breaking backward compatibility and by ignoring chapter one's outlined issue. But someone should then apply that pattern to ALL syntaxes in this repo!

I however have a feeling this would require to also scope symbolic operators accordingly for consistency reasons, because it is odd to use 2 scopes for word-like operators but only 1 for symbolic ones.

Tbh, I wouldn't merge it until a conclusion for #3694 is found.

@ichordev ichordev closed this May 2, 2024
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

Successfully merging this pull request may close these issues.

5 participants