This file contains links and information pertinent to the tree sitter module.
design decisions
-
should tree sitter support for languages be opt in? (like lsp)
This would make sense as tree sitter support is spotty at best and people can
opt in with a
+treesitter
flag
languages
-
check which languages are supportedthe variabletree-sitter-major-mode-language-alist
contains all the languages that have parser’s but feature support needs to be written and checked -
try and add more language support
- more parsers: This would involve copying or writing highlighting querys which at that point should be up streamed
- language queries
Hacks in testing
- scss
currently this snippet adds scss “support”. it mostly works but the tree
errors on most scss specific syntax. I have not gone very deep but it does
work for basics examples
(after! tree-sitter (pushnew! tree-sitter-major-mode-language-alist '(scss-mode . css)))
text objects
-
bind keys to tree sitter text objects
-
only rebind to tree sitter text-objs if the language supports tree sitter
- This can be achieved by either making a variable of major modes that have tree
sitter support (which requires a little bit of fore thought)
- or rebind keys if a tree-sitter error is raised (which is slower but easier to maintain:tm:)
-
Handle
bad bounding 0 1
error to emmit a more useful message
Current bugs
-
text objects can’t seem to be rebound? currently i can’t rebind text objects using the conventional methods
-
in some conditions a
Bad bounding indices: 0, 1
error is raised. This is due to the query needed not existing. The easiest fix would be to add these querys but this is easier said than done -
Tree sitter somehow is being eager loaded
plugins
To look for / write
-
tree sitter folding mode
-
ts-utils. A package containing helper functions and premade query
commands -
ts playground (the debug mode is hard to parse (and not fun!))
-
ts-incremental-selection. a package to incrementally walk up and down the tree selecting as we walk
To consider adding
misc
Witticism
- current candidate:
the :emacs vc module stole our tree joke