@@ -30,6 +30,14 @@ local function lualib_installed(lib_name)
3030 return res
3131end
3232
33+ --- Check if a treesitter parser is available
34+ --- @param ft string
35+ --- @return boolean
36+ local function treesitter_parser_available (ft )
37+ local res , parser = pcall (vim .treesitter .get_parser , 0 , ft )
38+ return res and parser ~= nil
39+ end
40+
3341function M .check ()
3442 start (' CopilotChat.nvim [core]' )
3543
@@ -58,8 +66,7 @@ function M.check()
5866
5967 start (' CopilotChat.nvim [dependencies]' )
6068
61- local has_plenary = lualib_installed (' plenary' )
62- if has_plenary then
69+ if lualib_installed (' plenary' ) then
6370 ok (' plenary: installed' )
6471 else
6572 error (' plenary: missing, required for running tests. Install plenary.nvim' )
@@ -74,11 +81,24 @@ function M.check()
7481 ' copilot: missing, required for 2 factor authentication. Install copilot.vim or copilot.lua'
7582 )
7683 end
84+
7785 if lualib_installed (' tiktoken_core' ) then
7886 ok (' tiktoken_core: installed' )
7987 else
8088 warn (' tiktoken_core: missing, optional for token counting.' )
8189 end
90+
91+ if treesitter_parser_available (' markdown' ) then
92+ ok (' treesitter[markdown]: installed' )
93+ else
94+ error (' treesitter[markdown]: missing, required for chat markdown highlighting' )
95+ end
96+
97+ if treesitter_parser_available (' diff' ) then
98+ ok (' treesitter[diff]: installed' )
99+ else
100+ warn (' treesitter[diff]: missing, optional for better diff highlighting' )
101+ end
82102end
83103
84104return M
0 commit comments