Skip to content

Commit

Permalink
fix: do not index nil config.filestypes in try_add (neovim#1673)
Browse files Browse the repository at this point in the history
  • Loading branch information
kyoh86 authored Jan 22, 2022
1 parent 58d2ba6 commit 9c30d56
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions lua/lspconfig/configs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -251,11 +251,15 @@ function configs.__newindex(t, config_name, config_def)
function manager.try_add_wrapper(bufnr)
bufnr = bufnr or api.nvim_get_current_buf()
local buf_filetype = vim.api.nvim_buf_get_option(bufnr, 'filetype')
for _, filetype in ipairs(config.filetypes) do
if buf_filetype == filetype then
manager.try_add(bufnr)
return
if config.filetypes then
for _, filetype in ipairs(config.filetypes) do
if buf_filetype == filetype then
manager.try_add(bufnr)
return
end
end
else
manager.try_add(bufnr)
end
end

Expand Down

0 comments on commit 9c30d56

Please sign in to comment.