liuchengxu / vista.vim

:cactus: Viewer & Finder for LSP symbols and tags
https://liuchengxu.github.io/vista.vim
MIT License
1.88k stars 89 forks source link

Tree-sitter integration #395

Open liuchengxu opened 3 years ago

liuchengxu commented 3 years ago

https://github.com/tree-sitter/tree-sitter/issues/1042

And an external binary is planned. Feel free to drop any ideas about the tree-sitter integration.

rene-descartes2021 commented 2 years ago

EDIT: Actually scratch using node-tree-sitter, it uses a native (C++) extension with node-gyp and Deno won't ever support that. Looks Deno supports FFI with Rust though with deno_bindgen. Need to think/prototype on this more. I don't want to depend on Node.js so node-tree-sitter is off the table.

I'm writing a prototype to use Deno/denops.vim to use node- tree-sitter in Vim/Neovim. So... Deno would be the external binary.

npm to download grammars, and Node.js or Deno to build/generate the parser from that.

I'm currently tinkering around with some proposed space-vim layers (nodejs, rustc, denops, tree-sitter layers) to get tree-sitter parsing and that usable by Vim plugins including vista.vim. All in a zero-install and built-from-source way for the end-user.

Using the tree-sitter rust bindings in an external rust binary could possibly be a better performing alternative to Deno/denops (Rust/WASM) interface with tree-sitter, but that is out of reach for me to prototype. I should look at vim-clap Rust/vimscript implementation.

liuchengxu commented 2 years ago

I'm writing a prototype to use Deno/denops.vim to use node- tree-sitter in Vim/Neovim. So... Deno would be the external binary.

Cool, keep up the great work. denops.vim looks interesting.

Unfortunately, I don't have much time for these side projects recently, the long-term goal(which may never be able to be realized) is to support writing plugins in Rust that works for both Vim and Neovim, but the communication between Vim and Rust in vim-clap is quite limited at present, and there is a lot of room to improve in various places, so vim-clap can do many things in a non-ideal way, don't expect it's well-designed :D

Some popular Rust-based editor projects are already using the tree sitter (https://github.com/lapce/lapce, https://github.com/helix-editor/helix), theoretically, a lot of goodness in these projects can be easily reused in Vim/NeoVim if using Rust, though they're made to be the next generation of editors.