diff options
-rw-r--r-- | CMakeLists.txt | 1 | ||||
-rw-r--r-- | cmake.deps/cmake/BuildLuajit.cmake | 8 | ||||
-rw-r--r-- | cmake.deps/cmake/RemoveFiles.cmake | 5 | ||||
-rw-r--r-- | cmake/Find.cmake | 39 | ||||
-rw-r--r-- | cmake/FindIconv.cmake | 4 | ||||
-rw-r--r-- | cmake/FindLibtermkey.cmake | 4 | ||||
-rw-r--r-- | cmake/FindLibuv.cmake | 4 | ||||
-rw-r--r-- | cmake/FindLibvterm.cmake | 4 | ||||
-rw-r--r-- | cmake/FindLpeg.cmake | 2 | ||||
-rw-r--r-- | cmake/FindLuajit.cmake | 4 | ||||
-rw-r--r-- | cmake/FindLuv.cmake | 4 | ||||
-rw-r--r-- | cmake/FindMsgpack.cmake | 4 | ||||
-rw-r--r-- | cmake/FindTreesitter.cmake | 4 | ||||
-rw-r--r-- | cmake/FindUnibilium.cmake | 4 | ||||
-rw-r--r-- | runtime/doc/lsp.txt | 6 | ||||
-rw-r--r-- | runtime/doc/news-0.9.txt | 2 | ||||
-rw-r--r-- | runtime/doc/news.txt | 4 | ||||
-rw-r--r-- | runtime/lua/man.lua | 2 | ||||
-rw-r--r-- | runtime/lua/vim/lsp/_snippet_grammar.lua | 2 | ||||
-rw-r--r-- | runtime/lua/vim/lsp/buf.lua | 2 | ||||
-rw-r--r-- | runtime/lua/vim/lsp/handlers.lua | 8 | ||||
-rw-r--r-- | runtime/lua/vim/lsp/sync.lua | 2 | ||||
-rw-r--r-- | runtime/lua/vim/lsp/util.lua | 2 | ||||
-rw-r--r-- | scripts/gen_lsp.lua | 4 |
24 files changed, 77 insertions, 48 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index f0303be3eb..1ca6e7ce59 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,6 +31,7 @@ include(FindPackageHandleStandardArgs) include(GNUInstallDirs) include(Deps) +include(Find) include(InstallHelpers) include(PreventInTreeBuilds) include(Util) diff --git a/cmake.deps/cmake/BuildLuajit.cmake b/cmake.deps/cmake/BuildLuajit.cmake index c0f9c1ab8e..e97d773c3c 100644 --- a/cmake.deps/cmake/BuildLuajit.cmake +++ b/cmake.deps/cmake/BuildLuajit.cmake @@ -141,11 +141,3 @@ elseif(MSVC) else() message(FATAL_ERROR "Trying to build luajit in an unsupported system ${CMAKE_SYSTEM_NAME}/${CMAKE_C_COMPILER_ID}") endif() - -if (NOT MSVC) - add_custom_target(clean_shared_libraries_luajit ALL - COMMAND ${CMAKE_COMMAND} - -D REMOVE_FILE_GLOB=${DEPS_LIB_DIR}/${CMAKE_SHARED_LIBRARY_PREFIX}*${CMAKE_SHARED_LIBRARY_SUFFIX}* - -P ${PROJECT_SOURCE_DIR}/cmake/RemoveFiles.cmake) - add_dependencies(clean_shared_libraries_luajit luajit) -endif() diff --git a/cmake.deps/cmake/RemoveFiles.cmake b/cmake.deps/cmake/RemoveFiles.cmake deleted file mode 100644 index 88e2bc70a6..0000000000 --- a/cmake.deps/cmake/RemoveFiles.cmake +++ /dev/null @@ -1,5 +0,0 @@ -file(GLOB_RECURSE FILES_TO_REMOVE ${REMOVE_FILE_GLOB}) - -if(FILES_TO_REMOVE) - file(REMOVE ${FILES_TO_REMOVE}) -endif() diff --git a/cmake/Find.cmake b/cmake/Find.cmake new file mode 100644 index 0000000000..b363052510 --- /dev/null +++ b/cmake/Find.cmake @@ -0,0 +1,39 @@ +# Functions to aid the built-in find_ functions + +# Same as find_path, but always search in .deps directory first and then everything else. +function(find_path2) + find_path_nvim(${ARGV}) + find_path(${ARGV}) +endfunction() + +function(find_path_nvim) + set(CMAKE_FIND_FRAMEWORK NEVER) + set(CMAKE_FIND_APPBUNDLE NEVER) + find_path(${ARGV} NO_CMAKE_SYSTEM_PATH NO_CMAKE_ENVIRONMENT_PATH NO_SYSTEM_ENVIRONMENT_PATH) +endfunction() + +# Same as find_library, but with the following search order: +# 1. Only search in .deps directory. Only search for static libraries. +# 2. Only search in .deps directory. Search all libraries +# 3. Search everywhere, all libraries +function(find_library2) + find_library_nvim(STATIC ${ARGV}) + find_library_nvim(${ARGV}) + find_library(${ARGV}) +endfunction() + +function(find_library_nvim) + cmake_parse_arguments(ARG + "STATIC" + "" + "" + ${ARGN}) + list(REMOVE_ITEM ARGN STATIC) + + if(ARG_STATIC) + set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_STATIC_LIBRARY_SUFFIX}) + endif() + set(CMAKE_FIND_FRAMEWORK NEVER) + set(CMAKE_FIND_APPBUNDLE NEVER) + find_library(${ARGN} NO_CMAKE_SYSTEM_PATH NO_CMAKE_ENVIRONMENT_PATH NO_SYSTEM_ENVIRONMENT_PATH) +endfunction() diff --git a/cmake/FindIconv.cmake b/cmake/FindIconv.cmake index 48c1514ff2..e607c59cf6 100644 --- a/cmake/FindIconv.cmake +++ b/cmake/FindIconv.cmake @@ -1,8 +1,8 @@ # TODO(dundargoc): FindIconv is shipped by default on cmake version 3.11+. This # file can be removed once we decide to upgrade minimum cmake version. -find_path(ICONV_INCLUDE_DIR NAMES iconv.h) -find_library(ICONV_LIBRARY NAMES iconv libiconv) +find_path2(ICONV_INCLUDE_DIR NAMES iconv.h) +find_library2(ICONV_LIBRARY NAMES iconv libiconv) find_package_handle_standard_args(Iconv DEFAULT_MSG ICONV_INCLUDE_DIR) mark_as_advanced(ICONV_INCLUDE_DIR ICONV_LIBRARY) diff --git a/cmake/FindLibtermkey.cmake b/cmake/FindLibtermkey.cmake index 1fc8ac78f2..8039ae7994 100644 --- a/cmake/FindLibtermkey.cmake +++ b/cmake/FindLibtermkey.cmake @@ -1,5 +1,5 @@ -find_path(LIBTERMKEY_INCLUDE_DIR termkey.h) -find_library(LIBTERMKEY_LIBRARY NAMES termkey) +find_path2(LIBTERMKEY_INCLUDE_DIR termkey.h) +find_library2(LIBTERMKEY_LIBRARY NAMES termkey) find_package_handle_standard_args(Libtermkey DEFAULT_MSG LIBTERMKEY_LIBRARY LIBTERMKEY_INCLUDE_DIR) mark_as_advanced(LIBTERMKEY_INCLUDE_DIR LIBTERMKEY_LIBRARY) diff --git a/cmake/FindLibuv.cmake b/cmake/FindLibuv.cmake index fa1d51370f..19315388dd 100644 --- a/cmake/FindLibuv.cmake +++ b/cmake/FindLibuv.cmake @@ -1,5 +1,5 @@ -find_path(LIBUV_INCLUDE_DIR uv.h) -find_library(LIBUV_LIBRARY NAMES uv_a uv) +find_path2(LIBUV_INCLUDE_DIR uv.h) +find_library2(LIBUV_LIBRARY NAMES uv_a uv) set(LIBUV_LIBRARIES ${LIBUV_LIBRARY}) diff --git a/cmake/FindLibvterm.cmake b/cmake/FindLibvterm.cmake index ad2e682b30..f591f6853f 100644 --- a/cmake/FindLibvterm.cmake +++ b/cmake/FindLibvterm.cmake @@ -1,5 +1,5 @@ -find_path(LIBVTERM_INCLUDE_DIR vterm.h) -find_library(LIBVTERM_LIBRARY vterm) +find_path2(LIBVTERM_INCLUDE_DIR vterm.h) +find_library2(LIBVTERM_LIBRARY vterm) if(LIBVTERM_INCLUDE_DIR AND EXISTS "${LIBVTERM_INCLUDE_DIR}/vterm.h") file(STRINGS ${LIBVTERM_INCLUDE_DIR}/vterm.h VTERM_VERSION_MAJOR REGEX "#define VTERM_VERSION_MAJOR") diff --git a/cmake/FindLpeg.cmake b/cmake/FindLpeg.cmake index 43c839da9a..3d0ff5929d 100644 --- a/cmake/FindLpeg.cmake +++ b/cmake/FindLpeg.cmake @@ -1,4 +1,4 @@ -find_library(LPEG_LIBRARY NAMES lpeg_a lpeg liblpeg_a lpeg${CMAKE_SHARED_LIBRARY_SUFFIX} PATH_SUFFIXES lua/5.1) +find_library2(LPEG_LIBRARY NAMES lpeg_a lpeg liblpeg_a lpeg${CMAKE_SHARED_LIBRARY_SUFFIX} PATH_SUFFIXES lua/5.1) find_package_handle_standard_args(Lpeg DEFAULT_MSG LPEG_LIBRARY) mark_as_advanced(LPEG_LIBRARY) diff --git a/cmake/FindLuajit.cmake b/cmake/FindLuajit.cmake index f06b7ca6ad..457ceafdd4 100644 --- a/cmake/FindLuajit.cmake +++ b/cmake/FindLuajit.cmake @@ -1,4 +1,4 @@ -find_path(LUAJIT_INCLUDE_DIR luajit.h +find_path2(LUAJIT_INCLUDE_DIR luajit.h PATH_SUFFIXES luajit-2.1) if(MSVC) @@ -9,7 +9,7 @@ else() list(APPEND LUAJIT_NAMES luajit-5.1) endif() -find_library(LUAJIT_LIBRARY NAMES ${LUAJIT_NAMES}) +find_library2(LUAJIT_LIBRARY NAMES ${LUAJIT_NAMES}) find_package_handle_standard_args(Luajit DEFAULT_MSG LUAJIT_LIBRARY LUAJIT_INCLUDE_DIR) diff --git a/cmake/FindLuv.cmake b/cmake/FindLuv.cmake index 7544859ceb..a4408fe659 100644 --- a/cmake/FindLuv.cmake +++ b/cmake/FindLuv.cmake @@ -1,5 +1,5 @@ -find_path(LUV_INCLUDE_DIR luv/luv.h PATH_SUFFIXES lua5.1) -find_library(LUV_LIBRARY NAMES luv_a luv libluv_a luv${CMAKE_SHARED_LIBRARY_SUFFIX} PATH_SUFFIXES lua/5.1) +find_path2(LUV_INCLUDE_DIR luv/luv.h PATH_SUFFIXES lua5.1) +find_library2(LUV_LIBRARY NAMES luv_a luv libluv_a luv${CMAKE_SHARED_LIBRARY_SUFFIX} PATH_SUFFIXES lua/5.1) find_package_handle_standard_args(Luv DEFAULT_MSG LUV_LIBRARY LUV_INCLUDE_DIR) diff --git a/cmake/FindMsgpack.cmake b/cmake/FindMsgpack.cmake index a2b0174f8d..9ef18122ab 100644 --- a/cmake/FindMsgpack.cmake +++ b/cmake/FindMsgpack.cmake @@ -1,4 +1,4 @@ -find_path(MSGPACK_INCLUDE_DIR msgpack/version_master.h) +find_path2(MSGPACK_INCLUDE_DIR msgpack/version_master.h) if(MSGPACK_INCLUDE_DIR) file(READ ${MSGPACK_INCLUDE_DIR}/msgpack/version_master.h msgpack_version_h) @@ -10,7 +10,7 @@ else() set(MSGPACK_VERSION_STRING) endif() -find_library(MSGPACK_LIBRARY NAMES msgpackc msgpack msgpackc_import msgpack-c +find_library2(MSGPACK_LIBRARY NAMES msgpackc msgpack msgpackc_import msgpack-c NAMES_PER_DIR) mark_as_advanced(MSGPACK_INCLUDE_DIR MSGPACK_LIBRARY) diff --git a/cmake/FindTreesitter.cmake b/cmake/FindTreesitter.cmake index 23214283c0..8dac13337b 100644 --- a/cmake/FindTreesitter.cmake +++ b/cmake/FindTreesitter.cmake @@ -1,5 +1,5 @@ -find_path(TREESITTER_INCLUDE_DIR tree_sitter/api.h) -find_library(TREESITTER_LIBRARY NAMES tree-sitter) +find_path2(TREESITTER_INCLUDE_DIR tree_sitter/api.h) +find_library2(TREESITTER_LIBRARY NAMES tree-sitter) find_package_handle_standard_args(Treesitter DEFAULT_MSG TREESITTER_LIBRARY TREESITTER_INCLUDE_DIR) mark_as_advanced(TREESITTER_LIBRARY TREESITTER_INCLUDE_DIR) diff --git a/cmake/FindUnibilium.cmake b/cmake/FindUnibilium.cmake index 91906e6660..4f62815793 100644 --- a/cmake/FindUnibilium.cmake +++ b/cmake/FindUnibilium.cmake @@ -1,5 +1,5 @@ -find_path(UNIBILIUM_INCLUDE_DIR unibilium.h) -find_library(UNIBILIUM_LIBRARY unibilium) +find_path2(UNIBILIUM_INCLUDE_DIR unibilium.h) +find_library2(UNIBILIUM_LIBRARY unibilium) find_package_handle_standard_args(Unibilium REQUIRED_VARS UNIBILIUM_INCLUDE_DIR UNIBILIUM_LIBRARY) diff --git a/runtime/doc/lsp.txt b/runtime/doc/lsp.txt index 10e1a2c2c5..8a0b144e83 100644 --- a/runtime/doc/lsp.txt +++ b/runtime/doc/lsp.txt @@ -444,7 +444,7 @@ The server will typically provide one token per identifier in the source code. The token will have a `type` such as "function" or "variable", and 0 or more `modifier`s such as "readonly" or "deprecated." The standard types and modifiers are described here: -https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_semanticTokens +https://microsoft.github.io/language-server-protocol/specification/#textDocument_semanticTokens LSP servers may also use off-spec types and modifiers. The LSP client adds one or more highlights for each token. The highlight @@ -1232,7 +1232,7 @@ format({options}) *vim.lsp.buf.format()* optional fields: • formatting_options (table|nil): Can be used to specify FormattingOptions. Some unspecified options will be - automatically derived from the current Nvim options. See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#formattingOptions + automatically derived from the current Nvim options. See https://microsoft.github.io/language-server-protocol/specification/#formattingOptions • timeout_ms (integer|nil, default 1000): Time in milliseconds to block for formatting requests. No effect if async=true @@ -1654,7 +1654,7 @@ buf_highlight_references({bufnr}, {references}, {offset_encoding}) • {offset_encoding} (string) One of "utf-8", "utf-16", "utf-32". See also: ~ - • https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocumentContentChangeEvent + • https://microsoft.github.io/language-server-protocol/specification/#textDocumentContentChangeEvent *vim.lsp.util.character_offset()* character_offset({buf}, {row}, {col}, {offset_encoding}) diff --git a/runtime/doc/news-0.9.txt b/runtime/doc/news-0.9.txt index 33733822ea..789bc9e0bc 100644 --- a/runtime/doc/news-0.9.txt +++ b/runtime/doc/news-0.9.txt @@ -160,7 +160,7 @@ The following new APIs or features were added. `workspace.didChangeWatchedFiles.dynamicRegistration=true` capability. • |vim.diagnostic| now supports LSP DiagnosticsTag. - See: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#diagnosticTag + See: https://microsoft.github.io/language-server-protocol/specification/#diagnosticTag • |vim.diagnostic.is_disabled()| checks if diagnostics are disabled in a given buffer or namespace. diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt index 0becf7ac6d..d55f43ce89 100644 --- a/runtime/doc/news.txt +++ b/runtime/doc/news.txt @@ -126,9 +126,9 @@ The following new APIs and features were added. • LSP • LSP method names are available in |vim.lsp.protocol.Methods|. • Implemented LSP inlay hints: |vim.lsp.inlay_hint()| - https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_inlayHint + https://microsoft.github.io/language-server-protocol/specification/#textDocument_inlayHint • Implemented pull diagnostic textDocument/diagnostic: |vim.lsp.diagnostic.on_diagnostic()| - https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_diagnostic + https://microsoft.github.io/language-server-protocol/specification/#textDocument_diagnostic • Added |vim.lsp.status()| to consume the last progress messages as a string. • LSP client now always saves and restores named buffer marks when applying text edits. diff --git a/runtime/lua/man.lua b/runtime/lua/man.lua index f2bd79aca8..dcdfc2b87f 100644 --- a/runtime/lua/man.lua +++ b/runtime/lua/man.lua @@ -415,7 +415,7 @@ end local function set_options(pager) vim.bo.swapfile = false vim.bo.buftype = 'nofile' - vim.bo.bufhidden = 'hide' + vim.bo.bufhidden = 'unload' vim.bo.modified = false vim.bo.readonly = true vim.bo.modifiable = false diff --git a/runtime/lua/vim/lsp/_snippet_grammar.lua b/runtime/lua/vim/lsp/_snippet_grammar.lua index eb72efdf39..0a4d669fb9 100644 --- a/runtime/lua/vim/lsp/_snippet_grammar.lua +++ b/runtime/lua/vim/lsp/_snippet_grammar.lua @@ -1,4 +1,4 @@ ---- Grammar for LSP snippets, based on https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#snippet_syntax +--- Grammar for LSP snippets, based on https://microsoft.github.io/language-server-protocol/specification/#snippet_syntax local lpeg = vim.lpeg local P, S, R, V = lpeg.P, lpeg.S, lpeg.R, lpeg.V diff --git a/runtime/lua/vim/lsp/buf.lua b/runtime/lua/vim/lsp/buf.lua index a906512e24..9436fbbf56 100644 --- a/runtime/lua/vim/lsp/buf.lua +++ b/runtime/lua/vim/lsp/buf.lua @@ -159,7 +159,7 @@ end --- - formatting_options (table|nil): --- Can be used to specify FormattingOptions. Some unspecified options will be --- automatically derived from the current Nvim options. ---- See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#formattingOptions +--- See https://microsoft.github.io/language-server-protocol/specification/#formattingOptions --- - timeout_ms (integer|nil, default 1000): --- Time in milliseconds to block for formatting requests. No effect if async=true --- - bufnr (number|nil): diff --git a/runtime/lua/vim/lsp/handlers.lua b/runtime/lua/vim/lsp/handlers.lua index d43d9a7cfa..d153b956ee 100644 --- a/runtime/lua/vim/lsp/handlers.lua +++ b/runtime/lua/vim/lsp/handlers.lua @@ -476,7 +476,7 @@ function M.signature_help(_, result, ctx, config) vim.tbl_get(client.server_capabilities, 'signatureHelpProvider', 'triggerCharacters') local ft = vim.bo[ctx.bufnr].filetype local lines, hl = util.convert_signature_help_to_markdown_lines(result, ft, triggers) - if vim.tbl_isempty(lines) then + if not lines or vim.tbl_isempty(lines) then if config.silent ~= true then print('No signature help available') end @@ -484,7 +484,9 @@ function M.signature_help(_, result, ctx, config) end local fbuf, fwin = util.open_floating_preview(lines, 'markdown', config) if hl then - api.nvim_buf_add_highlight(fbuf, -1, 'LspSignatureActiveParameter', 0, unpack(hl)) + -- Highlight the second line if the signature is wrapped in a Markdown code block. + local line = vim.startswith(lines[1], '```') and 1 or 0 + api.nvim_buf_add_highlight(fbuf, -1, 'LspSignatureActiveParameter', line, unpack(hl)) end return fbuf, fwin end @@ -623,7 +625,7 @@ M[ms.window_showDocument] = function(_, result, ctx, _) return { success = success or false } end ----@see https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#workspace_inlayHint_refresh +---@see https://microsoft.github.io/language-server-protocol/specification/#workspace_inlayHint_refresh M[ms.workspace_inlayHint_refresh] = function(err, result, ctx, config) return require('vim.lsp.inlay_hint').on_refresh(err, result, ctx, config) end diff --git a/runtime/lua/vim/lsp/sync.lua b/runtime/lua/vim/lsp/sync.lua index 9c1bbf3892..ca01cdc08b 100644 --- a/runtime/lua/vim/lsp/sync.lua +++ b/runtime/lua/vim/lsp/sync.lua @@ -387,7 +387,7 @@ end ---@param lastline integer line to begin search in old_lines for last difference ---@param new_lastline integer line to begin search in new_lines for last difference ---@param offset_encoding string encoding requested by language server ----@return table TextDocumentContentChangeEvent see https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocumentContentChangeEvent +---@return table TextDocumentContentChangeEvent see https://microsoft.github.io/language-server-protocol/specification/#textDocumentContentChangeEvent function M.compute_diff( prev_lines, curr_lines, diff --git a/runtime/lua/vim/lsp/util.lua b/runtime/lua/vim/lsp/util.lua index 7e6855528a..d525cae4c0 100644 --- a/runtime/lua/vim/lsp/util.lua +++ b/runtime/lua/vim/lsp/util.lua @@ -1829,7 +1829,7 @@ do --[[ References ]] ---@param bufnr integer Buffer id ---@param references table List of `DocumentHighlight` objects to highlight ---@param offset_encoding string One of "utf-8", "utf-16", "utf-32". - ---@see https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocumentContentChangeEvent + ---@see https://microsoft.github.io/language-server-protocol/specification/#textDocumentContentChangeEvent function M.buf_highlight_references(bufnr, references, offset_encoding) validate({ bufnr = { bufnr, 'n', true }, diff --git a/scripts/gen_lsp.lua b/scripts/gen_lsp.lua index 66369a8446..6ff8dcb3f4 100644 --- a/scripts/gen_lsp.lua +++ b/scripts/gen_lsp.lua @@ -35,7 +35,7 @@ end -- Gets the Lua symbol for a given fully-qualified LSP method name. local function name(s) - -- "$/" prefix is special: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#dollarRequests + -- "$/" prefix is special: https://microsoft.github.io/language-server-protocol/specification/#dollarRequests return s:gsub('^%$', 'dollar'):gsub('/', '_') end @@ -44,7 +44,7 @@ local function gen_methods(protocol) '-- Generated by gen_lsp.lua, keep at end of file.', '--- LSP method names.', '---', - '---@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#metaModel', + '---@see https://microsoft.github.io/language-server-protocol/specification/#metaModel', 'protocol.Methods = {', } local indent = (' '):rep(2) |