Description
Describe the bug
This is a macOS only bug, I cannot reproduce it in linux.
When opening a markdown file that contains code block with same name with the treesitter parser but have different case (e.g. python
vs Python
, r
vs R
, Json
vs json
), you will get the following error:
stack traceback:
[C]: in function '_ts_parse_query'
...m/0.10.0/share/nvim/runtime/lua/vim/treesitter/query.lua:252: in function 'fn'
...ovim/0.10.0/share/nvim/runtime/lua/vim/func/_memoize.lua:58: in function 'fn'
...ovim/0.10.0/share/nvim/runtime/lua/vim/func/_memoize.lua:58: in function 'get'
...0/share/nvim/runtime/lua/vim/treesitter/languagetree.lua:128: in function 'new'
...0/share/nvim/runtime/lua/vim/treesitter/languagetree.lua:511: in function 'add_child'
...0/share/nvim/runtime/lua/vim/treesitter/languagetree.lua:395: in function '_add_injections'
...0/share/nvim/runtime/lua/vim/treesitter/languagetree.lua:447: in function 'parse'
....0/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:397: in function <....0/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:392>
Error in decoration provider treesitter/highlighter.win:
Error executing lua: ...m/0.10.0/share/nvim/runtime/lua/vim/treesitter/query.lua:252: no such language: R
This error is actually the same error as in nvim-treesitter: nvim-treesitter/nvim-treesitter#6642
Steps to reproduce
-
open the following example org mode file, say : hello.org
-
Open it in neovim, get billions of errors so that you can't do anything with neovim.
Expected behavior
- nvim should open this file normally.
Emacs functionality
No response
Minimal init.lua
local plugins = {
orgmode = "https://github.com/nvim-orgmode/orgmode",
ts = "https://github.com/nvim-treesitter/nvim-treesitter",
}
for name, url in pairs(plugins) do
local install_path = "/tmp/nvim/site/" .. name
if vim.fn.isdirectory(install_path) == 0 then
vim.fn.system({ "git", "clone", "--depth=1", url, install_path })
end
vim.o.runtimepath = install_path .. "," .. vim.o.runtimepath
end
require("nvim-treesitter.configs").setup({
-- One of "all", "maintained" (parsers with maintainers), or a list of languages
ensure_installed = {
"r",
},
sync_install = true,
highlight = {
enable = true,
},
})
require("orgmode").setup()
Screenshots and recordings

OS / Distro
macos 13.4
Neovim version/commit
0.10
Additional context
R
and r
are both considered as "Canonical" name for R language, so you would expect to see different authors use R
and r
interchangably from different sources. While treesitter uses r
as its name, the orgmode
should handles language name R
robustly.