diff options
| author | Stephan Seitz <stephan.seitz@fau.de> | 2020-09-19 17:05:46 +0200 |
|---|---|---|
| committer | Stephan Seitz <stephan.lauf@yahoo.de> | 2020-09-20 10:37:06 +0200 |
| commit | 8c10b1a14d158cb5c81fdc5ab0507451b5f465a4 (patch) | |
| tree | db7cd00cfcfb53f142a4d7c64e94e587bcad04f0 | |
| parent | also match variable names to be @type when uppercased (diff) | |
| download | nvim-treesitter-8c10b1a14d158cb5c81fdc5ab0507451b5f465a4.tar nvim-treesitter-8c10b1a14d158cb5c81fdc5ab0507451b5f465a4.tar.gz nvim-treesitter-8c10b1a14d158cb5c81fdc5ab0507451b5f465a4.tar.bz2 nvim-treesitter-8c10b1a14d158cb5c81fdc5ab0507451b5f465a4.tar.lz nvim-treesitter-8c10b1a14d158cb5c81fdc5ab0507451b5f465a4.tar.xz nvim-treesitter-8c10b1a14d158cb5c81fdc5ab0507451b5f465a4.tar.zst nvim-treesitter-8c10b1a14d158cb5c81fdc5ab0507451b5f465a4.zip | |
fix(checkhealth): use pcall to check for syntax errors in query files
| -rw-r--r-- | lua/nvim-treesitter/health.lua | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lua/nvim-treesitter/health.lua b/lua/nvim-treesitter/health.lua index c5f592745..923314f58 100644 --- a/lua/nvim-treesitter/health.lua +++ b/lua/nvim-treesitter/health.lua @@ -34,7 +34,13 @@ local function install_health() end local function query_health(lang, query_group) - if not queries.get_query(lang, query_group) then + local ok, found_query = pcall(queries.get_query, lang, query_group) + if not ok then + health_error("Error in `"..query_group..".scm` query found for "..lang..'\n'..found_query, { + "Try `:TSUpdate "..lang.."` (queries might have been adapted for a upstream parser change)", + "Try to find the syntax error/invalid node type in above file." + }) + elseif not found_query then health_warn("No `"..query_group..".scm` query found for " .. lang, { "Open an issue at https://github.com/nvim-treesitter/nvim-treesitter" }) |
