Commit e135361
authored
fix(todo_comments): handle nil parser from get_parser on nvim 0.12 (#338)
Since neovim/neovim#37276 (released in 0.12), vim.treesitter.get_parser()
returns nil instead of throwing when no parser is installed for the
language. The pcall therefore succeeded with parser == nil, and the
subsequent parser:parse() errored with "attempt to index local 'parser'
(a nil value)" on any buffer whose filetype has no treesitter grammar.
Drop the pcall and check the return value directly. Pass
`{ error = false }` so 0.11 also returns nil instead of throwing, on
0.12+ the option is ignored.1 parent 899e93f commit e135361
1 file changed
+4
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
22 | | - | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
23 | 25 | | |
24 | 26 | | |
25 | 27 | | |
| |||
0 commit comments