diff options
| author | Michael Lingelbach <m.j.lbach@gmail.com> | 2021-12-23 15:20:28 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-12-23 15:20:28 -0500 |
| commit | abb3706974ca0b5086110d8f1b0e90daebff758f (patch) | |
| tree | 0bb5bf5e582800f3736b8c39eef5bd0f6eab361c /lua/lspconfig/util.lua | |
| parent | fix: do not attach server to buffers with nil or missing name (#1597) (diff) | |
| download | nvim-lspconfig-abb3706974ca0b5086110d8f1b0e90daebff758f.tar nvim-lspconfig-abb3706974ca0b5086110d8f1b0e90daebff758f.tar.gz nvim-lspconfig-abb3706974ca0b5086110d8f1b0e90daebff758f.tar.bz2 nvim-lspconfig-abb3706974ca0b5086110d8f1b0e90daebff758f.tar.lz nvim-lspconfig-abb3706974ca0b5086110d8f1b0e90daebff758f.tar.xz nvim-lspconfig-abb3706974ca0b5086110d8f1b0e90daebff758f.tar.zst nvim-lspconfig-abb3706974ca0b5086110d8f1b0e90daebff758f.zip | |
fix: only attempt to attach to valid bufnames (#1598)
* Check that a bufname begins with a filesystem root specifier such as a drive letter (Windows) or "/" (Unix)
* Unify with check that buf name is not "" or nil
Diffstat (limited to 'lua/lspconfig/util.lua')
| -rw-r--r-- | lua/lspconfig/util.lua | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lua/lspconfig/util.lua b/lua/lspconfig/util.lua index 05d844ae..11586d50 100644 --- a/lua/lspconfig/util.lua +++ b/lua/lspconfig/util.lua @@ -19,6 +19,14 @@ M.default_config = { -- global on_setup hook M.on_setup = nil +function M.bufname_valid(bufname) + if bufname and bufname ~= '' and (bufname:match '^([a-zA-Z]:).*' or bufname:match '^/') then + return true + else + return false + end +end + function M.validate_bufnr(bufnr) validate { bufnr = { bufnr, 'n' }, |
