feat: some stuff
This commit is contained in:
@ -16,7 +16,7 @@ map("n", "gd", "<Cmd>lua vim.lsp.buf.definition()<CR>", options)
|
||||
map("n", "gr", "<cmd>lua vim.lsp.buf.references()<CR>", options)
|
||||
map("n", "gi", "<cmd>lua vim.lsp.buf.implementation()<CR>", options)
|
||||
map("n", "K", "<Cmd>lua vim.lsp.buf.hover()<CR>", options)
|
||||
map("n", "<Leader>e", "<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>", options)
|
||||
map("n", "<Leader>e", "<cmd>lua vim.diagnostic.open_float()<CR>", options)
|
||||
map("n", "<Leader>rn", "<cmd>lua vim.lsp.buf.rename()<CR>", options)
|
||||
map("n", "<Leader>c", "<cmd>lua vim.lsp.buf.code_action()<CR>", options)
|
||||
map("n", "<Leader><C-f>", ":Format<CR>", options)
|
||||
|
@ -1,9 +1,21 @@
|
||||
local lsp = require "lspconfig"
|
||||
local lsp_status = require("lsp-status")
|
||||
|
||||
_G.lsp_organize_imports = function()
|
||||
local params = {
|
||||
command = "_typescript.organizeImports",
|
||||
arguments = {vim.api.nvim_buf_get_name(0)},
|
||||
title = ""
|
||||
}
|
||||
vim.lsp.buf.execute_command(params)
|
||||
end
|
||||
|
||||
-- function to attach completion when setting up lsp
|
||||
local function on_attach()
|
||||
vim.api.nvim_buf_set_option(bufnr, "omnifunc", "v:lua.vim.lsp.omnifunc")
|
||||
|
||||
vim.cmd("command! LspOrganize lua lsp_organize_imports()")
|
||||
vim.api.nvim_buf_map(bufnr, "n", "gs", ":LspOrganize<CR>", {silent = true})
|
||||
end
|
||||
|
||||
local system_name = ""
|
||||
@ -76,25 +88,9 @@ lsp.svelte.setup {
|
||||
}
|
||||
|
||||
-- Typescript Language Server
|
||||
local function organize_imports()
|
||||
local params = {
|
||||
command = "_typescript.organizeImports",
|
||||
arguments = {vim.api.nvim_buf_get_name(bufnr)},
|
||||
title = ""
|
||||
}
|
||||
|
||||
vim.lsp.buf_request_sync(bufnr, "workspace/executeCommand", params, 500)
|
||||
end
|
||||
|
||||
lsp.tsserver.setup {
|
||||
on_attach = on_attach,
|
||||
capabilities = lsp_status.capabilities,
|
||||
commands = {
|
||||
OrganizeImports = {
|
||||
organize_imports,
|
||||
description = "Organize Imports"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
-- JSON ls setup
|
||||
|
Reference in New Issue
Block a user