nvim-neorg/tree-sitter-norg

Attached and Detached Modifier Abstractions

rt-kill opened this issue · 0 comments

Modifier Extensions

Disclaimer: I am not very familiar with Treesitter or parser's in general, and I'm just putting this here as a consideration.

I am new to Neorg and have been reading through wiki/specifications. I when messing around with it I noticed that detached modifier extensions are not implemented at the moment. Here is a screen shot of the queries/norg/highlights.scm file over in the Neorg repo.

image

I thought it was a cool concept and looked a little into how much effort writing up a PR would take, and that landed me here. This is where my inexperience with Treesitter/parser's comes into play. I'm curious if it would make sense to have some more abstract nodes that encompass the more specific nodes.

If I understand correctly, the node-types.json defines the different tokens that can appear in a norg file and the grammar.json defines a strict left to right unambiguous grammar that can be used to construct any "valid" norg file. I see we have some general nodes such as _word and _lowercase, but don't have ones such as _modifier, _attached_modifier, and _detached_modifier.

If these make sense to add, I would assume it could make an implementation of detached_modifier_extensions more elegant by allowing for a more general reference to preceding nodes.