microsoft / vscode-textmate

A library that helps tokenize text using Text Mate grammars.
MIT License
561 stars 108 forks source link

TextMate scope selectors: child combinator is not implemented #123

Open graceful-potato opened 4 years ago

graceful-potato commented 4 years ago

Selectors such as "scope1 > scope2" aren't working.

Expected behavior: it should select all scope2 elements that are the direct children of scope1

jeff-hykin commented 4 years ago

It isn't mentioned explicitly, but I imagine it was intentionally left out in the same way the negation operator was. Which is a shame since both of them can be really useful.

There is a third kind of selector, one that involves excluding scopes, which we'll not discuss here. We didn't add support for this kind and we've noticed it is rarely used in the wild.

from https://code.visualstudio.com/blogs/2017/02/08/syntax-highlighting-optimizations#_parent-selectors

alexdima commented 4 years ago

@jeff-hykin AFAIK > did not exist when we first wrote vscode-textmate. I cannot find any mention of it at https://macromates.com/manual/en/scope_selectors

However, with TextMate 2.0, it appears that they appear in the scope selector grammar at https://macromates.com/textmate/manual/references#scope-selector

graceful-potato commented 4 years ago

@alexdima To be honest i found out about this selector quite recently, but the changelog says it was introduced in 2012.

DerekZiemba commented 4 years ago

I'd sure make use of it if it was documented and supported. Besides the changelog, there's really no documentation about it.

ghost commented 2 years ago

Atom's first-mate helpers don't support it. Seeing as this module is more closely linked to Atom than Textmate, it will most likely remain on the backburner. There is an upstream issue at atom/first-mate#123 (opened by yours truly 😄)

aleclarson commented 3 weeks ago

I've implemented this feature in #233