attempt to use gopls only

This commit is contained in:
Barak Michener 2021-11-04 12:38:12 -07:00
parent f763d7b994
commit 095b5798f2
3 changed files with 47 additions and 26 deletions

View file

@ -93,8 +93,8 @@ augroup go
autocmd FileType go set softtabstop=2
autocmd FileType go set shiftwidth=2
autocmd FileType go set noexpandtab
autocmd FileType go nmap <Leader>gd <Plug>(go-doc)
autocmd FileType go nmap gd <Plug>(go-def)
"autocmd FileType go nmap <Leader>gd <Plug>(go-doc)
"autocmd FileType go nmap gd <Plug>(go-def)
augroup END
augroup idris

View file

@ -11,6 +11,24 @@ nvim_lsp.gopls.setup({ on_attach=on_attach })
nvim_lsp.pyright.setup({ on_attach=on_attach })
nvim_lsp.clangd.setup({ on_attach=on_attach })
function org_imports(wait_ms)
local params = vim.lsp.util.make_range_params()
params.context = {only = {"source.organizeImports"}}
local result = vim.lsp.buf_request_sync(0, "textDocument/codeAction", params, wait_ms)
for _, res in pairs(result or {}) do
for _, r in pairs(res.result or {}) do
if r.edit then
vim.lsp.util.apply_workspace_edit(r.edit)
else
vim.lsp.buf.execute_command(r.command)
end
end
end
end
nvim_lsp.efm.setup {
init_options = {documentFormatting = true},
settings = {
@ -115,7 +133,8 @@ vim.api.nvim_set_keymap("s", "<S-Tab>", "v:lua.s_tab_complete()", {expr = true})
require('lspkind').init({
-- disables text annotations
with_text = false,
--with_text = false,
with_text = true,
-- default symbol map
-- can be either 'default' or 'codicons'
@ -123,28 +142,28 @@ require('lspkind').init({
-- override preset symbols
-- default: {}
symbol_map = {
Method = 'm',
Function = 'f',
Text = 'txt',
Constructor = 'new',
Variable = 'var',
Class = 'cls',
Interface = 'iface',
Module = 'mod',
Property = 'prop',
Unit = 'unit',
Value = 'val',
Enum = 'enum',
Keyword = 'kw',
Snippet = 'sn',
Color = 'color',
File = 'file',
Folder = 'fold',
EnumMember = 'enum',
Constant = 'const',
Struct = 'struct',
},
--symbol_map = {
--Method = 'm',
--Function = 'f',
--Text = 'txt',
--Constructor = 'new',
--Variable = 'var',
--Class = 'cls',
--Interface = 'iface',
--Module = 'mod',
--Property = 'prop',
--Unit = 'unit',
--Value = 'val',
--Enum = 'enum',
--Keyword = 'kw',
--Snippet = 'sn',
--Color = 'color',
--File = 'file',
--Folder = 'fold',
--EnumMember = 'enum',
--Constant = 'const',
--Struct = 'struct',
--},
})
require('trouble').setup {

4
.vimrc
View file

@ -142,7 +142,7 @@ Plug 'airblade/vim-rooter'
Plug 'majutsushi/tagbar'
Plug 'SirVer/ultisnips'
Plug 'honza/vim-snippets'
Plug 'fatih/vim-go'
"Plug 'fatih/vim-go'
Plug 'jiangmiao/auto-pairs'
Plug 'tpope/vim-abolish'
Plug 'sheerun/vim-polyglot'
@ -317,6 +317,8 @@ autocmd CursorHold * lua vim.lsp.diagnostic.show_line_diagnostics({show_header =
autocmd BufWritePre *.lua lua vim.lsp.buf.formatting_sync(nil, 1000)
autocmd BufWritePre *.py lua vim.lsp.buf.formatting_sync(nil, 1000)
autocmd BufWritePre *.rs lua vim.lsp.buf.formatting_seq_sync(nil, 1000)
autocmd BufWritePre *.go lua vim.lsp.buf.formatting_seq_sync(nil, 1000)
autocmd BufWritePre *.go :silent! lua org_imports(3000)
" Goto previous/next diagnostic warning/error
nnoremap <silent> g[ <cmd>lua vim.lsp.diagnostic.goto_prev()<CR>