norden.social is one of the many independent Mastodon servers you can use to participate in the fediverse.
Moin! Dies ist die Mastodon-Instanz für Nordlichter, Schnacker und alles dazwischen. Folge dem Leuchtturm.

Administered by:

Server stats:

3.4K
active users

#treesitter

0 posts0 participants0 posts today

I’ve looked briefly at #Treesitter queries a few times, and bailed out each time because at a glance it looks more complicated than I was motivated to push through.

Turns out they’re not very complicated. A little weird… until you realize they’re structured similarly to LISP things.

Once I grokked that, it didn’t take long to undersand the syntax. tree-sitter.github.io/tree-sit

Now I’ll see whether I want to do something with them beyond what comes stock in #neovim and the nvim-treesitter plugin.

tree-sitter.github.ioQueries - Tree-sitter

#helix vs #neovim. spot the differences!

the main one isn't really visible, though: helix has a built-in #treesitter, and it does a great job at highlighting #rust out of the box, with zero configuration and dependencies!

this way, i don't have 20 plugins in #lua and/or #vimscript running in the background and autoupdating from #github - awesome! 🌈🦄 config is plain #toml - no need to write it in turing-complete languages which i only know poorly

shout out @bobulous 🙌 bobulous.org.uk/coding/Helix-c

Replied in thread

i've only ever seen proper structural editing with lisps. in emacs you have things like paredit. and i get it, parsing lisp is trivial, text wrapped in pairs of parantheses are your parse nodes. but we have treesitter. we can do so much more.

i could just write code and not care about syntax at all. i shouldn't ever have to fight it. and my editor should be a parse tree editor, not a text editor. text just isn't my interface most of the time. if i'm writing prose, maybe. but usually, i'm not.

when i hit w in vim style binds often mean to go to the next sibling node. but i'm having to spam that and some amount of h or l to get to where i want to go. when writing code i don't think in words or characters. when i hit j i often mean to go to the next statement or expression.

#lisp#paredit#emacs
Continued thread

and most of these modern text editors have the parse trees, for syntax highlighting. treesitter supports how many languages, now?

why dont they leverage the already existing infrastructure? no extra dependencies to be added or anything. just use what you already bring in, but better.

theres already selection that leverages treesitter in most editors. im not sure of neovim, but in helix it's built-in with alt-o, and in emacs you can use the expreg package (i think that's what it's called). but why is that all we have? and it's in addition to the existing selection, not in-place of it. why don't we have similar things for the other editing ui, like navigation, deletion, copy, cut, etc.

i think i know, and i believe it's because selection is the only thing that's been way too painful with traditional line based or word based selection. it's imprecise, cumbersome, and just overall painful. but everything else, it's just okay enough that people are fine with it.

EDIT: I am not looking to set up TreeSitter on neovim. I have that working fine, but only for bog standard 2024 syntax like awk or C or Makefiles. I want a *new* syntax definition for an old assembler that targets 12-bit minicomputers from the 1960s.

Hey, are there any #NeoVim nerds here who can help folks with slightly older versions? I have a goal of "don't make my vi installation a full-time job" and I'm doing a lot of #PDP8 assembly in PAL. I can supply a #Kate syntax file that does well enough (I use it for #pandoc), but I need a #TreeSitter syntax wotsit that I can just Install without having to upgrade NeoVim or TreeSitter past what's in Debian (this is non-negotiable: anything else has always become a full-time job for me).

All the TreeSitter tutorials say to use an init command that doesn't exist in my copy, and I lost patience right then. The architecture makes it seem like this is only a pain for setting up a new project, but I don't have the attention to devote to this. I'd also like it if PAL8 syntax made it into whatever mainstream syntax repositories TS grabs from.

Sinon hier j'ai fait un binding #treesitter depuis #pharo #smalltalk !
Trop pratique pour analyser plein de language avec #moose. Je pense que je vais regarder pour faire un éditeur multi language en utilisant #treesitter et le #languageserverprotocol 🌟
Pour tester :
github.com/badetitou/Pharo-Tre

GitHubGitHub - badetitou/Pharo-Tree-SitterContribute to badetitou/Pharo-Tree-Sitter development by creating an account on GitHub.

Last month I switched over from using #NvimR to #RNvim (the lua-based successor), which uses #TreeSitter for syntax highlighting. It was hard enough to do the transition and the realize that debugging support was turned off, but one of the biggest disappointments is the lack of #roxygen highlighting (github.com/r-lib/tree-sitter-r), which is actually default in #Nvim :blobfoxcry2: I was thinking to switch over to #VScode or #positron, but having to learn new shortcuts for everything make me sad.

GitHubHighlight ROxygen tags · Issue #68 · r-lib/tree-sitter-rBy wklimowicz

I've just opened a PR on the tree-sitter-svelte grammar project, which resolves the annoying issue where syntax highlighting b0rks when HTML tags contain periods like `<Card.Root>`.

Hopefully, it will be merged soon 🤞

github.com/tree-sitter-grammar

GitHubfix(scanner): allow periods in tag names by michenriksen · Pull Request #4 · tree-sitter-grammars/tree-sitter-svelteBy michenriksen