Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecated function in example evil_lualine.lua #1246

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/evil_lualine.lua
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ ins_left {
function()
local msg = 'No Active Lsp'
local buf_ft = vim.api.nvim_buf_get_option(0, 'filetype')
Copy link

@iton0 iton0 May 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

vim.api.nvim_buf_get_option is also deprecated with nvim 0.10.
I believe that local buf_ft = vim.api.nvim_get_option_value('filetype', {}) should be used instead

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For better readability and be more specific defining the buffer, we can use local buf_ft = vim.api.nvim_get_option_value('filetype', { 'buf': 0 }), no?
The scope option it's not necessary because by default the use of buf implies {scope} is local.
Here is the documentation

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah the only adjustment is instead of 'buf' : 0 it should be buf = 0

local clients = vim.lsp.get_active_clients()
local clients = vim.lsp.get_clients()
if next(clients) == nil then
return msg
end
Expand Down
Loading