-
Notifications
You must be signed in to change notification settings - Fork 586
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
[Common] Adjust wildcard scopes #3803
Conversation
This commit puts `.` and `..` into same scope category as `*` or `?` wildcards by scoping | token | scope + --- + --- | `.` | `variable.language.self` | `..` | `variable.language.parent` Those scopes are also used by keywords such as `self`, `this`, `super` in other contexts, where they denote path like access. Note: - `variable.language` is chosen as most syntaxes have been using `variable.language.wildcard` for quite a while, so it's probably not a good idea changing it. Same applies to path scopes changed by this commit, but those are not so many. The big picture: ``` variable language anonymous - empty throwaway variables (e.g. `_`) self - `self`, `this`, `.`, ... parent - `super`, `..`, `&` in CSS, ... wildcard - `*`, `?`, ... ```
I am okay with this. I support having consistency. I'm very slightly disappointed that we lose the distinguishing between |
Do I understand correctly, the distinguished scopes' purpose is to express the different behavior/meaning of So that distinction is a very special case related with ST's way to handle file patterns? Wouldit be ok to distinguish them via another sub-scope such as |
ST treats `*` depending on whether being used in a path with `/` or in simple file patterns. This commit re-introduces distinct scopes based on that, to enable them being highlighted differently. Note: The old and resurrected behavior does not yet apply expected scope to patterns like `fo*der/`. A fix is however out of scope for this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yet another example why I'm a little sad that we always squash PRs when merging because reviewing this by commit was most likely the much better experience, being able to correlate test changes to syntax changes et al.
Yes, that was the aim. Thanks. |
The good: The bad:
To me this very much reads like it was meant to distinguish special identifier names from other user-defined identifiers, which are Instead, I would go with the alternative of
Yeah, you could argue that the placeholder symbols feel more like The ugly: |
I second concerns about
I have no strong oppinion about Any other oppinions about it?
It might not be optimal to re-use those scopes, but I just didn't want to introduce a In general it's a question of perspective, which is the more general or specific part of a scope and there's probably no ultimatively correct answer. Therefore let's take Version A:Perspective/Goal: All slash tokens should be grouped under a scope. Result: The 1st scope Version B:Perspective/Goal: All path-like separators what kind they ever might have should be grouped. Result: The 2nd scope Conclusion:Just needs an aggreement about the perspective(s) to use. The more general problem is probably Both have pros and cons, while semantic highlighting tends to result in more complex syntax definitions and even not being able to be aplied everywhere. It's just not possible with some synaxes/languages. |
Same for me. |
I am embarrassed to admit that my original scheme with some If the scope settles on But the scope choice should be independent of color choice. |
I don't really think the But here for Or in other words, if you consider the set of tokens { Regarding |
I definitely understand this point and was coming into this PR more with the question whether relative path indicators should be specially highlighted at all since those (virtual) paths actually exist for almost every tooling that interacts with the filesystem because it's implemented at such a low level that you can't really claim that it is a feature of Bash (or any other shell). I mean, we don't highlight these for strings in Python either. Because the PR was only trying to apply the results of the RFC discussion onto the default syntaxes and I didn't take part in the RFC discussion, I didn't want to bring it up, but since it appears to be a relevant point of this discussion now, I'm raising it now. (I also really hate the "other" part in scope names, which was a really bad idea back in the days and artificially increases the length of scope names with no benefit. But that's just off-topic.) |
Let's see how long it takes for users to complain about color changes in Mariana. 😄 |
Has been discussed in an RFC and default packages PR. See-also: sublimehq/Packages#3803 (comment) See-also: sublimehq/Packages#3766
This PR implements RFC #3766 by ...
variable.language.wildcard
.
tovariable.langauge.self
..
tovariable.langauge.parent
The current scopes are chosen ...
to fullfill requirements outlined in [RFC] Path wildcard scope #3766 (comment)
because
variable.language.wildcard
has been used by majority of syntaxes for quite a whileas they fit into a common naming scheme
Those scopes may be used by path like tokens such as path strings or qualified identifiers as
meta.path
is.Note: It partly reverts #3768 and #3769.
Alternative
An alternative would be to move them all under the
constant.other.placeholder
scope ifvariable
feels too odd within string constants, but this may require scope modifications to placeholders of format strings to make them distinguishalbe. The idea would be toDisadvantages:
EDIT 2023/07/10
This PR finally follows proposed scope naming of #3803 (comment)