A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/neovim/neovim/issues/17878 below:

scope option of vim.diagnostic.open_float() does not respect option set in vim.diagnostic.config() · Issue #17878 · neovim/neovim · GitHub

Neovim version (nvim -v)
NVIM v0.7.0-dev+1332-ga490db5ba
Build type: Debug
LuaJIT 2.1.0-beta3
Compilation: /usr/bin/cc -DNVIM_TS_HAS_SET_MATCH_LIMIT -DNVIM_TS_HAS_SET_ALLOCATOR -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wdouble-promotion -Wmissing-noreturn -Wmissing-format-attribute -Wmissing-prototypes -Wimplicit-fallthrough -Wsuggest-attribute=pure -Wsuggest-attribute=const -Wsuggest-attribute=malloc -Wsuggest-attribute=cold -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=auto -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=1 -I/home/smith/GeneralCoding/neovim/build/config -I/home/smith/GeneralCoding/neovim/src -I/home/smith/GeneralCoding/neovim/.deps/usr/include -I/usr/include -I/home/smith/GeneralCoding/neovim/build/src/nvim/auto -I/home/smith/GeneralCoding/neovim/build/include
Compiled by smith@ThinkPad-L480

Features: +acl +iconv +tui
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/home/smith/neovim/share/nvim"

Run :checkhealth for more info
Vim (not Nvim) behaves the same?

no

Operating system/version

Manjaro Linux x86_64

Terminal name/version

alacritty 0.10.1 (2844606d)

$TERM environment variable

xterm-256color

Installation

Built from source

How to reproduce the issue

Set scope option in vim.diagnostic.config() to "cursor" or "buffer"

vim.diagnostic.config({
    float = {
        scope = "cursor"
    }
})

Create a lua file and paste this in it

local say_hello = function()
	print("hello")
end

If you have underlines on you will see that sumneko_lua server will complain about "say_hello" and "function" on line 1
Keep your cursor on either "say_hello" or "function" and run the following commands

:lua vim.diagnostic.open_float()
:lua vim.diagnostic.open_float({scope = "cursor"})

The latter works perfectly and shows only diagnostic under cursor but the former uses "line" scope and gives diagnostic for entire line. Even though we already set scope to "cursor" with vim.diagnostic.config()

Expected behavior

vim.diagnostic.open_float() should respect the scope option set in vim.diagnostic.config() and should have shown only diagnostics under cursor in both the commands.

Actual behavior

But actually the first command uses the scope = "line" while showing diagnostics


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4