diff options
author | Steven Arcangeli <506791+stevearc@users.noreply.github.com> | 2023-12-22 02:40:01 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-22 11:40:01 +0100 |
commit | 92204b06e7365cf4c68e6ea8258dce801f0a5df9 (patch) | |
tree | a3899c2bdfcdcf29ece83e426750d1f740894d47 /test | |
parent | db0ec84fb46b8235f8651d5aa25eb56a9b117eb5 (diff) | |
download | rneovim-92204b06e7365cf4c68e6ea8258dce801f0a5df9.tar.gz rneovim-92204b06e7365cf4c68e6ea8258dce801f0a5df9.tar.bz2 rneovim-92204b06e7365cf4c68e6ea8258dce801f0a5df9.zip |
refactor(lsp): move glob parsing to util (#26519)
refactor(lsp): move glob parsing to vim.glob
Moving the logic for using vim.lpeg to create a match pattern from a
glob into `vim.glob`. There are several places in the LSP spec that
use globs, and it's very useful to have glob matching as a
generally-available utility.
Diffstat (limited to 'test')
-rw-r--r-- | test/functional/lua/glob_spec.lua (renamed from test/functional/plugin/lsp/watchfiles_spec.lua) | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/test/functional/plugin/lsp/watchfiles_spec.lua b/test/functional/lua/glob_spec.lua index a8260e0c98..ce38d25e46 100644 --- a/test/functional/plugin/lsp/watchfiles_spec.lua +++ b/test/functional/lua/glob_spec.lua @@ -1,14 +1,17 @@ local helpers = require('test.functional.helpers')(after_each) - local eq = helpers.eq local exec_lua = helpers.exec_lua -describe('vim.lsp._watchfiles', function() +describe('glob', function() before_each(helpers.clear) after_each(helpers.clear) local match = function(...) - return exec_lua('return require("vim.lsp._watchfiles")._match(...)', ...) + return exec_lua([[ + local pattern = select(1, ...) + local str = select(2, ...) + return require("vim.glob").to_lpeg(pattern):match(str) ~= nil + ]], ...) end describe('glob matching', function() |