Skip to content

Commit 1323b7c

Browse files
authored
Add error message for missing requrie('orgmode').setup_ts_grammar() (#528)
1 parent 1c72f93 commit 1323b7c

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

lua/orgmode/init.lua

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,19 @@ local function check_ts_grammar()
8585
return
8686
end
8787
local parser_config = require('nvim-treesitter.parsers').get_parser_configs()
88-
if parser_config and parser_config.org and parser_config.org.install_info.revision ~= ts_revision then
88+
if parser_config and parser_config.org and parser_config.org.install_info.revision then
89+
if parser_config.org.install_info.revision ~= ts_revision then
90+
require('orgmode.utils').echo_error({
91+
'You are using outdated version of tree-sitter grammar for Orgmode.',
92+
'To use latest version, replace current grammar installation with "require(\'orgmode\').setup_ts_grammar()" and run :TSUpdate org.',
93+
'More info in setup section of readme: https://github.com/nvim-orgmode/orgmode#setup',
94+
})
95+
end
96+
else
8997
require('orgmode.utils').echo_error({
90-
'You are using outdated version of tree-sitter grammar for Orgmode.',
91-
'To use latest version, replace current grammar installation with "require(\'orgmode\').setup_ts_grammar()" and run :TSUpdate org.',
92-
'More info in setup section of readme: https://github.com/nvim-orgmode/orgmode#setup',
98+
'Cannot detect parser revision.',
99+
"Please check your org grammar's install info.",
100+
'Maybe you forgot to call "require(\'orgmode\').setup_ts_grammar()" before setup.',
93101
})
94102
end
95103
end, 200)

0 commit comments

Comments
 (0)