Closed tummetott closed 11 months ago
I looked into the issue by removing different parts of Feline step by step. I found that the problem is caused by the lsp/provider
module, specifically when using one of the built-in providers diagnostic_errors
, diagnostic_warnings
, diagnostic_hints
, or diagnostic_info
.
so the setup()
call of the minimal config can be refined to:
require('feline').setup {
components = {
active = { { {
provider = 'diagnostic_errors',
} } }
}
}
I proceeded by investigating the issue further. In doing so, I modified the feline/providers/lsp.lua
file. Initially, I removed all content and replaced it with a stub function to return dummy values. Surprisingly, the error disappeared. However, when I added an apparently unrelated line back in:
local M = {}
-- This unused handle creates the error
local lsp = vim.lsp
function M.diagnostic_errors()
return 'text', 'icon'
end
return M
The error reappeared. I'm puzzled by this behavior and unsure why it occurs.
While troubleshooting the problem, I found a temporary fix by loading the feline.providers.lsp
module explicitly before setting up feline:
require('feline.providers.lsp')
require('feline).setup( ... )
This made the error disappear. However, I'm determined to uncover the exact cause of the issue. It's puzzling that plugins like treesitter or catppuccin somehow contribute to triggering this error. My goal is to find a more solid and cleaner solution, avoiding the need for such a workaround.
(I split this issue into four parts to show how I traced the bug step by step. It took over a day to simplify my Neovim config and find the problem. This breakdown should help explain the process.)
Hello, thanks for reporting the issue: Can you try these minimal configs?
I'm not seeing the error with just feline. Want to make sure you're not as well.
NOTICE I'm enabling termguicolors (you will see an error w/o this)
Default Setup
for name, url in pairs({
feline = "https://github.com/freddiehaddad/feline.nvim",
}) do
local install_path = vim.fn.fnamemodify("nvim_issue/" .. name, ":p")
if vim.fn.isdirectory(install_path) == 0 then
vim.fn.system({ "git", "clone", "--depth=1", url, install_path })
end
vim.opt.runtimepath:append(install_path)
end
vim.opt.termguicolors = true
require("feline").setup()
Custom Setup
for name, url in pairs({
feline = "https://github.com/freddiehaddad/feline.nvim",
}) do
local install_path = vim.fn.fnamemodify("nvim_issue/" .. name, ":p")
if vim.fn.isdirectory(install_path) == 0 then
vim.fn.system({ "git", "clone", "--depth=1", url, install_path })
end
vim.opt.runtimepath:append(install_path)
end
vim.opt.termguicolors = true
require("feline").setup({
components = {
active = {
{ -- left
{ provider = "diagnostic_errors", },
},
},
},
})
I proceeded by investigating the issue further. In doing so, I modified the
feline/providers/lsp.lua
file. Initially, I removed all content and replaced it with a stub function to return dummy values. Surprisingly, the error disappeared. However, when I added an apparently unrelated line back in:local M = {} -- This unused handle creates the error local lsp = vim.lsp function M.diagnostic_errors() return 'text', 'icon' end return M
The error reappeared. I'm puzzled by this behavior and unsure why it occurs.
This might be related to missing nvim-web-devicons
plugin.
While troubleshooting the problem, I found a temporary fix by loading the
feline.providers.lsp
module explicitly before setting up feline:require('feline.providers.lsp') require('feline).setup( ... )
This made the error disappear. However, I'm determined to uncover the exact cause of the issue. It's puzzling that plugins like treesitter or catppuccin somehow contribute to triggering this error. My goal is to find a more solid and cleaner solution, avoiding the need for such a workaround.
(I split this issue into four parts to show how I traced the bug step by step. It took over a day to simplify my Neovim config and find the problem. This breakdown should help explain the process.)
In lsp.lua
there's a reference to a deprecated function: lsp.buf_get_clients
. I'm going to update that to use the replacement.
I'm not seeing how requiring that file would fix anything:
default_components.lua
:
{
provider = 'diagnostic_errors',
hl = { fg = 'red' },
},
The only way I can reproduce your error is to use a minimal config and not specify an icon
value in the provider:
Example:
for name, url in pairs({
feline = "https://github.com/freddiehaddad/feline.nvim",
}) do
local install_path = vim.fn.fnamemodify("nvim_issue/" .. name, ":p")
if vim.fn.isdirectory(install_path) == 0 then
vim.fn.system({ "git", "clone", "--depth=1", url, install_path })
end
vim.opt.runtimepath:append(install_path)
end
vim.opt.termguicolors = true
require("feline").setup({
components = {
active = {
{ -- left
{ provider = "file_info", icon = '' },
{ provider = "diagnostic_errors", icon = '' },
},
},
},
})
If I remove the icon = ''
portion, then the code attempts to load nvim-web-devicons
and the require
throws an error. I think I'll add a helpful error message for that particular problem. But we still need to confirm this is your situation.
Waiting for response from you regarding your results with the minimal configs I shared.
Hello, thanks for reporting the issue: Can you try these minimal configs?
I'm not seeing the error with just feline. Want to make sure you're not as well.
NOTICE I'm enabling termguicolors (you will see an error w/o this)
Default Setup
for name, url in pairs({ feline = "https://github.com/freddiehaddad/feline.nvim", }) do local install_path = vim.fn.fnamemodify("nvim_issue/" .. name, ":p") if vim.fn.isdirectory(install_path) == 0 then vim.fn.system({ "git", "clone", "--depth=1", url, install_path }) end vim.opt.runtimepath:append(install_path) end vim.opt.termguicolors = true require("feline").setup()
Custom Setup
for name, url in pairs({ feline = "https://github.com/freddiehaddad/feline.nvim", }) do local install_path = vim.fn.fnamemodify("nvim_issue/" .. name, ":p") if vim.fn.isdirectory(install_path) == 0 then vim.fn.system({ "git", "clone", "--depth=1", url, install_path }) end vim.opt.runtimepath:append(install_path) end vim.opt.termguicolors = true require("feline").setup({ components = { active = { { -- left { provider = "diagnostic_errors", }, }, }, }, })
No, there's no error with just Feline. I've thoroughly tested this.
(I'm also setting termguicolors in my minimal config)
I proceeded by investigating the issue further. In doing so, I modified the
feline/providers/lsp.lua
file. Initially, I removed all content and replaced it with a stub function to return dummy values. Surprisingly, the error disappeared. However, when I added an apparently unrelated line back in:local M = {} -- This unused handle creates the error local lsp = vim.lsp function M.diagnostic_errors() return 'text', 'icon' end return M
The error reappeared. I'm puzzled by this behavior and unsure why it occurs.
This might be related to missing
nvim-web-devicons
plugin.
How can this be? I'm not calling any provider which uses icons. I'm just calling a stub method which renders the string text icon
to the statusline
While troubleshooting the problem, I found a temporary fix by loading the
feline.providers.lsp
module explicitly before setting up feline:require('feline.providers.lsp') require('feline).setup( ... )
This made the error disappear. However, I'm determined to uncover the exact cause of the issue. It's puzzling that plugins like treesitter or catppuccin somehow contribute to triggering this error. My goal is to find a more solid and cleaner solution, avoiding the need for such a workaround. (I split this issue into four parts to show how I traced the bug step by step. It took over a day to simplify my Neovim config and find the problem. This breakdown should help explain the process.)
In
lsp.lua
there's a reference to a deprecated function:lsp.buf_get_clients
. I'm going to update that to use the replacement.I'm not seeing how requiring that file would fix anything:
default_components.lua
:{ provider = 'diagnostic_errors', hl = { fg = 'red' }, },
Like I said I removed everything from lsp.lua
and replaced it with a stub function (dummy function) which just returns two hard coded values. there is not actuall lsp call in the file. but the error still persists when local lsp = vim.lsp
is kept in the file
After looking at your original post again, I'm now wondering if your problem is this:
-- This is needed for reproduction of the error
vim.opt.foldmethod = 'expr'
See: https://github.com/neovim/neovim/issues/25608
Can you try commenting out that line? I guess you did since you explicitly say it's needed for repro.
And also try with the following:
vim.opt.foldmethod = 'expr'
-- https://github.com/neovim/neovim/issues/25608
vim.opt.foldexpr = 'nvim_treesitter#foldexpr()'
There's a regression I reported in Neovim v0.9.4. Not specific to Feline, it's a Treesitter bug and I think you're hitting that.
After looking at your original post again, I'm now wondering if your problem is this:
-- This is needed for reproduction of the error vim.opt.foldmethod = 'expr'
See: neovim/neovim#25608
Can you try commenting out that line?
And also try with the following:
vim.opt.foldmethod = 'expr' -- https://github.com/neovim/neovim/issues/25608 vim.opt.foldexpr = 'nvim_treesitter#foldexpr()'
Yes you need
vim.opt.foldmethod = 'expr'
in order to reproduce the bug. When i delete that line, no error is shown. I can add
vim.opt.foldexpr = 'nvim_treesitter#foldexpr()'
but this makes not difference. the bug persists.
can you reproduce the bug when you use my minimal config?
can you reproduce the bug when you use my minimal config?
I will try again now.
However, the only place where fold expression is used in Feline is for the statuscolumn. If you're only setting up the statusline, there's nothing in Feline that could be impacted by that setting. I'm struggling to find a correlation between that setting and Feline.
It seems more likely to be related to the Issue I shared and/or another Neovim regression.
Even with all your settings, I'm not getting the error:
for name, url in pairs({
feline = "https://github.com/freddiehaddad/feline.nvim",
treesitter = "https://github.com/nvim-treesitter/nvim-treesitter",
}) do
local install_path = vim.fn.fnamemodify("nvim_issue/" .. name, ":p")
if vim.fn.isdirectory(install_path) == 0 then
vim.fn.system({ "git", "clone", "--depth=1", url, install_path })
end
vim.opt.runtimepath:append(install_path)
end
vim.opt.termguicolors = true
vim.opt.foldmethod = "expr"
require("feline").setup({
components = {
active = {
{ -- left
-- { provider = "file_info", icon = "" },
-- { provider = "diagnostic_errors", icon = "" },
{ provider = "diagnostic_errors" },
},
},
},
})
require("nvim-treesitter.configs").setup({
highlight = { enable = true },
ensure_installed = { "lua" },
})
See the screenshot.. Opened with nvim --clean -u minimal.lua myfile.lua
I proceeded by investigating the issue further. In doing so, I modified the
feline/providers/lsp.lua
file. Initially, I removed all content and replaced it with a stub function to return dummy values. Surprisingly, the error disappeared. However, when I added an apparently unrelated line back in:local M = {} -- This unused handle creates the error local lsp = vim.lsp function M.diagnostic_errors() return 'text', 'icon' end return M
The error reappeared. I'm puzzled by this behavior and unsure why it occurs.
This might be related to missing
nvim-web-devicons
plugin.
Tried the same and am not able to repro. The local lsp = vim.lsp
doesn't create any issues for me.
I'll try on a MBP (work computer) later and see if this is a Mac issue. But I use feline on my MBP now without issue. Neovim is instaled with Homebrew.
Ok I can confirm that this issue is gone with nvim 0.10 nightly
and nvim 0.9.2
. So it must be an upstream issue of nvim 0.9.4
. Thanks for your help.
Did you check docs and existing issues?
Neovim version (nvim -v)
NVIM v0.9.4 Build type: Release LuaJIT 2.1.1696795921
Operating system/version
MacOs 13.4.1
Describe the bug
I've encountered a peculiar bug that's a bit challenging to articulate. Essentially, an error message appears at the top of the screen. While this error doesn't impede the functionality of Neovim, its presence can be somewhat bothersome. Reproducing the error is possible in various scenarios, but it consistently involves the usage of
feline
.Initially, I suspected
catppuccin
was the root cause and opened an issue there: link to the issue. However, upon further investigation, I discovered that the error also manifests with a minimal config containingfeline
,treesitter
.The error itself is truncated so basically no information is shown:
Steps To Reproduce
nvim --clean -u repro.lua
:qa<cr>
nvim --clean -u repro.lua newfile.lua
:lkdjflkdjf<cr>
-- > Error is shown
Expected Behavior
No error
Repro