summaryrefslogtreecommitdiff
path: root/lua/nvim-treesitter
diff options
context:
space:
mode:
authorKiyan Yazdani <yazdani.kiyan@protonmail.com>2020-05-07 13:58:12 +0200
committerGitHub <noreply@github.com>2020-05-07 13:58:12 +0200
commit096ca6b0689fe04400ed65420f15794d3e88bfa9 (patch)
tree15d220a3581f2ceb24ab4fac079bdd5560efe62f /lua/nvim-treesitter
parent5cc7407c7f730c552120fc7d7d9a136ae6b7035f (diff)
parent703ccbec594219e0331c434ee57a0a48c92b280e (diff)
Merge pull request #44 from vigoux/statusline
Provide a statusline indicator
Diffstat (limited to 'lua/nvim-treesitter')
-rw-r--r--lua/nvim-treesitter/parsers.lua3
1 files changed, 2 insertions, 1 deletions
diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua
index e046ca45..07f3e9d3 100644
--- a/lua/nvim-treesitter/parsers.lua
+++ b/lua/nvim-treesitter/parsers.lua
@@ -5,11 +5,12 @@ local M = {}
function M.has_parser(lang)
local lang = lang or api.nvim_buf_get_option(0, 'filetype')
+ if not lang or #lang == 0 then return false end
return #api.nvim_get_runtime_file('parser/' .. lang .. '.*', false) > 0
end
function M.get_parser(bufnr, lang)
- if M.has_parser() then
+ if M.has_parser(lang) then
local buf = bufnr or api.nvim_get_current_buf()
local lang = lang or api.nvim_buf_get_option(buf, 'ft')
if not M[buf] then