lsp: configure lua to ignore unused locals starting with '_'
This commit is contained in:
parent
5c641ce4d4
commit
0b64cf2329
1 changed files with 6 additions and 4 deletions
10
init.lua
10
init.lua
|
|
@ -201,7 +201,7 @@ local lsp = require("lspconfig")
|
||||||
|
|
||||||
-- Use an on_attach function to only map the following keys
|
-- Use an on_attach function to only map the following keys
|
||||||
-- after the language server attaches to the current buffer
|
-- after the language server attaches to the current buffer
|
||||||
local on_lsp_attach = function(client, bufnr)
|
local on_lsp_attach = function(_client, _bufnr)
|
||||||
vim.keymap.set("n", "gD", vim.lsp.buf.declaration)
|
vim.keymap.set("n", "gD", vim.lsp.buf.declaration)
|
||||||
vim.keymap.set("n", "gd", vim.lsp.buf.definition)
|
vim.keymap.set("n", "gd", vim.lsp.buf.definition)
|
||||||
vim.keymap.set("n", "K", vim.lsp.buf.hover)
|
vim.keymap.set("n", "K", vim.lsp.buf.hover)
|
||||||
|
|
@ -232,7 +232,10 @@ local servers = {
|
||||||
settings = {
|
settings = {
|
||||||
Lua = {
|
Lua = {
|
||||||
runtime = { version = "LuaJIT" },
|
runtime = { version = "LuaJIT" },
|
||||||
diagnostics = { globals = { "vim" } },
|
diagnostics = {
|
||||||
|
globals = { "vim" },
|
||||||
|
unusedLocalExclude = { "_*" },
|
||||||
|
},
|
||||||
workspace = {
|
workspace = {
|
||||||
library = vim.api.nvim_get_runtime_file("", true),
|
library = vim.api.nvim_get_runtime_file("", true),
|
||||||
},
|
},
|
||||||
|
|
@ -338,7 +341,6 @@ for ft, ft_linters in pairs(linters) do
|
||||||
lint.try_lint(nil, { ignore_errors = true })
|
lint.try_lint(nil, { ignore_errors = true })
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
lint.try_lint(nil, { ignore_errors = true })
|
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
@ -425,7 +427,7 @@ end
|
||||||
g.gitblame_enabled = 0
|
g.gitblame_enabled = 0
|
||||||
---- gitsigns.nvim
|
---- gitsigns.nvim
|
||||||
require("gitsigns").setup({
|
require("gitsigns").setup({
|
||||||
on_attach = function(bufnr)
|
on_attach = function(_bufnr)
|
||||||
local gs = package.loaded.gitsigns
|
local gs = package.loaded.gitsigns
|
||||||
|
|
||||||
-- Navigation
|
-- Navigation
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue