diff options
-rw-r--r-- | cmake.deps/CMakeLists.txt | 4 | ||||
-rw-r--r-- | runtime/CMakeLists.txt | 5 | ||||
-rw-r--r-- | runtime/doc/news.txt | 3 | ||||
-rw-r--r-- | runtime/doc/options.txt | 4 | ||||
-rw-r--r-- | runtime/lua/vim/iter.lua | 35 | ||||
-rw-r--r-- | runtime/lua/vim/lsp/protocol.lua | 2 | ||||
-rwxr-xr-x | src/nvim/CMakeLists.txt | 11 | ||||
-rw-r--r-- | src/nvim/generators/gen_vimvim.lua (renamed from scripts/genvimvim.lua) | 14 | ||||
-rw-r--r-- | src/nvim/ui_client.c | 6 | ||||
-rw-r--r-- | src/nvim/version.c | 4 | ||||
-rw-r--r-- | test/functional/ex_cmds/make_spec.lua | 4 | ||||
-rw-r--r-- | test/functional/helpers.lua | 4 | ||||
-rw-r--r-- | test/functional/lua/vim_spec.lua | 35 |
13 files changed, 80 insertions, 51 deletions
diff --git a/cmake.deps/CMakeLists.txt b/cmake.deps/CMakeLists.txt index 1b6e846682..3cbbbf2712 100644 --- a/cmake.deps/CMakeLists.txt +++ b/cmake.deps/CMakeLists.txt @@ -196,8 +196,8 @@ set(TREESITTER_VIMDOC_URL https://github.com/neovim/tree-sitter-vimdoc/archive/v set(TREESITTER_VIMDOC_SHA256 1ff8f4afd3a9599dd4c3ce87c155660b078c1229704d1a254433e33794b8f274) set(TREESITTER_QUERY_URL https://github.com/nvim-treesitter/tree-sitter-query/archive/v0.1.0.tar.gz) set(TREESITTER_QUERY_SHA256 e2b806f80e8bf1c4f4e5a96248393fe6622fc1fc6189d6896d269658f67f914c) -set(TREESITTER_URL https://github.com/tree-sitter/tree-sitter/archive/af92bfc0220eb0f5e18b896b11d8cd979c63f673.tar.gz) -set(TREESITTER_SHA256 8a083372ed7bfe993e8af0a8c799c60796c922241b44266022c9a6f1fc2f11c1) +set(TREESITTER_URL https://github.com/tree-sitter/tree-sitter/archive/321a652626c63bfea3ea320083a4b14863b80270.tar.gz) +set(TREESITTER_SHA256 8f780289d9524a680e548d891c07dab025241fffdea86f8b55921e4024a84757) if(USE_EXISTING_SRC_DIR) get_cmake_property(VARS VARIABLES) diff --git a/runtime/CMakeLists.txt b/runtime/CMakeLists.txt index 5d69962aba..0077604141 100644 --- a/runtime/CMakeLists.txt +++ b/runtime/CMakeLists.txt @@ -1,4 +1,4 @@ -set(SYN_VIM_GENERATOR ${PROJECT_SOURCE_DIR}/scripts/genvimvim.lua) +set(SYN_VIM_GENERATOR ${PROJECT_SOURCE_DIR}/src/nvim/generators/gen_vimvim.lua) set(GENERATED_RUNTIME_DIR ${PROJECT_BINARY_DIR}/runtime) set(GENERATED_SYN_VIM ${GENERATED_RUNTIME_DIR}/syntax/vim/generated.vim) set(GENERATED_HELP_TAGS ${GENERATED_RUNTIME_DIR}/doc/tags) @@ -13,8 +13,7 @@ get_directory_property(LUA_GEN DIRECTORY ${PROJECT_SOURCE_DIR}/src/nvim DEFINITI get_directory_property(LUA_GEN_DEPS DIRECTORY ${PROJECT_SOURCE_DIR}/src/nvim DEFINITION LUA_GEN_DEPS) add_custom_command(OUTPUT ${GENERATED_SYN_VIM} - COMMAND ${LUA_GEN} ${SYN_VIM_GENERATOR} - ${PROJECT_SOURCE_DIR}/src/nvim ${GENERATED_SYN_VIM} ${FUNCS_DATA} + COMMAND ${LUA_GEN} ${SYN_VIM_GENERATOR} ${GENERATED_SYN_VIM} ${FUNCS_DATA} DEPENDS ${LUA_GEN_DEPS} ${SYN_VIM_GENERATOR} diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt index bbf63a5ee0..3f07dd2e66 100644 --- a/runtime/doc/news.txt +++ b/runtime/doc/news.txt @@ -52,6 +52,9 @@ The following changes to existing APIs or features add new behavior. • vim.diagnostic.config() now accepts a function for the virtual_text.prefix option, which allows for rendering e.g., diagnostic severities differently. +• The `workspace/didChangeWatchedFiles` LSP client capability is now enabled + by default. + ============================================================================== REMOVED FEATURES *news-removed* diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index 7842394245..46d3f153c2 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -5225,9 +5225,9 @@ A jump table for the options with a short description can be found at |Q_op|. *shell-powershell* To use PowerShell: > let &shell = executable('pwsh') ? 'pwsh' : 'powershell' - let &shellcmdflag = '-NoLogo -ExecutionPolicy RemoteSigned -Command [Console]::InputEncoding=[Console]::OutputEncoding=[System.Text.UTF8Encoding]::new();$PSDefaultParameterValues[''Out-File:Encoding'']=''utf8'';' + let &shellcmdflag = '-NoLogo -ExecutionPolicy RemoteSigned -Command [Console]::InputEncoding=[Console]::OutputEncoding=[System.Text.UTF8Encoding]::new();$PSDefaultParameterValues[''Out-File:Encoding'']=''utf8'';Remove-Alias -Force -ErrorAction SilentlyContinue tee;' let &shellredir = '2>&1 | %%{ "$_" } | Out-File %s; exit $LastExitCode' - let &shellpipe = '2>&1 | %%{ "$_" } | Tee-Object %s; exit $LastExitCode' + let &shellpipe = '2>&1 | %%{ "$_" } | tee %s; exit $LastExitCode' set shellquote= shellxquote= < This option cannot be set from a |modeline| or in the |sandbox|, for diff --git a/runtime/lua/vim/iter.lua b/runtime/lua/vim/iter.lua index c5d5ef835b..2545853b41 100644 --- a/runtime/lua/vim/iter.lua +++ b/runtime/lua/vim/iter.lua @@ -18,10 +18,13 @@ ListIter.__call = function(self) return self:next() end +--- Packed tables use this as their metatable +local packedmt = {} + ---@private local function unpack(t) - if type(t) == 'table' and t.__n ~= nil then - return _G.unpack(t, 1, t.__n) + if getmetatable(t) == packedmt then + return _G.unpack(t, 1, t.n) end return t end @@ -30,11 +33,20 @@ end local function pack(...) local n = select('#', ...) if n > 1 then - return { __n = n, ... } + return setmetatable({ n = n, ... }, packedmt) end return ... end +---@private +local function sanitize(t) + if getmetatable(t) == packedmt then + -- Remove length tag + t.n = nil + end + return t +end + --- Add a filter step to the iterator pipeline. --- --- Example: @@ -208,12 +220,7 @@ function Iter.totable(self) break end - if type(args) == 'table' then - -- Removed packed table tag if it exists - args.__n = nil - end - - t[#t + 1] = args + t[#t + 1] = sanitize(args) end return t end @@ -221,12 +228,10 @@ end ---@private function ListIter.totable(self) if self._head == 1 and self._tail == #self._table + 1 and self.next == ListIter.next then - -- Remove any packed table tags - for i = 1, #self._table do - local v = self._table[i] - if type(v) == 'table' then - v.__n = nil - self._table[i] = v + -- Sanitize packed table values + if getmetatable(self._table[1]) == packedmt then + for i = 1, #self._table do + self._table[i] = sanitize(self._table[i]) end end return self._table diff --git a/runtime/lua/vim/lsp/protocol.lua b/runtime/lua/vim/lsp/protocol.lua index 2cb8fc7955..a7919f12f5 100644 --- a/runtime/lua/vim/lsp/protocol.lua +++ b/runtime/lua/vim/lsp/protocol.lua @@ -837,7 +837,7 @@ function protocol.make_client_capabilities() refreshSupport = true, }, didChangeWatchedFiles = { - dynamicRegistration = false, + dynamicRegistration = true, relativePatternSupport = true, }, }, diff --git a/src/nvim/CMakeLists.txt b/src/nvim/CMakeLists.txt index f15a255ec5..efa6b3620a 100755 --- a/src/nvim/CMakeLists.txt +++ b/src/nvim/CMakeLists.txt @@ -407,11 +407,14 @@ foreach(gen_cdef DO_NOT_DEFINE_EMPTY_ATTRIBUTES ${prop}) endif() endforeach() -get_target_property(prop main_lib INTERFACE_INCLUDE_DIRECTORIES) -foreach(gen_include ${prop}) - list(APPEND gen_cflags "-I${gen_include}") +get_directory_property(targets BUILDSYSTEM_TARGETS) +foreach(target ${targets}) + get_target_property(prop ${target} INTERFACE_INCLUDE_DIRECTORIES) + foreach(gen_include ${prop}) + list(APPEND gen_cflags "-I${gen_include}") + endforeach() endforeach() -list(APPEND gen_cflags "-I${DEPS_PREFIX}/include") + if(APPLE AND CMAKE_OSX_SYSROOT) list(APPEND gen_cflags "-isysroot") list(APPEND gen_cflags "${CMAKE_OSX_SYSROOT}") diff --git a/scripts/genvimvim.lua b/src/nvim/generators/gen_vimvim.lua index 18279d160e..09a7cab0c6 100644 --- a/scripts/genvimvim.lua +++ b/src/nvim/generators/gen_vimvim.lua @@ -1,17 +1,7 @@ local mpack = vim.mpack -if arg[1] == '--help' then - print('Usage: lua genvimvim.lua src/nvim runtime/syntax/vim/generated.vim') - os.exit(0) -end - -local nvimsrcdir = arg[1] -local syntax_file = arg[2] -local funcs_file = arg[3] - -package.path = nvimsrcdir .. '/?.lua;' .. package.path - -_G.vim = loadfile(nvimsrcdir..'/../../runtime/lua/vim/shared.lua')() +local syntax_file = arg[1] +local funcs_file = arg[2] local lld = {} local syn_fd = io.open(syntax_file, 'w') diff --git a/src/nvim/ui_client.c b/src/nvim/ui_client.c index e177c0a60d..b93b31f7dc 100644 --- a/src/nvim/ui_client.c +++ b/src/nvim/ui_client.c @@ -65,11 +65,7 @@ uint64_t ui_client_start_server(int argc, char **argv) #ifdef MSWIN os_open_conin_fd(); #else - int fd = dup(stderr_isatty ? STDERR_FILENO : STDOUT_FILENO); - if (fd < 0) { - return 0; - } - // FIXME: resource leak of fd + dup(stderr_isatty ? STDERR_FILENO : STDOUT_FILENO); #endif } diff --git a/src/nvim/version.c b/src/nvim/version.c index a9d72bf017..9dfc0c880d 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -389,7 +389,7 @@ static const int included_patches[] = { 2097, 2096, 2095, - // 2094, + 2094, // 2093, // 2092, 2091, @@ -656,7 +656,7 @@ static const int included_patches[] = { 1830, 1829, 1828, - // 1827, + 1827, 1826, 1825, 1824, diff --git a/test/functional/ex_cmds/make_spec.lua b/test/functional/ex_cmds/make_spec.lua index f42e21e4cb..8d903330b1 100644 --- a/test/functional/ex_cmds/make_spec.lua +++ b/test/functional/ex_cmds/make_spec.lua @@ -24,10 +24,8 @@ describe(':make', function() it('captures stderr & non zero exit code #14349', function () nvim('set_option', 'makeprg', testprg('shell-test')..' foo') local out = eval('execute("make")') - -- Make program exit code correctly captured - matches('\nshell returned 3', out) -- Error message is captured in the file and printed in the footer - matches('\n.*%: Unknown first argument%: foo', out) + matches('[\r\n]+.*[\r\n]+Unknown first argument%: foo[\r\n]+%(1 of 1%)%: Unknown first argument%: foo', out) end) it('captures stderr & zero exit code #14349', function () diff --git a/test/functional/helpers.lua b/test/functional/helpers.lua index 2e373467d0..6e668b22b0 100644 --- a/test/functional/helpers.lua +++ b/test/functional/helpers.lua @@ -552,7 +552,7 @@ function module.set_shell_powershell(fake) end local shell = found and (is_os('win') and 'powershell' or 'pwsh') or module.testprg('pwsh-test') local cmd = 'Remove-Item -Force '..table.concat(is_os('win') - and {'alias:cat', 'alias:echo', 'alias:sleep', 'alias:sort'} + and {'alias:cat', 'alias:echo', 'alias:sleep', 'alias:sort', 'alias:tee'} or {'alias:echo'}, ',')..';' module.exec([[ let &shell = ']]..shell..[[' @@ -562,7 +562,7 @@ function module.set_shell_powershell(fake) let &shellcmdflag .= '$PSDefaultParameterValues[''Out-File:Encoding'']=''utf8'';' let &shellcmdflag .= ']]..cmd..[[' let &shellredir = '2>&1 | %%{ "$_" } | Out-File %s; exit $LastExitCode' - let &shellpipe = '2>&1 | %%{ "$_" } | Tee-Object %s; exit $LastExitCode' + let &shellpipe = '2>&1 | %%{ "$_" } | tee %s; exit $LastExitCode' ]]) return found end diff --git a/test/functional/lua/vim_spec.lua b/test/functional/lua/vim_spec.lua index b8cc15b2ca..42927f7e1b 100644 --- a/test/functional/lua/vim_spec.lua +++ b/test/functional/lua/vim_spec.lua @@ -3416,6 +3416,41 @@ describe('lua stdlib', function() { item_3 = 'test' }, }, output) end) + + it('handles nil values', function() + local t = {1, 2, 3, 4, 5} + do + local it = vim.iter(t):enumerate():map(function(i, v) + if i % 2 == 0 then + return nil, v*v + end + return v, nil + end) + eq({ + { [1] = 1 }, + { [2] = 4 }, + { [1] = 3 }, + { [2] = 16 }, + { [1] = 5 }, + }, it:totable()) + end + + do + local it = vim.iter(ipairs(t)):map(function(i, v) + if i % 2 == 0 then + return nil, v*v + end + return v, nil + end) + eq({ + { [1] = 1 }, + { [2] = 4 }, + { [1] = 3 }, + { [2] = 16 }, + { [1] = 5 }, + }, it:totable()) + end + end) end) end) |