emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Tree-sitter integration on feature/tree-sitter


From: Yuan Fu
Subject: Re: Tree-sitter integration on feature/tree-sitter
Date: Sat, 7 May 2022 11:27:11 -0700

> 
>> - play with it
> 
> Would you please suggest how to "play with it"?  What features to turn
> on and how, what commands and displays to try, etc.  Posting such
> instructions should allow all of us get to testing this branch much
> sooner and easier.

Some suggestions on top of my head:

- Load the attached treesit-demo.el which contains a very basic C major mode, 
ts-c-mode, that gives you some font-locking and indentation using tree-sitter 
features.
- Get a C file, change its extension to .tsc, and open it
- The major mode should be ts-c-mode, and it should have some basic 
fontification.
- Type M-x treesit-show-buffer-tree RET to see the AST of the C file, probably 
want to use this on a smaller C file.
- Type M-x treesit-inspect-mode RET to display the AST of the node at point in 
the mode-line, see more explanation in its doctoring.
- Set treesit--indent-verbose to t, and try to indent some lines, and see which 
indentation rule is matched.

Is this the sort of things you are looking for? Or you are thinking about 
testing the functionalities of tree-sitter? For that I can think of:
- Putting language definitions in different places and see Emacs can find them 
correctly (~/.emacs.d/tree-sitter, path in treesit-extra-load-path, 
LD_LOAD_PATH, etc)
- Running tests in tests/src/treesit-tests.el
- Use narrow and widen and see if everything works
- etc

Yuan


reply via email to

[Prev in Thread] Current Thread [Next in Thread]