nvim-neorocks / rocks-treesitter.nvim

A "just works" tree-sitter setup for rocks.nvim!
GNU General Public License v3.0
32 stars 3 forks source link

Error when install #8

Closed CRAG666 closed 5 months ago

CRAG666 commented 5 months ago

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>

mrcjkb commented 5 months ago

Hey 👋

Did you set something in

[[treesitter.parser_map]]

in your rocks.toml? Because the error message is saying there's an invalid value in there.

CRAG666 commented 5 months ago

@mrcjkb yes, this: [treesitter] auto_highlight = [ "haskell", "dhall", "rust", "toml" ] auto_install = "prompt" # true | false

[[treesitter.parser_map]] PKGBUILD = "bash" cls = "latex" sty = "latex"

mrcjkb commented 5 months ago

🤔 does it work when you remove

[[treesitter.parser_map]]
PKGBUILD = "bash"
cls = "latex"
sty = "latex"
CRAG666 commented 5 months ago

when delete this, works: [treesitter] auto_highlight = [ "haskell", "dhall", "rust", "toml" ] auto_install = "prompt" # true | false

CRAG666 commented 5 months ago

this is my rocks.toml, works:

# This is your rocks.nvim plugins declaration file.
# Here is a small yet pretty detailed example on how to use it:
#
# [plugins]
# nvim-treesitter = "semver_version"  # e.g. "1.0.0"

# List of non-Neovim rocks.
# This includes things like `toml` or other lua packages.
[rocks]

# List of Neovim plugins to install alongside their versions.
# If the plugin name contains a dot then you must add quotes to the key name!
[plugins]
"rocks.nvim" = "2.21.1"
"rocks-treesitter.nvim" = "scm"
"rocks-git.nvim" = "1.4.0"
"rocks-dev.nvim" = "1.1.2"
neorg = "8.4.0"
"neodev.nvim" = "2.5.2"
cmp-nvim-lsp = "scm"
nvim-web-devicons = "0.99"
tree-sitter-hyprlang = "scm"
tree-sitter-toml = "scm"
tree-sitter-cpp = "scm"
tree-sitter-v = "scm"
tree-sitter-bash = "scm"
"marks.nvim" = "scm"
"which-key.nvim" = "1.6.0"
"dressing.nvim" = "2.2.0"
"mini.indentscope" = "0.9.0"
"nui.nvim" = "0.3.0"
"flash.nvim" = "1.18.2"
"grapple.nvim" = "0.28.2"
"mini.move" = "0.9.0"
"mini.splitjoin" = "0.9.0"
"mini.ai" = "0.9.0"
"telescope.nvim" = "scm"
"telescope-frecency.nvim" = "scm"
"telescope-file-browser.nvim" = "scm"
"ssr.nvim" = "scm"
tree-sitter-python = "scm"
"diffview.nvim" = "scm"
neogit = "scm"
tree-sitter-zathurarc = "scm"
tree-sitter-yuck = "scm"
tree-sitter-vimdoc = "scm"
tree-sitter-typescript = "scm"
tree-sitter-tsx = "scm"
tree-sitter-c_sharp = "scm"
tree-sitter-bibtex = "scm"
tree-sitter-cmake = "scm"
tree-sitter-comment = "scm"
tree-sitter-sql = "scm"
tree-sitter-dot = "scm"
tree-sitter-elixir = "scm"
tree-sitter-fortran = "scm"
tree-sitter-fennel = "scm"
tree-sitter-git_config = "scm"
tree-sitter-git_rebase = "scm"
tree-sitter-gitignore = "scm"
tree-sitter-gitcommit = "scm"
tree-sitter-gitattributes = "scm"
tree-sitter-go = "scm"
tree-sitter-gpg = "scm"
tree-sitter-graphql = "scm"
tree-sitter-http = "scm"
tree-sitter-jsdoc = "scm"
tree-sitter-json5 = "scm"
tree-sitter-jsonc = "scm"
tree-sitter-jsonnet = "scm"
tree-sitter-luap = "scm"
tree-sitter-luau = "scm"
tree-sitter-luadoc = "scm"
tree-sitter-markdown = "scm"
tree-sitter-markdown_inline = "scm"
tree-sitter-meson = "scm"
tree-sitter-ninja = "scm"
tree-sitter-nix = "scm"
tree-sitter-perl = "scm"
tree-sitter-pem = "scm"
tree-sitter-query = "scm"
tree-sitter-rasi = "scm"
tree-sitter-regex = "scm"
tree-sitter-rust = "scm"
tree-sitter-ssh_config = "scm"

[plugins.nvim]
git = "catppuccin/nvim"
rev = "v1.6.0"

[plugins."none-ls.nvim"]
git = "nvimtools/none-ls.nvim"

[plugins."reactive.nvim"]
git = "rasulomaroff/reactive.nvim"
rev = "v1.2.1"

[plugins."gitsigns.nvim"]
git = "lewis6991/gitsigns.nvim"
rev = "v0.7"

[plugins."autoclose.nvim"]
git = "m4xshen/autoclose.nvim"

[plugins."telescope-zf-native.nvim"]
git = "natecraddock/telescope-zf-native.nvim"

[[treesitter.parser_map]]
PKGBUILD = "bash"
cls = "latex"
sty = "latex"

but add: [treesitter] auto_highlight = [ "haskell", "dhall", "rust", "toml" ] auto_install = "prompt" # true | false, config breaks

CRAG666 commented 5 months ago

I use this because this plugin does not activate treesitter automatically:

autocmd("FileType", {
  group = augroup "treesitter",
  pattern = {
    "asm",
    "meson",
    "ninja",
    "nix",
    "perl",
    "bat",
    "bib",
    "c",
    "cmake",
    "cpp",
    "cs",
    "css",
    "csv",
    "dockerfile",
    "dot",
    "elixir",
    "fennel",
    "fortran",
    "gitattributes",
    "gitcommit",
    "gitconfig",
    "gitignore",
    "gitrebase",
    "go",
    "gpg",
    "haskell",
    "help",
    "html",
    "http",
    "hyprlang",
    "java",
    "javascript",
    "json",
    "json5",
    "jsonc",
    "lua",
    "luau",
    "makefile",
    "markdown",
    "matlab",
    "norg",
    "perl",
    "php",
    "powershell",
    "python",
    "r",
    "rust",
    "sass",
    "scss",
    "sh",
    "sql",
    "swift",
    "tex",
    "toml",
    "typescript",
    "typescriptreact",
    "v",
    "vim",
    "xml",
    "yaml",
    "yuck",
    "zathurarc",
  },
  callback = function()
    vim.treesitter.start()
  end,
})
CRAG666 commented 5 months ago

@mrcjkb Thanks

mrcjkb commented 5 months ago
[[treesitter.parser_map]]

should be

[treesitter.parser_map]

I've corrected the snippet in the readme. But you shouldn't need to add any by default. That's just an example, in case the default map is missing something.

I use this because this plugin does not activate treesitter automatically

This is probably because of the error caused by the incorrect [[treesitter.parser_map]] entry. It should start highlighting automatically if a parser is installed, and prompt you to install one if not.