Giter Club home page Giter Club logo

rocks-treesitter.nvim's Introduction


rocks-treesitter.nvim


Report Bug Β· Request Feature Β· Ask Question

A "just works" tree-sitter setup for rocks.nvim!

LuaRocks

Warning

This module is WIP and does not have a stable release yet.

🌟 Summary

rocks-treesitter.nvim is a rocks.nvim module that helps you manage and use tree-sitter parsers.

It aims to be a minimal replacement for nvim-treesitter.

Parsers, bundled with queries, are hosted on rocks-binaries (dev), so that you don't have to compile them on your machine.

Do I need this plugin?

No. Plugins that depend on tree-sitter parsers can specify the dependencies in their rockspecs.

You can also install the parsers manually, using :Rocks install tree-sitter-<lang>. To enable highlighting for parser <lang>, all you need to do is create a ftplugin/<lang>.lua file, and in it, call vim.treesitter.start().

See also the rocks.nvim README's tree-sitter section.

This plugin is for convenience.

πŸ“ Requirements

  • An up-to-date rocks.nvim.

πŸ”¨ Installation

Simply run :Rocks install rocks-treesitter.nvim, and you are good to go!

Important

Because this plugin comes with a large number of tree-sitter parsers, the initial installation may take a long time.

πŸ“š Usage

This plugin works out of the box and doesn't need any configuration. However, you can override its default configuration in one of two ways:

Warning

  • Tree-sitter and treesitter highlighting are an experimental feature of Neovim. As with nvim-treesitter, please consider tree-sitter support with this plugin experimental.

  • We are not affiliated with the nvim-treesitter maintainers. If you are facing issues with tree-sitter support in rocks.nvim, please don't bug them.

πŸ”§ Configuration

Using rocks.toml

You can add a [treesitter] section to your rocks.toml, and use it to set any options you would otherwise pass to require("nvim-treesitter.configs").setup {}1.

[treesitter]
# auto_highlight = "all"
# NOTE: These are parsers, not filetypes.
auto_highlight = [
  "haskell",
  "dhall",
  "rust",
  "toml"
]
auto_install = "prompt" # true | false

[treesitter.parser_map]
# You can add custom filetype to parser mappings.
# Determine the filetype with ':lua =vim.bo[0].filetype'.
# NOTE: You don't actually have to add these examples.
# They are added by default.
PKGBUILD = "bash"
cls = "latex"
sty = "latex"

With lua:

Or, you add a lua table to your vim.g.rocks_nvim setting:

vim.g.rocks_nvim = {
    -- rocks.nvim config
    treesitter = {
        auto_highlight = { },
        auto_install = "prompt",
        parser_map = { },
    },
}

Important

If both configuration methods are used, the lua configuration is given higher priority, to support things like :h exrc.

🚧 Current limitations

  • Currently, we are having issues building the tree-sitter parsers for Windows in our rocks-binaries CI. It is likely that you will run into the same issues if you are on Windows.

πŸ“– License

rocks-treesitter.nvim is licensed under GPLv3.

Footnotes

  1. See nvim-treesitter for configuration options. ↩

rocks-treesitter.nvim's People

Contributors

glindstedt avatar mrcjkb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

glindstedt

rocks-treesitter.nvim's Issues

Error when install

Vim:E5113: Error while calling lua chunk: ...nux64/share/nvim/runtime/lua/vim/treesitter/language.lua:130: filetype: e
xpected string|table, got number
stack traceback:
^I[C]: in function 'error'
^Ivim/shared.lua: in function 'validate'
^I...nux64/share/nvim/runtime/lua/vim/treesitter/language.lua:130: in function 'register'
^I.../nvim/rocks/share/lua/5.1/rocks_treesitter/highlight.lua:9: in main chunk
^I[C]: in function 'require'
^I.../rocks-treesitter.nvim/scm-1/plugin/rocks-treesitter.lua:13: in main chunk
^I[C]: at 0x5a86e74d87e0
^I[C]: in function 'pcall'
^I.../.local/share/nvim/rocks/rocks_rtp/lua/rocks/runtime.lua:71: in function 'source'
^I.../.local/share/nvim/rocks/rocks_rtp/lua/rocks/runtime.lua:83: in function 'source_plugin'
^I.../.local/share/nvim/rocks/rocks_rtp/lua/rocks/runtime.lua:150: in function 'packadd'
^I...re/nvim/rocks/rocks_rtp/lua/rocks/operations/helpers.lua:90: in function 'on_exit'
^I....local/share/nvim/rocks/share/lua/5.1/rocks/luarocks.lua:67: in function ''
^Ivim/_editor.lua: in function <vim/_editor.lua:0>

[Feature] `:Rocks ts` commands

  • ts add - enable auto highlight and install (if bang). No arg gets the parser for the current file type
  • ts prune - disable auto highlight and uninstall. Don't uninstall if bang?

Error toml parser

Se ha detectado un error al procesar BufWinEnter Auto-Γ³rdenes para "*":
Error executing vim.schedule lua callback: ...nux64/share/nvim/runtime/lua/vim/treesitter/language.lua:104: no parser
for 'toml' language, see :help treesitter-parsers
stack traceback:
[C]: in function 'error'
...nux64/share/nvim/runtime/lua/vim/treesitter/language.lua:104: in function 'add'
...4/share/nvim/runtime/lua/vim/treesitter/languagetree.lua:111: in function 'new'
...y/nvim-linux64/share/nvim/runtime/lua/vim/treesitter.lua:41: in function '_create_parser'
...y/nvim-linux64/share/nvim/runtime/lua/vim/treesitter.lua:108: in function 'get_parser'
...y/nvim-linux64/share/nvim/runtime/lua/vim/treesitter.lua:416: in function 'start'
/home/think-crag/Git/dotfiles/config/nvim/init.lua:14: in function </home/think-crag/Git/dotfiles/config/nvim/
init.lua:13>
[C]: in function 'wait'
...are/nvim/rocks/rocks_rtp/lua/frecency/database/table.lua:50: in function 'wait_ready'
...are/nvim/rocks/rocks_rtp/lua/frecency/database/table.lua:25: in function '__index'
...cal/share/nvim/rocks/rocks_rtp/lua/frecency/database.lua:60: in function 'has_entry'
.../.local/share/nvim/rocks/rocks_rtp/lua/frecency/init.lua:71: in function 'assert_db_entries'
.../.local/share/nvim/rocks/rocks_rtp/lua/frecency/init.lua:31: in function 'setup'
...m/rocks/rocks_rtp/lua/telescope/_extensions/frecency.lua:23: in function 'register'
...m/rocks/rocks_rtp/lua/telescope/_extensions/frecency.lua:65: in function <...m/rocks/rocks_rtp/lua/telescop
e/_extensions/frecency.lua:62>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.