diff options
-rw-r--r-- | contrib/flake.nix | 169 | ||||
-rw-r--r-- | runtime/lua/vim/lsp/protocol.lua | 26 | ||||
-rw-r--r-- | src/nvim/screen.c | 8 |
3 files changed, 121 insertions, 82 deletions
diff --git a/contrib/flake.nix b/contrib/flake.nix index 86e4b37cfa..d18534215c 100644 --- a/contrib/flake.nix +++ b/contrib/flake.nix @@ -3,93 +3,100 @@ inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + flake-utils.url = "github:numtide/flake-utils"; }; - outputs = { self, nixpkgs }: let - system = "x86_64-linux"; - legacyPkgs = nixpkgs.legacyPackages."${system}".pkgs; - pkgs = legacyPkgs; - in { - - packages."${system}" = rec { - - neovim = legacyPkgs.neovim-unwrapped.overrideAttrs(oa: { - version = "master"; - src = ../.; - - buildInputs = oa.buildInputs ++ ([ - pkgs.tree-sitter - ]); - - cmakeFlags = oa.cmakeFlags ++ [ - "-DUSE_BUNDLED=OFF" - ]; - }); - - # a development binary to help debug issues - neovim-debug = (neovim.override { - stdenv = pkgs.llvmPackages_latest.stdenv; - lua = pkgs.enableDebugging legacyPkgs.luajit; - }).overrideAttrs(oa:{ - cmakeBuildType="Debug"; - cmakeFlags = oa.cmakeFlags ++ [ - "-DMIN_LOG_LEVEL=0" - ]; - }); - - # for neovim developers, very slow - # brings development tools as well - neovim-developer = let - lib = nixpkgs.lib; - pythonEnv = legacyPkgs.python3; - luacheck = legacyPkgs.luaPackages.luacheck; + outputs = { self, nixpkgs, flake-utils }: + { + overlay = final: prev: + let + pkgs = nixpkgs.legacyPackages.${prev.system}; + in + rec { + neovim = pkgs.neovim-unwrapped.overrideAttrs (oa: { + version = "master"; + src = ../.; + + buildInputs = oa.buildInputs ++ ([ + pkgs.tree-sitter + ]); + + cmakeFlags = oa.cmakeFlags ++ [ + "-DUSE_BUNDLED=OFF" + ]; + }); + + # a development binary to help debug issues + neovim-debug = (neovim.override { + stdenv = if pkgs.stdenv.isLinux then pkgs.llvmPackages_latest.stdenv else pkgs.stdenv; + lua = pkgs.enableDebugging pkgs.luajit; + }).overrideAttrs (oa: { + cmakeBuildType = "Debug"; + cmakeFlags = oa.cmakeFlags ++ [ + "-DMIN_LOG_LEVEL=0" + ]; + }); + + # for neovim developers, very slow + # brings development tools as well + neovim-developer = + let + lib = nixpkgs.lib; + pythonEnv = pkgs.python3; + luacheck = pkgs.luaPackages.luacheck; + in + (neovim-debug.override ({ doCheck = pkgs.stdenv.isLinux; })).overrideAttrs (oa: { + cmakeFlags = oa.cmakeFlags ++ [ + "-DLUACHECK_PRG=${luacheck}/bin/luacheck" + "-DMIN_LOG_LEVEL=0" + "-DENABLE_LTO=OFF" + "-DUSE_BUNDLED=OFF" + ] ++ pkgs.stdenv.lib.optionals pkgs.stdenv.isLinux [ + # https://github.com/google/sanitizers/wiki/AddressSanitizerFlags + # https://clang.llvm.org/docs/AddressSanitizer.html#symbolizing-the-reports + "-DCLANG_ASAN_UBSAN=ON" + ]; + + nativeBuildInputs = oa.nativeBuildInputs ++ (with pkgs; [ + pythonEnv + include-what-you-use # for scripts/check-includes.py + jq # jq for scripts/vim-patch.sh -r + doxygen + ]); + + shellHook = oa.shellHook + '' + export NVIM_PYTHON_LOG_LEVEL=DEBUG + export NVIM_LOG_FILE=/tmp/nvim.log + + export ASAN_OPTIONS="log_path=./test.log:abort_on_error=1" + export UBSAN_OPTIONS=print_stacktrace=1 + ''; + }); + }; + } // + flake-utils.lib.eachDefaultSystem (system: + let + pkgs = import nixpkgs { + overlays = [ self.overlay ]; + inherit system; + }; in - (neovim-debug.override({doCheck = true;})).overrideAttrs(oa: { - cmakeFlags = oa.cmakeFlags ++ [ - "-DLUACHECK_PRG=${luacheck}/bin/luacheck" - "-DMIN_LOG_LEVEL=0" - "-DENABLE_LTO=OFF" - "-DUSE_BUNDLED=OFF" - # https://github.com/google/sanitizers/wiki/AddressSanitizerFlags - # https://clang.llvm.org/docs/AddressSanitizer.html#symbolizing-the-reports - "-DCLANG_ASAN_UBSAN=ON" - ]; - - nativeBuildInputs = oa.nativeBuildInputs ++ (with pkgs; [ - pythonEnv - include-what-you-use # for scripts/check-includes.py - jq # jq for scripts/vim-patch.sh -r - doxygen - ]); - - shellHook = oa.shellHook + '' - export NVIM_PYTHON_LOG_LEVEL=DEBUG - export NVIM_LOG_FILE=/tmp/nvim.log + rec { - export ASAN_OPTIONS="log_path=./test.log:abort_on_error=1" - export UBSAN_OPTIONS=print_stacktrace=1 - ''; - }); - }; + packages = with pkgs; { + inherit neovim neovim-debug neovim-developer; + }; - defaultPackage."${system}" = self.packages."${system}".neovim; + defaultPackage = pkgs.neovim; - overlay = final: prev: { - inherit (self.packages."${system}") neovim neovim-debug; - }; + apps = { + nvim = flake-utils.lib.mkApp { drv = pkgs.neovim; name = "nvim"; }; + nvim-debug = flake-utils.lib.mkApp { drv = pkgs.neovim-debug; name = "nvim"; }; + }; - apps."${system}" = let - mkApp = pkg: { - type = "app"; - program = pkg + "/bin/nvim"; - }; - in { - nvim = mkApp self.packages."${system}".neovim; - nvim-debug = mkApp self.packages."${system}".neovim-debug; - }; + defaultApp = apps.nvim; - defaultApp."${system}" = self.apps."${system}".nvim; - - devShell."${system}" = self.packages."${system}".neovim-developer; - }; + devShell = pkgs.neovim-developer; + } + ); } diff --git a/runtime/lua/vim/lsp/protocol.lua b/runtime/lua/vim/lsp/protocol.lua index b2d3d0641c..3e111c154a 100644 --- a/runtime/lua/vim/lsp/protocol.lua +++ b/runtime/lua/vim/lsp/protocol.lua @@ -34,6 +34,13 @@ local constants = { Hint = 4; }; + DiagnosticTag = { + -- Unused or unnecessary code + Unnecessary = 1; + -- Deprecated or obsolete code + Deprecated = 2; + }; + MessageType = { -- An error message. Error = 1; @@ -521,6 +528,13 @@ export interface TextDocumentClientCapabilities { publishDiagnostics?: { --Whether the clients accepts diagnostics with related information. relatedInformation?: boolean; + --Client supports the tag property to provide meta data about a diagnostic. + --Clients supporting tags have to handle unknown tags gracefully. + --Since 3.15.0 + tagSupport?: { + --The tags supported by this client + valueSet: DiagnosticTag[]; + }; }; --Capabilities specific to `textDocument/foldingRange` requests. -- @@ -706,6 +720,18 @@ function protocol.make_client_capabilities() dynamicRegistration = false; prepareSupport = true; }; + publishDiagnostics = { + relatedInformation = true; + tagSupport = { + valueSet = (function() + local res = {} + for k in ipairs(protocol.DiagnosticTag) do + if type(k) == 'number' then table.insert(res, k) end + end + return res + end)(); + }; + }; }; workspace = { symbol = { diff --git a/src/nvim/screen.c b/src/nvim/screen.c index a7fd2bfcc6..377e8f58fa 100644 --- a/src/nvim/screen.c +++ b/src/nvim/screen.c @@ -2665,7 +2665,7 @@ static int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, } } - //sign column + // sign column, this is hit until sign_idx reaches count if (draw_state == WL_SIGN - 1 && n_extra == 0) { draw_state = WL_SIGN; /* Show the sign column when there are any signs in this @@ -4347,6 +4347,10 @@ void screen_adjust_grid(ScreenGrid **grid, int *row_off, int *col_off) // Get information needed to display the sign in line 'lnum' in window 'wp'. // If 'nrcol' is TRUE, the sign is going to be displayed in the number column. // Otherwise the sign is going to be displayed in the sign column. +// +// @param count max number of signs +// @param[out] n_extrap number of characters from pp_extra to display +// @param[in, out] sign_idxp Index of the displayed sign static void get_sign_display_info( bool nrcol, win_T *wp, @@ -4423,6 +4427,8 @@ static void get_sign_display_info( (*sign_idxp)++; if (*sign_idxp < count) { *draw_statep = WL_SIGN - 1; + } else { + *sign_idxp = 0; } } |