-
Notifications
You must be signed in to change notification settings - Fork 142
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
Support advanced scope selectors #36
Comments
I agree it's a useful and neat feature, but I must admit I don't predict I'll find time or motivation to do it myself. Other functionality like #34 seems more important in that it enables new use cases and prevents basic usage from failing horribly (see #33). This functionality just allows marginally nicer themes. If someone else (like you) wants to take up the task though I'm happy to provide advice, code review, guidance and information. |
For the record, it appears that #39 added support for pipes (same as commas) and multiple exclusions. What remains are parentheses for sub-matches and ampersands for AND-connections, as far as I can see. Maybe add a checklist to the OP? |
Correct - I've now updated the OP with the checklist, as suggested. |
Note that the Monokai color scheme that Sublime Text (build 3156) ships with includes the following scope selector: {
"name": "markup punctuation",
"scope": "text & (punctuation.definition.italic | punctuation.definition.bold | punctuation.definition.raw | punctuation.definition.link | punctuation.definition.metadata | punctuation.definition.image | punctuation.separator.table-cell | punctuation.section.table-header | punctuation.definition.constant)",
"foreground": "color(var(white) alpha(0.67))"
}, so if people were to try to use that color scheme in |
Any plans for this one? Just tested the examples provided here with syntect and it seems not all operators are supported by syntect:
Btw, If I'm not mistaken it seems both scopes & selectors are just simple rules coming from a simple grammar such as:
Summing up, right now the grammar covered by syntect seems to be a very simple subset from the most general one. |
out of curiosity, where did you conjure up that grammar from? it contains some tokens which don't exist in Sublime Text or TextMate... |
Check out prymatex project from diegomvh on github, really amazing textmate python clone project full of features, although it needs some serious refactoring in many places and its difficult to run on windows. Related... I've tested prymatex parser in comparison to syntect's and the former is much slower. Summing up, syntect is quite fast but incomplete and prymatex is complete but slow... Also, related to this subject, there is also edbee-lib alternative, really good app but also needs some serious refactoring. I assumed that grammar would be the original textmate one... Is not? |
Currently, syntect doesn't support grouping parens or
&
operators in scope selectors, which means it doesn't color scopes correctly when the.tmTheme
file being used contains these more advanced constructs.See the update under "One last twist" at http://blog.macromates.com/2005/introduction-to-scopes/ for a brief example
I've never really found any good documentation on scope selectors, so I tried to write a bit more about them on SO, which I'll link to here in case it's useful: http://stackoverflow.com/a/37407588/4473405
EDIT: I also found http://textmate.1073791.n5.nabble.com/formal-definition-of-scope-selector-syntax-td12109.html just now, which seems to indicate that
|
and,
don't have equal precedence.As a simple example, if we imagine the following Python code:
then the selector
(storage | entity.name) & meta.function
should matchdef
andtest
.Please would you consider adding support for this to your awesome syntect library.
The text was updated successfully, but these errors were encountered: