syncat icon indicating copy to clipboard operation
syncat copied to clipboard

Attempt to generate some stylesheets from nvim treesitter files

Open foxfriends opened this issue 2 years ago • 10 comments

The problem with just adding a language to the language.toml is that there will still be no highlighting until someone makes a stylesheet

I see. Is it possible to generate sytlesheet from https://github.com/nvim-treesitter/nvim-treesitter/tree/master/queries?

Originally posted by @Freed-Wu in https://github.com/foxfriends/syncat/issues/12#issuecomment-1783170520

foxfriends avatar Oct 27 '23 16:10 foxfriends

any progress on this?

brainlessbitch avatar Apr 18 '24 05:04 brainlessbitch

I have no plan to do this currently. You're welcome to try :)

foxfriends avatar Apr 18 '24 13:04 foxfriends

i would, but i know zero rust lol

brainlessbitch avatar Apr 18 '24 18:04 brainlessbitch

Generating these stylesheets could probably be done in any language, as a separate script rather than part of syncat program itself... but still requires learning how nvim does its queries and also how syncat does its queries and then translating the two... haha quite a bit of work

foxfriends avatar Apr 18 '24 19:04 foxfriends

hmmmm, well, i can start working on it, have you written like a full spec for the syncat style stuff, i'm working on translating the ecma/javascript query, but i'm stuck because some rules seem to be overriding others

brainlessbitch avatar Apr 18 '24 19:04 brainlessbitch

https://github.com/foxfriends/syncat-themes?tab=readme-ov-file#creating-themes

I believe the most comprehensive documentation for syncat themes is in there^

foxfriends avatar Apr 18 '24 19:04 foxfriends

Spend a couple hours on this. This is a hard problem.

  1. As mentioned before - nvim queries are laid out like this: less specific > more specific. Syncat styles work the opposite way. More specific highlights should go first
  2. Secondly, parsing the queries is very non-trivial. My approaches with simple regexes didn't work. Looks like it needs a dedicated parser.

Was there a good reason to have a bespoke solution?

mister-choo avatar Dec 03 '24 17:12 mister-choo

Was there a good reason to have a bespoke solution?

not particularly, syncat was just something to build for fun. more fun to build something than to read docs on someone else's project

foxfriends avatar Dec 03 '24 17:12 foxfriends

Was there a good reason to have a bespoke solution?

not particularly, syncat was just something to build for fun. more fun to build something than to read docs on someone else's project

Fair enough. A very good idea though. Shame it's not more actively developed

mister-choo avatar Dec 03 '24 17:12 mister-choo