Update diagnostic settings for nvim
parent
774d6d028e
commit
58f395081f
|
@ -39,8 +39,6 @@ return require("packer").startup {
|
|||
-- Tools
|
||||
use "direnv/direnv.vim" -- Integration with Direnv
|
||||
use "vim-test/vim-test" -- Running tests from vim
|
||||
use "dense-analysis/ale" -- Asynchronous Lint Engine - used for linting, not for LSP
|
||||
use "nathunsmitty/nvim-ale-diagnostic" -- Neovim LSP + ALE integration
|
||||
use "mfussenegger/nvim-dap" -- Debug Adapter Protocol
|
||||
use "rcarriga/nvim-dap-ui" -- UI components for DAP
|
||||
use "theHamsta/nvim-dap-virtual-text" -- Virtual text display for DAP
|
||||
|
@ -87,6 +85,7 @@ return require("packer").startup {
|
|||
use "quangnguyen30192/cmp-nvim-ultisnips" -- Ultisnips source for nvim-cmp
|
||||
use "hrsh7th/nvim-cmp" -- completion integration
|
||||
use "nvim-lua/lsp_extensions.nvim" -- LSP extensions (like closing labels for Dart)
|
||||
use "jose-elias-alvarez/null-ls.nvim" -- Linting and formatting
|
||||
|
||||
-- LSP language specific
|
||||
use "tjdevries/nlua.nvim" -- Built-in Lua integration with LSP
|
||||
|
|
|
@ -2,17 +2,58 @@
|
|||
-- - LSP diagnostics config -
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
require("nvim-ale-diagnostic")
|
||||
local null_ls = require('null-ls')
|
||||
|
||||
vim.lsp.handlers["textDocument/publishDiagnostics"] =
|
||||
vim.lsp.with(
|
||||
vim.lsp.diagnostic.on_publish_diagnostics,
|
||||
{
|
||||
underline = false,
|
||||
virtual_text = false,
|
||||
signs = true,
|
||||
update_in_insert = false
|
||||
}
|
||||
)
|
||||
null_ls.setup({
|
||||
sources = {
|
||||
-- Python
|
||||
null_ls.builtins.diagnostics.flake8,
|
||||
null_ls.builtins.formatting.isort,
|
||||
null_ls.builtins.formatting.autopep8,
|
||||
|
||||
vim.g.diagnostic_enable_virtual_text = 1
|
||||
-- Kotlin
|
||||
null_ls.builtins.formatting.ktlint,
|
||||
null_ls.builtins.diagnostics.ktlint,
|
||||
|
||||
-- C++ and C
|
||||
null_ls.builtins.formatting.clang_format,
|
||||
|
||||
-- Cmake
|
||||
null_ls.builtins.formatting.cmake_format,
|
||||
|
||||
-- Lua
|
||||
null_ls.builtins.formatting.lua_format,
|
||||
|
||||
-- Dart
|
||||
null_ls.builtins.formatting.dart_format,
|
||||
|
||||
-- Go
|
||||
null_ls.builtins.formatting.gofmt,
|
||||
|
||||
-- Rust
|
||||
null_ls.builtins.formatting.rustfmt,
|
||||
|
||||
-- Java
|
||||
null_ls.builtins.formatting.google_java_format,
|
||||
|
||||
-- General
|
||||
null_ls.builtins.formatting.trim_newlines,
|
||||
null_ls.builtins.formatting.trim_whitespace,
|
||||
null_ls.builtins.hover.dictionary,
|
||||
},
|
||||
on_attach = function(client)
|
||||
if client.resolved_capabilities.document_formatting then
|
||||
vim.cmd([[
|
||||
augroup LspFormatting
|
||||
autocmd! * <buffer>
|
||||
autocmd BufWritePre <buffer> lua vim.lsp.buf.formatting_seq_sync()
|
||||
augroup END
|
||||
]])
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
vim.keymap.set("n", "]w", vim.diagnostic.goto_next)
|
||||
vim.keymap.set("n", "[w", vim.diagnostic.goto_prev)
|
||||
vim.api.nvim_create_user_command("Warnings", vim.diagnostic.setloclist, {})
|
||||
vim.api.nvim_create_user_command("Format", vim.lsp.buf.formatting, {})
|
||||
|
|
|
@ -12,81 +12,55 @@ M.on_attach = function(client, bufnr)
|
|||
vim.keymap.set(
|
||||
"n",
|
||||
"<C-]>",
|
||||
function()
|
||||
vim.lsp.buf.definition()
|
||||
end,
|
||||
vim.lsp.buf.definition,
|
||||
opts
|
||||
)
|
||||
vim.keymap.set(
|
||||
"n",
|
||||
"gD",
|
||||
function()
|
||||
vim.lsp.buf.declaration()
|
||||
end,
|
||||
vim.lsp.buf.declaration,
|
||||
opts
|
||||
)
|
||||
vim.keymap.set(
|
||||
"n",
|
||||
"gr",
|
||||
function()
|
||||
vim.lsp.buf.references()
|
||||
end,
|
||||
vim.lsp.buf.references,
|
||||
opts
|
||||
)
|
||||
vim.keymap.set(
|
||||
"n",
|
||||
"gi",
|
||||
function()
|
||||
vim.lsp.buf.implementation()
|
||||
end,
|
||||
vim.lsp.buf.implementation,
|
||||
opts
|
||||
)
|
||||
vim.keymap.set(
|
||||
"n",
|
||||
"<Leader>rn",
|
||||
function()
|
||||
vim.lsp.buf.rename()
|
||||
end,
|
||||
vim.lsp.buf.rename,
|
||||
opts
|
||||
)
|
||||
vim.keymap.set(
|
||||
"n",
|
||||
"<C-k>",
|
||||
function()
|
||||
vim.lsp.buf.signature_help()
|
||||
end,
|
||||
vim.lsp.buf.signature_help,
|
||||
opts
|
||||
)
|
||||
vim.keymap.set(
|
||||
"n",
|
||||
"K",
|
||||
function()
|
||||
vim.lsp.buf.hover()
|
||||
end,
|
||||
vim.lsp.buf.hover,
|
||||
opts
|
||||
)
|
||||
vim.keymap.set(
|
||||
"n",
|
||||
"<A-CR>",
|
||||
function()
|
||||
vim.lsp.buf.code_action()
|
||||
end,
|
||||
vim.lsp.buf.code_action,
|
||||
opts
|
||||
)
|
||||
vim.keymap.set(
|
||||
"n",
|
||||
"<Leader>ac",
|
||||
function()
|
||||
vim.lsp.buf.code_action()
|
||||
end,
|
||||
opts
|
||||
)
|
||||
vim.keymap.set(
|
||||
"n",
|
||||
"<Leader>a",
|
||||
function()
|
||||
vim.lsp.buf.code_action_range()
|
||||
end,
|
||||
vim.lsp.buf.code_action,
|
||||
opts
|
||||
)
|
||||
end
|
||||
|
|
|
@ -1,38 +0,0 @@
|
|||
" -----------------------------------------------------------------------------
|
||||
" - ALE Plugin configuration -
|
||||
" -----------------------------------------------------------------------------
|
||||
|
||||
" ALE Options
|
||||
let g:ale_disable_lsp = 1 " Disable LSP, we have other stuff for that
|
||||
let g:ale_fix_on_save = 1 " Default
|
||||
|
||||
" ALE Linters configuration
|
||||
let g:ale_linters = {}
|
||||
let g:ale_linters.python = ['flake8']
|
||||
let g:ale_linters.kotlin = ['ktlint']
|
||||
let g:ale_linters.clojure = []
|
||||
let g:ale_linters.cs = ['OmniSharp']
|
||||
let g:ale_linters.cpp = ['clang']
|
||||
let g:ale_linters.c = g:ale_linters.cpp
|
||||
|
||||
" ALE Fixers configuration
|
||||
let g:ale_fixers = {}
|
||||
let g:ale_fixers['*'] = ['remove_trailing_lines', 'trim_whitespace']
|
||||
let g:ale_fixers.python = ['autopep8', 'isort']
|
||||
let g:ale_fixers.dart = ['dartfmt']
|
||||
let g:ale_fixers.lua = ['luafmt']
|
||||
let g:ale_fixers.go = ['gofmt']
|
||||
let g:ale_fixers.cpp = ['clang-format', 'clangtidy']
|
||||
let g:ale_fixers.c = g:ale_fixers.cpp
|
||||
let g:ale_fixers.cmake = ['cmakeformat']
|
||||
let g:ale_fixers.java = ['google_java_format']
|
||||
let g:ale_fixers.rust = ['rustfmt']
|
||||
|
||||
" Additional Java options
|
||||
let g:ale_java_google_java_format_options = '--aosp'
|
||||
|
||||
" Warnings navigation
|
||||
nmap <silent> [W <Plug>(ale_first)
|
||||
nmap <silent> [w <Plug>(ale_previous)
|
||||
nmap <silent> ]w <Plug>(ale_next)
|
||||
nmap <silent> ]W <Plug>(ale_last)
|
|
@ -21,30 +21,22 @@ require("nvim-dap-virtual-text").setup()
|
|||
vim.keymap.set(
|
||||
"n",
|
||||
"<leader>db",
|
||||
function()
|
||||
dap.toggle_breakpoint()
|
||||
end
|
||||
dap.toggle_breakpoint
|
||||
)
|
||||
vim.keymap.set(
|
||||
"n",
|
||||
"<leader>dc",
|
||||
function()
|
||||
dap.continue()
|
||||
end
|
||||
dap.continue
|
||||
)
|
||||
vim.keymap.set(
|
||||
"n",
|
||||
"<leader>dso",
|
||||
function()
|
||||
dap.step_over()
|
||||
end
|
||||
dap.step_over
|
||||
)
|
||||
vim.keymap.set(
|
||||
"n",
|
||||
"<leader>dsi",
|
||||
function()
|
||||
dap.step_into()
|
||||
end
|
||||
dap.step_into
|
||||
)
|
||||
|
||||
-- Nvim DAP UI
|
||||
|
|
|
@ -3,10 +3,46 @@ require "nvim-treesitter.configs".setup {
|
|||
highlight = {
|
||||
enable = true -- false will disable the whole extension
|
||||
},
|
||||
indent = {
|
||||
enable = true
|
||||
},
|
||||
playground = {
|
||||
enable = true,
|
||||
disable = {},
|
||||
updatetime = 25, -- Debounced time for highlighting nodes in the playground from source code
|
||||
persist_queries = false -- Whether the query persists across vim sessions
|
||||
}
|
||||
},
|
||||
textobjects = {
|
||||
select = {
|
||||
enable = true,
|
||||
lookahead = true, -- Automatically jump forward to textobj, similar to targets.vim
|
||||
keymaps = {
|
||||
-- You can use the capture groups defined in textobjects.scm
|
||||
['af'] = '@function.outer',
|
||||
['if'] = '@function.inner',
|
||||
['ac'] = '@class.outer',
|
||||
['ic'] = '@class.inner',
|
||||
},
|
||||
},
|
||||
move = {
|
||||
enable = true,
|
||||
set_jumps = true, -- whether to set jumps in the jumplist
|
||||
goto_next_start = {
|
||||
[']m'] = '@function.outer',
|
||||
[']]'] = '@class.outer',
|
||||
},
|
||||
goto_next_end = {
|
||||
[']M'] = '@function.outer',
|
||||
[']['] = '@class.outer',
|
||||
},
|
||||
goto_previous_start = {
|
||||
['[m'] = '@function.outer',
|
||||
['[['] = '@class.outer',
|
||||
},
|
||||
goto_previous_end = {
|
||||
['[M'] = '@function.outer',
|
||||
['[]'] = '@class.outer',
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue