mirror of
https://github.com/jdhao/nvim-config.git
synced 2025-06-08 14:14:33 +02:00
Fix lua_ls diagnostic warnings
This commit is contained in:
parent
5502d29f40
commit
44e9e5a1ce
14
init.lua
14
init.lua
@ -14,15 +14,21 @@ vim.loader.enable()
|
|||||||
local version = vim.version
|
local version = vim.version
|
||||||
|
|
||||||
-- check if we have the latest stable version of nvim
|
-- check if we have the latest stable version of nvim
|
||||||
local expected_ver = "0.10.1"
|
local expected_ver_str = "0.10.1"
|
||||||
local expect_ver = version.parse(expected_ver)
|
local expect_ver = version.parse(expected_ver_str)
|
||||||
local actual_ver = version()
|
local actual_ver = vim.version()
|
||||||
|
|
||||||
|
if expect_ver == nil then
|
||||||
|
local msg = string.format("Unsupported version string: %s", expected_ver_str)
|
||||||
|
vim.api.nvim_err_writeln(msg)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
local result = version.cmp(expect_ver, actual_ver)
|
local result = version.cmp(expect_ver, actual_ver)
|
||||||
|
|
||||||
if result ~= 0 then
|
if result ~= 0 then
|
||||||
local _ver = string.format("%s.%s.%s", actual_ver.major, actual_ver.minor, actual_ver.patch)
|
local _ver = string.format("%s.%s.%s", actual_ver.major, actual_ver.minor, actual_ver.patch)
|
||||||
local msg = string.format("Expect nvim %s, but got %s instead. Use at your own risk!", expected_ver, _ver)
|
local msg = string.format("Expect nvim %s, but got %s instead. Use at your own risk!", expected_ver_str, _ver)
|
||||||
vim.api.nvim_err_writeln(msg)
|
vim.api.nvim_err_writeln(msg)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
local handler = function(virtText, lnum, endLnum, width, truncate)
|
local handler = function(virtText, lnum, endLnum, width, truncate)
|
||||||
local newVirtText = {}
|
local newVirtText = {}
|
||||||
local totalLines = vim.api.nvim_buf_line_count(0)
|
|
||||||
local foldedLines = endLnum - lnum
|
local foldedLines = endLnum - lnum
|
||||||
local suffix = (" %d"):format(foldedLines)
|
local suffix = (" %d"):format(foldedLines)
|
||||||
local sufWidth = vim.fn.strdisplaywidth(suffix)
|
local sufWidth = vim.fn.strdisplaywidth(suffix)
|
||||||
|
|||||||
@ -127,6 +127,7 @@ local get_active_lsp = function()
|
|||||||
end
|
end
|
||||||
|
|
||||||
for _, client in ipairs(clients) do
|
for _, client in ipairs(clients) do
|
||||||
|
---@diagnostic disable-next-line: undefined-field
|
||||||
local filetypes = client.config.filetypes
|
local filetypes = client.config.filetypes
|
||||||
if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then
|
if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then
|
||||||
return client.name
|
return client.name
|
||||||
@ -149,7 +150,7 @@ require("lualine").setup {
|
|||||||
lualine_b = {
|
lualine_b = {
|
||||||
{
|
{
|
||||||
"branch",
|
"branch",
|
||||||
fmt = function(name, context)
|
fmt = function(name, _)
|
||||||
-- truncate branch name in case the name is too long
|
-- truncate branch name in case the name is too long
|
||||||
return string.sub(name, 1, 20)
|
return string.sub(name, 1, 20)
|
||||||
end,
|
end,
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
local keymap = vim.keymap
|
local keymap = vim.keymap
|
||||||
local api = vim.api
|
|
||||||
local uv = vim.uv
|
local uv = vim.uv
|
||||||
|
|
||||||
-- Save key strokes (now we do not need to press shift to enter command mode).
|
-- Save key strokes (now we do not need to press shift to enter command mode).
|
||||||
@ -215,6 +214,9 @@ keymap.set("n", "<leader>cb", function()
|
|||||||
local cnt = 0
|
local cnt = 0
|
||||||
local blink_times = 7
|
local blink_times = 7
|
||||||
local timer = uv.new_timer()
|
local timer = uv.new_timer()
|
||||||
|
if timer == nil then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
timer:start(0, 100, vim.schedule_wrap(function()
|
timer:start(0, 100, vim.schedule_wrap(function()
|
||||||
vim.cmd [[
|
vim.cmd [[
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user