feat: add more lsps
refactor: improve ps lsp (only windows)
This commit is contained in:
parent
ddbb330e06
commit
0f27149fab
139
init.lua
139
init.lua
@ -3,7 +3,7 @@
|
||||
vim.keymap.set({ 'i', 'v' }, 'jk', '<Esc>', { noremap = true, silent = true })
|
||||
vim.keymap.set('v', 'J', ":m '>+1<CR>gv=gv")
|
||||
vim.keymap.set('v', 'K', ":m '<-2<CR>gv=gv")
|
||||
vim.keymap.set("x", "<leader>p", [["_dP]], { desc = 'Paste and cut' })
|
||||
vim.keymap.set('x', '<leader>p', [["_dP]], { desc = 'Paste and cut' })
|
||||
|
||||
--[[
|
||||
|
||||
@ -676,10 +676,95 @@ require('lazy').setup({
|
||||
-- - settings (table): Override the default settings passed when initializing the server.
|
||||
-- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/
|
||||
|
||||
local powershell_es = {}
|
||||
local servers = {
|
||||
-- clangd = {},
|
||||
-- gopls = {},
|
||||
-- pyright = {},
|
||||
rust_analyzer = {
|
||||
settings = {
|
||||
['rust-analyzer'] = {
|
||||
checkOnSave = {
|
||||
command = 'clippy',
|
||||
extraArgs = {
|
||||
'--',
|
||||
'-D',
|
||||
'warnings',
|
||||
'-W',
|
||||
'clippy::single_match',
|
||||
'-W',
|
||||
'clippy::single_match_else',
|
||||
'-W',
|
||||
'clippy::needless_match',
|
||||
'-W',
|
||||
'clippy::needless_late_init',
|
||||
'-W',
|
||||
'clippy::redundant_pattern_matching',
|
||||
'-W',
|
||||
'clippy::redundant_pattern',
|
||||
'-W',
|
||||
'clippy::redundant_guards',
|
||||
'-W',
|
||||
'clippy::collapsible_match',
|
||||
'-W',
|
||||
'clippy::match_single_binding',
|
||||
'-W',
|
||||
'clippy::match_same_arms',
|
||||
'-W',
|
||||
'clippy::match_ref_pats',
|
||||
'-W',
|
||||
'clippy::match_bool',
|
||||
'-D',
|
||||
'clippy::needless_bool',
|
||||
'-W',
|
||||
'clippy::unwrap_used',
|
||||
'-W',
|
||||
'clippy::expect_used',
|
||||
},
|
||||
},
|
||||
diagnostics = {
|
||||
enable = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
-- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs
|
||||
--
|
||||
-- Some languages (like typescript) have entire language plugins that can be useful:
|
||||
-- https://github.com/pmizio/typescript-tools.nvim
|
||||
--
|
||||
-- But for many setups, the LSP (`ts_ls`) will work just fine
|
||||
-- ts_ls = {},
|
||||
--
|
||||
ts_ls = {},
|
||||
html = {},
|
||||
cssls = {},
|
||||
|
||||
lua_ls = {
|
||||
-- cmd = { ... },
|
||||
-- filetypes = { ... },
|
||||
-- capabilities = {},
|
||||
settings = {
|
||||
Lua = {
|
||||
completion = {
|
||||
callSnippet = 'Replace',
|
||||
},
|
||||
-- You can toggle below to ignore Lua_LS's noisy `missing-fields` warnings
|
||||
-- diagnostics = { disable = { 'missing-fields' } },
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
local ensure_list = {
|
||||
'stylua', -- Used to format Lua code
|
||||
'html',
|
||||
'cssls',
|
||||
}
|
||||
|
||||
if vim.loop.os_uname().sysname == 'Windows_NT' then
|
||||
powershell_es = {
|
||||
table.insert(ensure_list, 'powershell_es')
|
||||
|
||||
servers.powershell_es = {
|
||||
bundle_path = vim.fn.stdpath 'data' .. '/mason/packages/powershell-editor-services',
|
||||
cmd = {
|
||||
'pwsh',
|
||||
@ -703,49 +788,6 @@ require('lazy').setup({
|
||||
}
|
||||
end
|
||||
|
||||
local servers = {
|
||||
-- clangd = {},
|
||||
-- gopls = {},
|
||||
-- pyright = {},
|
||||
rust_analyzer = {
|
||||
settings = {
|
||||
['rust-analyzer'] = {
|
||||
checkOnSave = {
|
||||
command = 'clippy',
|
||||
extraArgs = { '--', '-D', 'warnings', '-W', 'clippy::single_match', '-W', 'clippy::single_match_else', '-W', 'clippy::needless_match', '-W', 'clippy::needless_late_init', '-W', 'clippy::redundant_pattern_matching', '-W', 'clippy::redundant_pattern', '-W', 'clippy::redundant_guards', '-W', 'clippy::collapsible_match', '-W', 'clippy::match_single_binding', '-W', 'clippy::match_same_arms', '-W', 'clippy::match_ref_pats', '-W', 'clippy::match_bool', '-D', 'clippy::needless_bool', '-W', 'clippy::unwrap_used', '-W', 'clippy::expect_used' },
|
||||
},
|
||||
diagnostics = {
|
||||
enable = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
powershell_es = powershell_es,
|
||||
-- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs
|
||||
--
|
||||
-- Some languages (like typescript) have entire language plugins that can be useful:
|
||||
-- https://github.com/pmizio/typescript-tools.nvim
|
||||
--
|
||||
-- But for many setups, the LSP (`ts_ls`) will work just fine
|
||||
-- ts_ls = {},
|
||||
--
|
||||
|
||||
lua_ls = {
|
||||
-- cmd = { ... },
|
||||
-- filetypes = { ... },
|
||||
-- capabilities = {},
|
||||
settings = {
|
||||
Lua = {
|
||||
completion = {
|
||||
callSnippet = 'Replace',
|
||||
},
|
||||
-- You can toggle below to ignore Lua_LS's noisy `missing-fields` warnings
|
||||
-- diagnostics = { disable = { 'missing-fields' } },
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
-- Ensure the servers and tools above are installed
|
||||
--
|
||||
-- To check the current status of installed tools and/or manually install
|
||||
@ -760,10 +802,7 @@ require('lazy').setup({
|
||||
-- You can add other tools here that you want Mason to install
|
||||
-- for you, so that they are available from within Neovim.
|
||||
local ensure_installed = vim.tbl_keys(servers or {})
|
||||
vim.list_extend(ensure_installed, {
|
||||
'stylua', -- Used to format Lua code
|
||||
'powershell_es',
|
||||
})
|
||||
vim.list_extend(ensure_installed, ensure_list)
|
||||
require('mason-tool-installer').setup { ensure_installed = ensure_installed }
|
||||
|
||||
require('mason-lspconfig').setup {
|
||||
|
Loading…
x
Reference in New Issue
Block a user