add none-ls

This commit is contained in:
Aditya 2024-03-06 18:23:26 +05:30
parent e7fe2051d4
commit 22e4ec8e50
Signed by: aditya
SSH key fingerprint: SHA256:jL1IvWsjjlPtw6HvDIHfXfhO9IkIokNEyIfuFhSdoyU
4 changed files with 331 additions and 0 deletions

View file

@ -25,6 +25,10 @@
./lsp/conform.nix ./lsp/conform.nix
./lsp/fidget.nix ./lsp/fidget.nix
./lsp/lsp.nix ./lsp/lsp.nix
./lsp/lspsaga.nix
./lsp/trouble.nix
./none-ls/none-ls.nix
./dap/dap.nix ./dap/dap.nix

187
config/lsp/lspsaga.nix Normal file
View file

@ -0,0 +1,187 @@
{
plugins.lspsaga = {
enable = true;
beacon = {
enable = true;
};
ui = {
border = "rounded"; # One of none, single, double, rounded, solid, shadow
codeAction = "💡"; # Can be any symbol you want 💡
};
hover = {
openCmd = "!floorp"; # Choose your browser
openLink = "gx";
};
diagnostic = {
borderFollow = true;
diagnosticOnlyCurrent = false;
showCodeAction = true;
};
symbolInWinbar = {
enable = true; # Breadcrumbs
};
codeAction = {
extendGitSigns = false;
showServerName = true;
onlyInCursor = true;
numShortcut = true;
keys = {
exec = "<CR>";
quit = ["<Esc>" "q"];
};
};
lightbulb = {
enable = false;
sign = false;
virtualText = true;
};
implement = {
enable = false;
};
rename = {
autoSave = false;
keys = {
exec = "<CR>";
quit = ["<C-k>" "<Esc>"];
select = "x";
};
};
outline = {
autoClose = true;
autoPreview = true;
closeAfterJump = true;
layout = "normal"; # normal or float
winPosition = "right"; # left or right
keys = {
jump = "e";
quit = "q";
toggleOrJump = "o";
};
};
scrollPreview = {
scrollDown = "<C-f>";
scrollUp = "<C-b>";
};
};
keymaps = [
{
mode = "n";
key = "gd";
action = "<cmd>Lspsaga finder def<CR>";
options = {
desc = "Goto Definition";
silent = true;
};
}
{
mode = "n";
key = "gr";
action = "<cmd>Lspsaga finder ref<CR>";
options = {
desc = "Goto References";
silent = true;
};
}
# {
# mode = "n";
# key = "gD";
# action = "<cmd>Lspsaga show_line_diagnostics<CR>";
# options = {
# desc = "Goto Declaration";
# silent = true;
# };
# }
{
mode = "n";
key = "gI";
action = "<cmd>Lspsaga finder imp<CR>";
options = {
desc = "Goto Implementation";
silent = true;
};
}
{
mode = "n";
key = "gT";
action = "<cmd>Lspsaga peek_type_definition<CR>";
options = {
desc = "Type Definition";
silent = true;
};
}
{
mode = "n";
key = "K";
action = "<cmd>Lspsaga hover_doc<CR>";
options = {
desc = "Hover";
silent = true;
};
}
{
mode = "n";
key = "<leader>cw";
action = "<cmd>Lspsaga outline<CR>";
options = {
desc = "Outline";
silent = true;
};
}
{
mode = "n";
key = "<leader>cr";
action = "<cmd>Lspsaga rename<CR>";
options = {
desc = "Rename";
silent = true;
};
}
{
mode = "n";
key = "<leader>ca";
action = "<cmd>Lspsaga code_action<CR>";
options = {
desc = "Code Action";
silent = true;
};
}
{
mode = "n";
key = "<leader>cd";
action = "<cmd>Lspsaga show_line_diagnostics<CR>";
options = {
desc = "Line Diagnostics";
silent = true;
};
}
{
mode = "n";
key = "[d";
action = "<cmd>Lspsaga diagnostic_jump_next<CR>";
options = {
desc = "Next Diagnostic";
silent = true;
};
}
{
mode = "n";
key = "]d";
action = "<cmd>Lspsaga diagnostic_jump_prev<CR>";
options = {
desc = "Previous Diagnostic";
silent = true;
};
}
];
}

50
config/lsp/trouble.nix Normal file
View file

@ -0,0 +1,50 @@
{
plugins.trouble = {
enable = true;
autoClose = true;
};
keymaps = [
{
mode = "n";
key = "<leader>x";
action = "+diagnostics/quickfix";
}
{
mode = "n";
key = "<leader>xx";
action = "<cmd>TroubleToggle<cr>";
options = {
silent = true;
desc = "Document Diagnostics (Trouble)";
};
}
{
mode = "n";
key = "<leader>xX";
action = "<cmd>TroubleToggle workspace_diagnostics<cr>";
options = {
silent = true;
desc = "Workspace Diagnostics (Trouble)";
};
}
{
mode = "n";
key = "<leader>xt";
action = "<cmd>TroubleToggle todo<cr>";
options = {
silent = true;
desc = "Todo (Trouble)";
};
}
{
mode = "n";
key = "<leader>xQ";
action = "<cmd>TodoQuickFix<cr>";
options = {
silent = true;
desc = "Quickfix List (Trouble)";
};
}
];
}

View file

@ -0,0 +1,90 @@
{
plugins.none-ls = {
enable = true;
enableLspFormat = true;
updateInInsert = false;
onAttach = ''
function(client, bufnr)
if client.supports_method "textDocument/formatting" then
vim.api.nvim_clear_autocmds { group = augroup, buffer = bufnr }
vim.api.nvim_create_autocmd("BufWritePre", {
group = augroup,
buffer = bufnr,
callback = function()
vim.lsp.buf.format { bufnr = bufnr }
end,
})
end
end
'';
sources = {
code_actions = {
eslint_d.enable = true;
gitsigns.enable = true;
statix.enable = true;
};
diagnostics = {
checkstyle = {
enable = true;
};
statix = {
enable = true;
};
luacheck = {
enable = true;
};
flake8 = {
enable = true;
};
eslint_d = {
enable = true;
};
};
formatting = {
alejandra = {
enable = true;
};
prettier = {
enable = true;
withArgs = ''
{
extra_args = { "--no-semi", "--single-quote" },
}
'';
};
google_java_format = {
enable = true;
};
rustfmt = {
enable = true;
};
stylua = {
enable = true;
};
black = {
enable = true;
withArgs = ''
{
extra_args = { "--fast" },
}
'';
};
jq = {
enable = true;
};
};
};
};
# keymaps = [
# {
# mode = [ "n" "v" ];
# key = "<leader>cf";
# action = "<cmd>lua vim.lsp.buf.format()<cr>";
# options = {
# silent = true;
# desc = "Format";
# };
# }
# ];
}