config.nvim
tree-sitter-python
config.nvim | tree-sitter-python | |
---|---|---|
2 | 5 | |
5 | 312 | |
- | 4.2% | |
7.4 | 7.6 | |
8 months ago | 21 days ago | |
Lua | JavaScript | |
- | MIT License |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
config.nvim
-
what do you guys use treesitter for?
For cool snippets. For example in C++, if I'm in a class "Foo" and I expand the snippet "cassd" (const assignment definition), it generates "Foo& operator=(Foo const& other);" (see config).
-
Share your most advanced (Lua)Snippets
The first is a collection of snippets for C++ that generate the declarations or definitions of the special member functions (move constructor etc.). The snippet uses treesitter to determine whether we are currently inside of a class or not. If we are inside of a class, it automatically gets the correct name of the surrounding class (without templates) and uses that to generate the member function. If we are outside of a class, you have to type in the name but it will still correctly strip templates in the right places with a simple regex. Showcase. Code.
tree-sitter-python
-
Emacs and Java Development: Corfu + Cape + LSP-Mode + Treesit
(use-package treesit :ensure nil :custom ;; Some stuff taken from here: https://robbmann.io/posts/emacs-treesit-auto/ (treesit-extra-load-path '("/usr/lib64/")) (treesit-language-source-alist '((bash . ("https://github.com/tree-sitter/tree-sitter-bash")) (c . ("https://github.com/tree-sitter/tree-sitter-c")) (c++ . ("https://github.com/tree-sitter/tree-sitter-cpp")) (csharp . ("https://github.com/tree-sitter/tree-sitter-c-sharp")) (css . ("https://github.com/tree-sitter/tree-sitter-css")) (elixir ("https://github.com/elixir-lang/tree-sitter-elixir")) (html . ("https://github.com/tree-sitter/tree-sitter-html")) (java . ("https://github.com/tree-sitter/tree-sitter-java")) (javascript . ("https://github.com/tree-sitter/tree-sitter-javascript")) (json . ("https://github.com/tree-sitter/tree-sitter-json")) (lua . ("https://github.com/Azganoth/tree-sitter-lua")) (makefile . ("https://github.com/alemuller/tree-sitter-make")) (org . ("https://github.com/milisims/tree-sitter-org")) (python . ("https://github.com/tree-sitter/tree-sitter-python")) (tsx . ("https://github.com/tree-sitter/tree-sitter-typescript" "master" "tsx/src")) (typescript . ("https://github.com/tree-sitter/tree-sitter-typescript" "master" "typescript/src")) (ruby . ("https://github.com/tree-sitter/tree-sitter-ruby")) (rust . ("https://github.com/tree-sitter/tree-sitter-rust")) (sql . ("https://github.com/m-novikov/tree-sitter-sql")) (toml . ("https://github.com/tree-sitter/tree-sitter-toml")) (yaml . ("https://github.com/ikatyang/tree-sitter-yaml")))) (major-mode-remap-alist '((c-mode . c-ts-mode) (c++-mode . c++-ts-mode) (csharp-mode . csharp-ts-mode) (css-mode . css-ts-mode) (html-mode . html-ts-mode) (java-mode . java-ts-mode) (js-mode . js-ts-mode) (json-mode . json-ts-mode) (makefile-mode . makefile-ts-mode) ;; (org-mode . org-ts-mode) ;; not mature yet (python-mode . python-ts-mode) (typescript-mode . typescript-ts-mode) (ruby-mode . ruby-ts-mode) (rust-mode . rust-ts-mode) (toml-mode . toml-ts-mode) (yaml-mode . yaml-ts-mode))) (treesit-auto-fallback-alist '((toml-ts-mode . conf-toml-mode) (typescript-ts-mode . nil) (tsx-ts-mode . nil))) (treesit-font-lock-settings t) (treesit-simple-indent t) (treesit-defun-type-regexp t)) (use-package treesit-auto :demand t :config (setq treesit-auto-install t) (global-treesit-auto-mode))
- Building tree-sitter languages for Emacs
-
what do you guys use treesitter for?
i dont see the issue reported in the python parser: https://github.com/tree-sitter/tree-sitter-python/issues
-
Custom treesitter python highlight for __dunder__ methods
How can we add different highlight for __dunder__ methods a.k.a. magic methods? Is there a TS highlight group for that? I know that in tree-sitter-python there is pythonTSConstructor for __init__ method that I can customize, but I couldn't figure out for other magic methods.
-
Emacs for Python 3.10
You could try elisp-tree-sitter as soon as this issue is closed.
What are some alternatives?
neotest - An extensible framework for interacting with tests within NeoVim.
lsp-mode - Emacs client/library for the Language Server Protocol
perfanno.nvim - NeoVim lua plugin that annotates source code with profiling information from perf or other profilers
tree-sitter-rust - Rust grammar for tree-sitter
LuaSnip - Snippet Engine for Neovim written in Lua.
tree-sitter-typescript - TypeScript grammar for tree-sitter
ultisnips - UltiSnips - The ultimate snippet solution for Vim. Send pull requests to SirVer/ultisnips!
tree-sitter-c-sharp - C# Grammar for tree-sitter
tree-sitter-vue - Vue grammar for tree-sitter
tree-sitter-zig - Tree-sitter package for the Zig programming language
tree-sitter-go - Go grammar for tree-sitter
tree-sitter-sql - SQL syntax highlighting for tree-sitter