+++ /dev/null
-au User lsp_setup call lsp#register_server({
-\ "name": "clangd",
-\ "cmd": ["clangd"],
-\ "allowlist": ["c", "cpp", "objc", "objcpp"],
-\})
+++ /dev/null
-au User lsp_setup call lsp#register_server({
-\ "name": "gopls",
-\ "cmd": ["gopls"],
-\ "allowlist": ["go"],
-\})
+++ /dev/null
-if executable("pyls")
- " pip install 'python-language-server[all]'
- au User lsp_setup call lsp#register_server({
- \ "name": "pyls",
- \ "cmd": {server_info->["pyls"]},
- \ "allowlist": ["python"],
- \ "workspace_config": {"pyls": {
- \ "configurationSources": ["flake8"],
- \ "plugins": {
- \ "mccabe": {"enabled": v:false},
- \ },
- \ }},
- \})
-endif
+++ /dev/null
-" That function requires vim-lsp/autoload/lsp/ui/vim/diagnostics.vim:
-" function! lsp#ui#vim#diagnostics#get_all_buffer_diagnostics(...) abort
-" return s:get_all_buffer_diagnostics()
-" endfunction
-
-function! mylsp#qfpopulate() abort
- let l = []
- for d in lsp#ui#vim#diagnostics#get_all_buffer_diagnostics()
- call add(l, {
- \"lnum": d["range"]["start"]["line"],
- \"col": d["range"]["start"]["character"],
- \"text": d["message"],
- \"bufnr": bufnr()})
- endfor
- call setqflist(l, "r")
-endfunction
+++ /dev/null
-if exists("*<SID>on_lsp_buffer_enabled") | finish | endif
-
-let g:lsp_auto_enable = 1
-
-let g:lsp_diagnostics_echo_cursor = 1
-let g:lsp_diagnostics_echo_delay = -1
-let g:lsp_signature_help_enabled = 0
-
-function! s:on_lsp_buffer_enabled() abort
- setlocal omnifunc=lsp#complete
- nmap <buffer> [g <Plug>(lsp-previous-diagnostic)
- nmap <buffer> ]g <Plug>(lsp-next-diagnostic)
- nmap <buffer> gd <plug>(lsp-definition)
- nmap <buffer> K <plug>(lsp-hover)
-endfunction
-
-augroup lsp_install
- autocmd!
- autocmd User lsp_buffer_enabled call s:on_lsp_buffer_enabled()
-augroup END
-
-map <F6> :call mylsp#qfpopulate()<CR>:copen<CR>
let imports[m[2]] = m[1]
endfor
endfor
+
+ let lines = getloclist(winnr())
+ if len(lines) == 0 | let lines = getqflist() | endif
let result = []
- for diag in lsp#ui#vim#diagnostics#get_all_buffer_diagnostics()
- if diag["message"] !~ "^undefined name" | continue | endif
- let m = diag["message"][strridx(diag["message"][:-2], "'")+1:-2]
+ for line in lines
+ if line.text !~ "^undefined name" | continue | endif
+ let m = line.text[strridx(line.text[:-2], "'")+1:-2]
if len(m) == 0 || !has_key(imports, m) | continue | endif
call insert(result, imports[m])
endfor
--- /dev/null
+" go get golang.org/x/tools/gopls@latest
+" pip install 'python-language-server[all]'
+
+let g:lsc_enable_autocomplete = v:false
+let g:lsc_server_commands = {
+ \ "c": {"command": "clangd --log=error"},
+ \ "cpp": {"command": "clangd --log=error"},
+ \ "go": {"command": "gopls", "log_level": "Error"},
+ \ "python": {
+ \ "command": "pyls",
+ \ "workspace_config": {"pyls": {
+ \ "configurationSources": ["flake8"],
+ \ "plugins": {
+ \ "mccabe": {"enabled": v:false},
+ \ },
+ \ }},
+ \ },
+\ }
+let g:lsc_auto_map = {
+ \ "GoToDefinition": "gd",
+ \ "GoToDefinitionSplit": "<C-W>gd",
+ \ "ShowHover": v:true,
+ \ "Completion": "omnifunc",
+\ }
+
+map <F6> :LSClientAllDiagnostics<CR>