Page 3 of 3

Re: FIXED? Some CSS highlighter quirks

Posted: 05 Aug 2022 13:20
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...

Re: FIXED? Some CSS highlighter quirks

Posted: 05 Aug 2022 14:10
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 :)

Re: FIXED? Some CSS highlighter quirks

Posted: 05 Aug 2022 14:24
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>		

Re: FIXED? Some CSS highlighter quirks

Posted: 05 Aug 2022 14:35
by Rickard Johansson
Yes, you're right. It even contain property values and descriptions for each one.

Re: FIXED? Some CSS highlighter quirks

Posted: 05 Aug 2022 15:06
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).

Re: FIXED? Some CSS highlighter quirks

Posted: 05 Aug 2022 16:29
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 :)