From af7748a99dd1701ae83d3af0dd61c08769aeb2c8 Mon Sep 17 00:00:00 2001 From: Michael Lingelbach Date: Mon, 12 Jul 2021 17:00:02 -0700 Subject: fix: do not attach server if buftype is 'nofile' (#1064) * match buftype instead of filetype against 'nofile' * clarify variable naming to make buffer filetype clear from buftype --- lua/lspconfig/configs.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lua') diff --git a/lua/lspconfig/configs.lua b/lua/lspconfig/configs.lua index d004d08c..28202df6 100644 --- a/lua/lspconfig/configs.lua +++ b/lua/lspconfig/configs.lua @@ -161,7 +161,7 @@ function configs.__newindex(t, config_name, config_def) function manager.try_add(bufnr) bufnr = bufnr or api.nvim_get_current_buf() - if vim.api.nvim_buf_get_option(bufnr, "filetype") == "nofile" then + if vim.api.nvim_buf_get_option(bufnr, "buftype") == "nofile" then return end local root_dir = get_root_dir(api.nvim_buf_get_name(bufnr), bufnr) @@ -172,9 +172,9 @@ function configs.__newindex(t, config_name, config_def) end function manager.try_add_wrapper(bufnr) - local buftype = vim.api.nvim_buf_get_option(bufnr, "filetype") + local buf_filetype = vim.api.nvim_buf_get_option(bufnr, "filetype") for _, filetype in ipairs(config.filetypes) do - if buftype == filetype then + if buf_filetype == filetype then manager.try_add(bufnr) return end -- cgit v1.2.3-70-g09d2