FIXED? Some CSS highlighter quirks

Report issues, odd behaviors or submit a detailed bug report.
User avatar
Rickard Johansson
Site Admin
Posts: 6281
Joined: 19 Jul 2006 14:29

Re: FIXED? Some CSS highlighter quirks

Post by Rickard Johansson »

I really liked this one https://github.com/microsoft/vscode-cus ... ntation.js :-D

I'll see if it can be used in some later version of RJ TextEd...

inspector71
Posts: 219
Joined: 22 Sep 2017 07:59

Re: FIXED? Some CSS highlighter quirks

Post by inspector71 »

Rickard Johansson wrote:
05 Aug 2022 13:20
I really liked this one https://github.com/microsoft/vscode-cus ... ntation.js :-D

I'll see if it can be used in some later version of RJ TextEd...
Woohoo!!! :lol:

You mean, I actually made a reasonable suggestion? :o Maybe helped? :shock:

Wow. Thought I was getting lost amongst the language server talk. Was not sure I could help.

Very good!

:-D :)

inspector71
Posts: 219
Joined: 22 Sep 2017 07:59

Re: FIXED? Some CSS highlighter quirks

Post by inspector71 »

Rickard Johansson wrote:
05 Aug 2022 13:20
I really liked this one https://github.com/microsoft/vscode-cus ... ntation.js :-D

I'll see if it can be used in some later version of RJ TextEd...
Although that does not include pseudo elements like `::before` and `::after` whereas this does:

https://github.com/microsoft/vscode-cus ... schema.xml

Code: Select all

<pseudoElements>
		<entry name="::after" version="3.0" browsers="E,C,FF1.5,IE9,O9,S4" ref="http://www.w3.org/TR/css-pseudo-4/#selectordef-after" syntax="div::after { content: 'abc'; }">
			<desc>Represents a styleable child pseudo-element immediately after the originating element’s actual content.</desc>
		</entry>
		<entry name="::backdrop" version="3.0" browsers="E" ref="https://fullscreen.spec.whatwg.org/#::backdrop-pseudo-element" syntax="*|*:fullscreen::backdrop { position: fixed; }">
			<desc>Used to create a backdrop that hides the underlying document for an element in a top layer (such as an element that is displayed fullscreen).</desc>
		</entry>
		<entry name="::before" version="3.0" browsers="E,C,FF1.5,IE9,O9,S4" ref="http://www.w3.org/TR/css-pseudo-4/#selectordef-before" syntax="div::before { content: 'abc'; }">
			<desc>Represents a styleable child pseudo-element immediately before the originating element’s actual content.</desc>
		</entry>
...
</pseudoElements>		

User avatar
Rickard Johansson
Site Admin
Posts: 6281
Joined: 19 Jul 2006 14:29

Re: FIXED? Some CSS highlighter quirks

Post by Rickard Johansson »

Yes, you're right. It even contain property values and descriptions for each one.

User avatar
pjj
Posts: 1998
Joined: 13 Oct 2009 13:48
Location: Kraków, Poland

Re: FIXED? Some CSS highlighter quirks

Post by pjj »

In the same repository @inspector71 has pointed to there are also other goodies: HTML tags and ARIA attributes. It would be really cool to use them and also to be able to update them the same way e.g. RJ TE lang files/highlighters are updated (i.e. imported from Github and converted to RJ TE format).
Alium tibi quaere fratrem; hic, quem tuum putas, meus est. Titus Flāvius Caesar Vespasiānus Augustus

User avatar
pjj
Posts: 1998
Joined: 13 Oct 2009 13:48
Location: Kraków, Poland

Re: FIXED? Some CSS highlighter quirks

Post by pjj »

OK, I think I have finally wrapped my head around it. So there can be three stages of highlighting code in a document:
1) regex-based; it is always necessary if you don't have your LS running or said LS doesn't have syntax highlighting built-in; most popular language grammar is TextMate's
2) LSP based, which can be used if your LS is running and has syntax highlighting built-in
3) semantic highlighting, which can be used if you have semantic tokens provider (right now available for JavaScript and TypeScript only), e.g. https://www.npmjs.com/package/@anche/se ... -utilities

I'm not quite sure how Tree-sitter fits in here; I guess it can provide syntactic tokens for code highlighting (point no. 2 in the list above).

Anyway, could you please research a bit TextMate language grammar and decide if they can be consumed by RJ TE? This way you wouldn't need to fine tune regexes (as it was with the CSS one in this thread) and could use ready solution for 40+ langauges?
Rickard Johansson wrote:
05 Aug 2022 12:21
I'll take a look at the listed language servers, but I'm not sure I want to test them all and publish instructions on how to install and add them to the editor, for every single one in the LSP section :? But, maybe someone would like to help with that? :wink:
Yes, I would like to help :)
Alium tibi quaere fratrem; hic, quem tuum putas, meus est. Titus Flāvius Caesar Vespasiānus Augustus

Post Reply