Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: treesitter markdown highlight error if no parser is found #397

Closed
3 tasks done
SilverMira opened this issue Mar 15, 2023 · 0 comments · Fixed by #398 or #639
Closed
3 tasks done

bug: treesitter markdown highlight error if no parser is found #397

SilverMira opened this issue Mar 15, 2023 · 0 comments · Fixed by #398 or #639
Labels
bug Something isn't working

Comments

@SilverMira
Copy link

Did you check docs and existing issues?

  • I have read all the noice.nvim docs
  • I have searched the existing issues of noice.nvim
  • I have searched the exsiting issues of plugins related to this issue

Neovim version (nvim -v)

v0.9.0-dev-1175+g89a525de9

Operating system/version

Windows

Describe the bug

Encountered this issue while I'm writing some Dart code, which does have a Treesitter parser, but has an issue in which the parser falls into an infinite loop and freezes Neovim, which had me uninstall it. The following error is thrown if I open any nvim-cmp suggestion that has documentation, spamming the notifications.

Stacktrace
Error executing vim.schedule lua callback: ...eovim/share/nvim/runtime/lua/vim/treesitter/language.lua:87: no parser for 'dart' language, see :help treesitter-parsers
stack traceback:
	[C]: in function 'error'
	...eovim/share/nvim/runtime/lua/vim/treesitter/language.lua:87: in function 'add'
	...m/share/nvim/runtime/lua/vim/treesitter/languagetree.lua:87: in function 'new'
	.../nvim-data/lazy/noice.nvim/lua/noice/text/treesitter.lua:48: in function 'highlight'
	.../Local/nvim-data/lazy/noice.nvim/lua/noice/text/init.lua:67: in function 'highlight'
	...Data/Local/nvim-data/lazy/nui.nvim/lua/nui/line/init.lua:55: in function 'highlight'
	...Data/Local/nvim-data/lazy/nui.nvim/lua/nui/line/init.lua:70: in function 'render'
	...Local/nvim-data/lazy/noice.nvim/lua/noice/text/block.lua:97: in function 'render'
	...cal/nvim-data/lazy/noice.nvim/lua/noice/lsp/override.lua:38: in function 'stylize_markdown'
	...Local/nvim-data/lazy/nvim-cmp/lua/cmp/view/docs_view.lua:54: in function 'open'
	...a/AppData/Local/nvim-data/lazy/nvim-cmp/lua/cmp/view.lua:238: in function 'callback'
	...ta/Local/nvim-data/lazy/nvim-cmp/lua/cmp/utils/async.lua:111: in function 'cb'
	vim/_editor.lua:263: in function <vim/_editor.lua:262>

Additionally, whatever builtin highlight without depending on treesitter on nvim-cmp's window is removed

Using noice without treesitter parser

image
image

Not using noice, without treesitter parser

image

Steps To Reproduce

  1. Uninstall a treesitter parser
  2. Open the filetype for the unavailable parser
  3. Have nvim-cmp suggest something

Expected Behavior

Noice should handle the case when no treesitter parser is available, and ideally fallback to the default highlighting

Repro

-- DO NOT change the paths and don't remove the colorscheme
local root = vim.fn.fnamemodify("./.repro", ":p")
-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "cache" }) do
  vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end

-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
  vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", lazypath, })
end
vim.opt.runtimepath:prepend(lazypath)

-- install plugins
local plugins = {
  "folke/tokyonight.nvim",
  "folke/noice.nvim",
  -- add any other plugins here
}
require("lazy").setup(plugins, {
  root = root .. "/plugins",
})

vim.cmd.colorscheme("tokyonight")
-- add anything else here
@SilverMira SilverMira added the bug Something isn't working label Mar 15, 2023
@folke folke closed this as completed in d60bee1 Mar 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant