diff options
author | Sacha Chua <sacha@sachachua.com> | 2022-12-15 00:30:02 -0500 |
---|---|---|
committer | Sacha Chua <sacha@sachachua.com> | 2022-12-15 00:45:37 -0500 |
commit | d3abd436bfba3343cc8baf20054a92cacc62aa07 (patch) | |
tree | b5e4730a42c9e4c10dc89d336bac549f40535177 /2022/talks/treesitter.md | |
parent | 16c12dd65d2d7a269a649b63dbf643de3915ad59 (diff) | |
download | emacsconf-wiki-d3abd436bfba3343cc8baf20054a92cacc62aa07.tar.xz emacsconf-wiki-d3abd436bfba3343cc8baf20054a92cacc62aa07.zip |
Automated commit
Diffstat (limited to '2022/talks/treesitter.md')
-rw-r--r-- | 2022/talks/treesitter.md | 94 |
1 files changed, 67 insertions, 27 deletions
diff --git a/2022/talks/treesitter.md b/2022/talks/treesitter.md index c846f2a0..317cf3f5 100644 --- a/2022/talks/treesitter.md +++ b/2022/talks/treesitter.md @@ -46,33 +46,73 @@ This session will introduce them to things like (not final list): ## Questions and answers -- Q: What treesitter package is being used I think there is 3 - different ones - - A: Most of what is demoed here is using - <https://github.com/emacs-tree-sitter/elisp-tree-sitter> -- Q: Can the folds be treated as outlines as in outline-minor-mode - folds? - - A: I don't think the package ts-fold which I showcased works - with outline mode, but it should be simple enough to add - something like that - (<https://github.com/emacs-tree-sitter/ts-fold>) -- Q: Is there any benefit to use tree-sitter for sexp-based languages? - +1 - - A: Being able to query for specific things like variables / - conditions might come in handy -- Q:Do you have to have an LSP set up in order to use tree-sitter? - - A:I still use eglot for lsp. While tree-sitter help with - highlighting, folding, nav etc . . tree-sitter can be more - thought of to be working on a single file. So when I need to do - project wide things like jump to defenition, find reference or - renames lsp comes in handy. -- Q: Is there any example configuration for the transition from - traditional major mode to new *-ts-major-mode? It seems that - configuration of major mode (xxx-mode-hook, yasnippet, etc) has to - been rewritten - - A: I am just starting to work with builtin tree-sitter, so - don't have much input here unfortunately :( - +- Q: What treesitter package is being used I think there is 3 + different ones + - A: Most of what is demoed here is using + <https://github.com/emacs-tree-sitter/elisp-tree-sitter> +- Q: Can the folds be treated as outlines as in outline-minor-mode + folds? + - A: I don't think the package ts-fold which I showcased works + with outline mode, but it should be simple enough to add + something like that + (<https://github.com/emacs-tree-sitter/ts-fold>) +- Q: Is there any benefit to use tree-sitter for sexp-based languages? + +1 + - A: Being able to query for specific things like variables / + conditions might come in handy +- Q:Do you have to have an LSP set up in order to use tree-sitter? + - A:I still use eglot for lsp. While tree-sitter help with + highlighting, folding, nav etc . . tree-sitter can be more + thought of to be working on a single file. So when I need to do + project wide things like jump to defenition, find reference or + renames lsp comes in handy. +- Q: Is there any example configuration for the transition from + traditional major mode to new *-ts-major-mode? It seems that + configuration of major mode (xxx-mode-hook, yasnippet, etc) has to + been rewritten + - A: I am just starting to work with builtin tree-sitter, so + don't have much input here unfortunately :( +- Q: So, is there a tree-sitter language definition for elisp? + - A: I'm just starting to look into built-in tree sitter, but I feel like we should be able to do all of them. +- Q: awesome stuff. i always wonder when itll appear in my fingers. sure the lib is in 29 but i guess some glue is required? +- Q: thanks for the great talk. I have one question. Will tree sitter able to highlight syntax in sourceblocks of org files? + - A: there is nothing technically stopping one from enabling highlighting in config blocks. Since I don't use org, I've not really looked into how it currently is. +- Q: So Emacs 29 includes the original tree sitter C library by Max Brunsfeld or is it a custom rewrite? +- Q: what about the relationship between emacs-tree-sitter and treesitter in core emacs + - A: there are just two Emacs side implementaions for the tree-sitter lib <https://tree-sitter.github.io/tree-sitter/> . The first one is in Rust and the second in C within core + - A: I have not extensively tested out the builtin one, but both should be more or less the same. The builtin one is less mature as of now and has a slightly different api. + - A: Plus most plugins that work with tree-sitter will be working with elisp-tree-sitter only as of now + - I'm speaking of the the third party package. Perhaps it has been fixed. IIUC the issue is not the emacs package but rather tree-sitter itself. + - A: You might wanna open an issue at https://github.com/emacs-tree-sitter/tree-sitter-langs if you are having issues with tree-sitter highlighting +- Q: biggest difference between the treesitter functionality built into Emacs 29 and the emacs-tree-sitter github package? +- Q: Are there any sample configurations about *-ts-mode integrated with default major-mode? +- Q: Building Emacs 29 with native tree-sitter support seem challanging any useful tip. + - building emacs ... tips from Xah Lee <http://xahlee.info/emacs/emacs/building_emacs_on_linux.html> +- Q: How much of what you showed can be done with the build-in tree-sitter? +- Q: How easy is it to hack the syntax definition? + - A: It is super easy once you learn a bit about tree-sitter. This is how the highlight queries looks like. <https://github.com/emacs-tree-sitter/tree-sitter-langs/blob/master/queries/python/highlights.scm> Once we have this, the tree-sitter integration can take care of the rest. +- Q: So Emacs 29 includes the original tree sitter C library by Max Brunsfeld or is it a custom rewrite? + - both elisp-tree-sitter and tree-sitter in emacs core are emacs side wrappers on top of the tree-sitter lib from Max. +- Q: What was the name of the module used for doing AST queries on the current buffer? + - A: for viewing and querying the tree, they are commands built into `tree-sitter-debug-mode` and `tree-sitter-query-builder` + +## Other IRC discussions + +- thanks for the great talk meain! +- thank you for the talk +- Great talk. Can I use this with Python? Bash? +- Amazing stuff!!! I need that YAML thing! +- When I am writing lisp macros I'm always having problems with the highlighting. I'm seeing this can be achieve with tree-sitter, is there a more streamlined way of doing it with treesitter - with less code? +- thank you for tree-sitter talk, It's awesome +- Now I definitely need to try tree-sitter +- very inspiring talk, the future looks bright! +- Very well done talk. Thank you. +- I've actually added a lot of highlighting for rust mode on my editor, using tree sitter. It's very powerful once you get into it +- with the new *-ts-mode, seems that a lot of configurations of language specific major mode have to be rewritten + - A: yup, there are quite a few things that being rewritten a bit like indent, highlight etc. +- yup, previously I would just jump to top after reformatting code. These days I've been also trying https://github.com/radian-software/apheleia which has been pretty good at keeping the position by using some other methods +- I use your tree-sitter package for a long time, It works very stable. +- I use tree-sitter write plugin to replace paredit: https://github.com/manateelazycat/grammatical-edit [[!inline pages="internal(2022/info/treesitter-after)" raw="yes"]] |