Skip to main content

Questions tagged [tree-sitter]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
0 answers
36 views

Trying to get treesitter indents to work with multiple languages for a major mode

I am working on a major mode using treesitter as my parser. It's been pretty intuitive but I ran into an issue. When trying to use multiple languages, you have to specify ranges using nodes in the AST ...
Marc Johnson's user avatar
0 votes
0 answers
21 views

Correct tree-sitter based indentation for d-ts-mode.el

I've put together a d-ts-mode for the D programming language at https://gitlab.com/per.nordlow/elisp/-/blob/main/d-ts-mode.el. The indentation doesn't work for all cases. Does anyone have advice on ...
Nordlöw's user avatar
  • 517
0 votes
0 answers
14 views

Cannot get forward-token right using treesit node functions

I'm trying to figure out how to create a forward-token function using treesit. So far I have the following. (defun forward-token (&optional arg limit past-ws named) "Move point forward ARG ...
Nordlöw's user avatar
  • 517
0 votes
1 answer
379 views

How to point eglot to project-specific typescript-language-server

I have set up tree-sitter and typescript-ts-mode. But if I activate eglot using M-x eglot it complains that it can't find the typescript-language-server executable – well duh, I didn't install it ...
malthe's user avatar
  • 103
0 votes
1 answer
312 views

treesit-install-language-grammar on Windows with Clang

I'm trying to use tree sitter on Windows with Emacs 29.1, but running into trouble when installing a language grammar. When I invoke the treesit-install-language-grammar function with the arguments ...
Charles Lowell's user avatar
0 votes
1 answer
183 views

How to build Emacs29 with tree-sitter without sudo

Here are the commands I'm running First I install tree-sitter make PREFIX=${HOME}/.tree-sitter make PREFIX=${HOME}/.tree-sitter install This populates ~/.tree-sitter directory ├── include │   └── ...
phoxd's user avatar
  • 231
0 votes
0 answers
70 views

A script to export org with highlighted code block

I've written the script to export all of my ORG files into HTML files. It takes the files from the folder "content" and saves the results to "public". (setq user-emacs-directory &...
ANtlord's user avatar
0 votes
1 answer
370 views

How to use tree-sitter parser for syntax highlighting?

I'm trying to setup Emacs for editing Roc (https://www.roc-lang.org/) source code. I have an LSP server for Roc and tree-sitter parser for Roc installed. Unfortunately I failed to find tree-sitter ...
Yuriy Al. Shirokov's user avatar
1 vote
1 answer
153 views

C offset is 2 with treesit

I recently started using treesit and I'm noticing with C files, my auto-indent is 2 spaces. How can I fix this to make it 4 spaces again? I've tried c-basic-offset.
user129393192's user avatar
0 votes
1 answer
211 views

How to use multiple tree-sitter parsers in buffer

How does one use local treesit parsers/multiple parsers to fontify different regions in a buffer? I haven't been able to find any tree-sitter modes that are currently using local parsers to see how ...
Rorschach's user avatar
  • 125
0 votes
2 answers
2k views

How enable tree-sitter modes (*-ts-mode) that aren't built-in?

My Emacs (29.1) comes with the some tree-sitter modes: c-ts-mode go-ts-mode js-ts-mode ... I downloaded the compiled .dll and they work out of box. However, there are some languages that tree-sitter ...
Lai Yu-Hsuan's user avatar
0 votes
0 answers
225 views

Ruby Eglot Tree-Sitter Configuration

Has anyone managed an eglot and tree-sitter configuration for ruby that has a reasonably full feature set. I have both activated, but here are some things that don't work: xref jumping code folding ...
Daniel Doherty's user avatar
1 vote
1 answer
1k views

language specific tree-sitter major mode wont show up

I'm using GNU Emacs 29.1 and have installed the tree-sitter haskell grammar: libtree-sitter-haskell.so via treesit-install-language-grammar but somehow haskell-ts-mode wont show up as a major mode ...
bird-dancer's user avatar
4 votes
2 answers
647 views

How to highlight documentation comments with tree-sitter?

In c-mode it's possible to show doxygen comments /** ... */ using font-lock-doc-face. See: docs for c-doc-comment-style. How can this be done in c-ts-mode ? I can find documentation pointing to ...
ideasman42's user avatar
  • 8,846
3 votes
2 answers
2k views

C/C++ with tree sitter: how to change indent?

I use Emacs with tree sitter for c++ code (c++-ts-mode). With usual c++-mode I've used this fix for me: (c-set-offset 'inline-open '0) but I don't understand how to do it in new c++-ts-mode. In ...
Sergey's user avatar
  • 243
0 votes
2 answers
1k views

How do I check if the current buffer has a treesit parser?

Starting with Emacs 29, we've got native TreeSitter support using treesit. My question is: how do I know I can use treesit-* functions in the current buffer? The feature check only checks if Emacs ...
Aleksandar Dimitrov's user avatar
1 vote
0 answers
177 views

How do I use a local tree-sitter grammar in my emacs major mode?

I want to create a new major mode for a language with tree-sitter. I am working on the tree-sitter parser locally and It's working (tested in neovim and helix) Now I want to tell emacs to use the ...
Abdellah Stands with Gaza's user avatar