textmate / css.tmbundle

TextMate support for CSS
54 stars 36 forks source link

Advice on extending CSS syntax #14

Closed paulyoung closed 10 years ago

paulyoung commented 10 years ago

Apologies if this is not the right place for this question.

I'm working on a bundle for a language which is a superset of CSS and it seemed logical to not repeat any of the work already done in the CSS bundle.

However, I'm finding that it's harder than I assumed to leverage the existing rules.

For example, I'd like to add some new rules to apply syntax highlighting to expressions like the following:

#avatar[width] == #avatar[height];
#avatar[border-radius] == #avatar[width] / 2;

How would I implement this without needing to redefine all of the CSS selectors? Is there a better way than just defining rules for the new operators on their own?

My attempts to use a begin/end rule have been unsuccessful and using captures doesn't seem well suited.

A second example is that I'd like rules for some new pseudo selectors:

#logo[center] == ::window[center];

This has proven surprisingly difficult for some reason, with my new rule apparently conflicting with some existing ones, especially within a new @-rule:

@stay button[width], ::window[width];

I tried creating a begin/end rule for this and tried to include my new rule and source.css inside patterns but again could only get one of them to work by removing the other.

There are many more features but I feel that these simple examples epitomize the main issues I'm having.

I have some experience with the .tmLanguage format and have tried several approaches now, but I'm hoping that some insight regarding the examples above will help me to understand something fundamental that I'm missing.

More specifically, I'd love to know how to work best with this existing bundle.

I should note that I'm also targeting some other editors where I believe that some newer features of the syntax definitions are unavailable.

Thanks.

infininight commented 10 years ago

I saw that you were asking the same on IRC so I had been watching for you there as this would be a much easier conversation to have in 'person' but kept missing you. Ping me on there, same nickname.

paulyoung commented 10 years ago

Thanks @infininight. I'll follow up with you on IRC in the near future.

paulyoung commented 9 years ago

@infininight haven't been able to catch you on IRC lately. Would love to chat about this.