summaryrefslogtreecommitdiff
path: root/.config/nvim/lua/lsp
diff options
context:
space:
mode:
Diffstat (limited to '.config/nvim/lua/lsp')
-rw-r--r--.config/nvim/lua/lsp/bash-ls.lua6
-rw-r--r--.config/nvim/lua/lsp/clangd.lua13
-rw-r--r--.config/nvim/lua/lsp/docker-ls.lua6
-rw-r--r--.config/nvim/lua/lsp/efm-general-ls.lua119
-rw-r--r--.config/nvim/lua/lsp/emmet-ls.lua19
-rw-r--r--.config/nvim/lua/lsp/go-ls.lua7
-rw-r--r--.config/nvim/lua/lsp/init.lua118
-rw-r--r--.config/nvim/lua/lsp/json-ls.lua16
-rw-r--r--.config/nvim/lua/lsp/latex-ls.lua4
-rw-r--r--.config/nvim/lua/lsp/lua-ls.lua27
-rw-r--r--.config/nvim/lua/lsp/python-ls.lua23
-rw-r--r--.config/nvim/lua/lsp/rust-ls.lua4
-rw-r--r--.config/nvim/lua/lsp/vim-ls.lua5
-rw-r--r--.config/nvim/lua/lsp/yaml-ls.lua5
14 files changed, 0 insertions, 372 deletions
diff --git a/.config/nvim/lua/lsp/bash-ls.lua b/.config/nvim/lua/lsp/bash-ls.lua
deleted file mode 100644
index 7b430a6..0000000
--- a/.config/nvim/lua/lsp/bash-ls.lua
+++ /dev/null
@@ -1,6 +0,0 @@
--- npm i -g bash-language-server
-require'lspconfig'.bashls.setup {
- cmd = {DATA_PATH .. "/lspinstall/bash/node_modules/.bin/bash-language-server", "start"},
- on_attach = require'lsp'.common_on_attach,
- filetypes = { "sh", "zsh" }
-}
diff --git a/.config/nvim/lua/lsp/clangd.lua b/.config/nvim/lua/lsp/clangd.lua
deleted file mode 100644
index dbbda08..0000000
--- a/.config/nvim/lua/lsp/clangd.lua
+++ /dev/null
@@ -1,13 +0,0 @@
-require'lspconfig'.clangd.setup {
- cmd = {DATA_PATH .. "/lspinstall/cpp/clangd/bin/clangd"},
- on_attach = require'lsp'.common_on_attach,
- handlers = {
- ["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, {
- virtual_text = O.clang.diagnostics.virtual_text,
- signs = O.clang.diagnostics.signs,
- underline = O.clang.diagnostics.underline,
- update_in_insert = true
-
- })
- }
-}
diff --git a/.config/nvim/lua/lsp/docker-ls.lua b/.config/nvim/lua/lsp/docker-ls.lua
deleted file mode 100644
index b477a23..0000000
--- a/.config/nvim/lua/lsp/docker-ls.lua
+++ /dev/null
@@ -1,6 +0,0 @@
--- npm install -g dockerfile-language-server-nodejs
-require'lspconfig'.dockerls.setup {
- cmd = {DATA_PATH .. "/lspinstall/dockerfile/node_modules/.bin/docker-langserver", "--stdio"},
- on_attach = require'lsp'.common_on_attach,
- root_dir = vim.loop.cwd
-}
diff --git a/.config/nvim/lua/lsp/efm-general-ls.lua b/.config/nvim/lua/lsp/efm-general-ls.lua
deleted file mode 100644
index 01bc3ee..0000000
--- a/.config/nvim/lua/lsp/efm-general-ls.lua
+++ /dev/null
@@ -1,119 +0,0 @@
--- Example configuations here: https://github.com/mattn/efm-langserver
--- TODO this file needs to be refactored eache lang should be it's own file
--- python
-local python_arguments = {}
-
--- TODO replace with path argument
-local flake8 = {
- LintCommand = "flake8 --ignore=E501 --stdin-display-name ${INPUT} -",
- lintStdin = true,
- lintFormats = {"%f:%l:%c: %m"}
-}
-
-local isort = {formatCommand = "isort --quiet -", formatStdin = true}
-
-local yapf = {formatCommand = "yapf --quiet", formatStdin = true}
-local black = {formatCommand = "black --quiet -", formatStdin = true}
-
-if O.python.linter == 'flake8' then table.insert(python_arguments, flake8) end
-
-if O.python.isort then table.insert(python_arguments, isort) end
-
-if O.python.formatter == 'yapf' then
- table.insert(python_arguments, yapf)
-elseif O.python.formatter == 'black' then
- table.insert(python_arguments, black)
-end
-
--- lua
-local lua_arguments = {}
-
-local luaFormat = {
- formatCommand = "lua-format -i --no-keep-simple-function-one-line --column-limit=120",
- formatStdin = true
-}
-
-local lua_fmt = {
- formatCommand = "luafmt --indent-count 2 --line-width 120 --stdin",
- formatStdin = true
-}
-
-if O.lua.formatter == 'lua-format' then
- table.insert(lua_arguments, luaFormat)
-elseif O.lua.formatter == 'lua-fmt' then
- table.insert(lua_arguments, lua_fmt)
-end
-
--- sh
-local sh_arguments = {}
-
-local shfmt = {formatCommand = 'shfmt -ci -s -bn', formatStdin = true}
-
-local shellcheck = {
- LintCommand = 'shellcheck -f gcc -x',
- lintFormats = {'%f:%l:%c: %trror: %m', '%f:%l:%c: %tarning: %m', '%f:%l:%c: %tote: %m'}
-}
-
-if O.sh.formatter == 'shfmt' then table.insert(sh_arguments, shfmt) end
-
-if O.sh.linter == 'shellcheck' then table.insert(sh_arguments, shellcheck) end
-
--- tsserver/web javascript react, vue, json, html, css, yaml
-local prettier = {formatCommand = "prettier --stdin-filepath ${INPUT}", formatStdin = true}
--- You can look for project scope Prettier and Eslint with e.g. vim.fn.glob("node_modules/.bin/prettier") etc. If it is not found revert to global Prettier where needed.
--- local prettier = {formatCommand = "./node_modules/.bin/prettier --stdin-filepath ${INPUT}", formatStdin = true}
-
-local eslint = {
- lintCommand = "./node_modules/.bin/eslint -f unix --stdin --stdin-filename ${INPUT}",
- lintIgnoreExitCode = true,
- lintStdin = true,
- lintFormats = {"%f:%l:%c: %m"},
- formatCommand = "./node_modules/.bin/eslint --fix-to-stdout --stdin --stdin-filename=${INPUT}",
- formatStdin = true
-}
-
-local tsserver_args = {}
-
-if O.tsserver.formatter == 'prettier' then table.insert(tsserver_args, prettier) end
-
-if O.tsserver.linter == 'eslint' then table.insert(tsserver_args, eslint) end
-
--- local markdownlint = {
--- -- TODO default to global lintrc
--- -- lintcommand = 'markdownlint -s -c ./markdownlintrc',
--- lintCommand = 'markdownlint -s',
--- lintStdin = true,
--- lintFormats = {'%f:%l %m', '%f:%l:%c %m', '%f: %l: %m'}
--- }
-
-local markdownPandocFormat = {formatCommand = 'pandoc -f markdown -t gfm -sp --tab-stop=2', formatStdin = true}
-
-require"lspconfig".efm.setup {
- -- init_options = {initializationOptions},
- cmd = {DATA_PATH .. "/lspinstall/efm/efm-langserver"},
- init_options = {documentFormatting = true, codeAction = false},
- filetypes = {"lua", "python", "javascriptreact", "javascript", "typescript","typescriptreact","sh", "html", "css", "json", "yaml", "markdown", "vue"},
- settings = {
- rootMarkers = {".git/"},
- languages = {
- python = python_arguments,
- lua = lua_arguments,
- sh = sh_arguments,
- javascript = tsserver_args,
- javascriptreact = tsserver_args,
- typescript = tsserver_args,
- typescriptreact = tsserver_args,
- html = {prettier},
- css = {prettier},
- json = {prettier},
- yaml = {prettier},
- markdown = {markdownPandocFormat}
- -- javascriptreact = {prettier, eslint},
- -- javascript = {prettier, eslint},
- -- markdown = {markdownPandocFormat, markdownlint},
- }
- }
-}
-
--- Also find way to toggle format on save
--- maybe this will help: https://superuser.com/questions/439078/how-to-disable-autocmd-or-augroup-in-vim
diff --git a/.config/nvim/lua/lsp/emmet-ls.lua b/.config/nvim/lua/lsp/emmet-ls.lua
deleted file mode 100644
index 6531ccf..0000000
--- a/.config/nvim/lua/lsp/emmet-ls.lua
+++ /dev/null
@@ -1,19 +0,0 @@
-local nvim_lsp = require'lspconfig'
-local configs = require'lspconfig/configs'
-local capabilities = vim.lsp.protocol.make_client_capabilities()
-capabilities.textDocument.completion.completionItem.snippetSupport = true
-
-configs.emmet_ls = {
- default_config = {
- cmd = {'emmet-ls', '--stdio'};
- filetypes = {'html', 'css'};
- root_dir = function()
- return vim.loop.cwd()
- end;
- settings = {};
- };
-}
-
-nvim_lsp.emmet_ls.setup{
- -- on_attach = on_attach;
-}
diff --git a/.config/nvim/lua/lsp/go-ls.lua b/.config/nvim/lua/lsp/go-ls.lua
deleted file mode 100644
index 1311247..0000000
--- a/.config/nvim/lua/lsp/go-ls.lua
+++ /dev/null
@@ -1,7 +0,0 @@
-require'lspconfig'.gopls.setup{
- cmd = {DATA_PATH .. "/lspinstall/go/gopls"},
- settings = {gopls = {analyses = {unusedparams = true}, staticcheck = true}},
- root_dir = require'lspconfig'.util.root_pattern(".git","go.mod","."),
- init_options = {usePlaceholders = true, completeUnimported = true},
- on_attach = require'lsp'.common_on_attach
-}
diff --git a/.config/nvim/lua/lsp/init.lua b/.config/nvim/lua/lsp/init.lua
deleted file mode 100644
index ef2e2f9..0000000
--- a/.config/nvim/lua/lsp/init.lua
+++ /dev/null
@@ -1,118 +0,0 @@
--- TODO figure out why this don't work
-vim.fn.sign_define(
- "LspDiagnosticsSignError",
- {texthl = "LspDiagnosticsSignError", text = "", numhl = "LspDiagnosticsSignError"}
-)
-vim.fn.sign_define(
- "LspDiagnosticsSignWarning",
- {texthl = "LspDiagnosticsSignWarning", text = "", numhl = "LspDiagnosticsSignWarning"}
-)
-vim.fn.sign_define(
- "LspDiagnosticsSignHint",
- {texthl = "LspDiagnosticsSignHint", text = "", numhl = "LspDiagnosticsSignHint"}
-)
-vim.fn.sign_define(
- "LspDiagnosticsSignInformation",
- {texthl = "LspDiagnosticsSignInformation", text = "", numhl = "LspDiagnosticsSignInformation"}
-)
-
-vim.cmd("nnoremap <silent> gd <cmd>lua vim.lsp.buf.definition()<CR>")
-vim.cmd("nnoremap <silent> gD <cmd>lua vim.lsp.buf.declaration()<CR>")
-vim.cmd("nnoremap <silent> gr <cmd>lua vim.lsp.buf.references()<CR>")
-vim.cmd("nnoremap <silent> gi <cmd>lua vim.lsp.buf.implementation()<CR>")
-vim.cmd("nnoremap <silent> ca :Lspsaga code_action<CR>")
-vim.cmd("nnoremap <silent> K :Lspsaga hover_doc<CR>")
--- vim.cmd('nnoremap <silent> <C-k> <cmd>lua vim.lsp.buf.signature_help()<CR>')
-vim.cmd("nnoremap <silent> <C-p> :Lspsaga diagnostic_jump_prev<CR>")
-vim.cmd("nnoremap <silent> <C-n> :Lspsaga diagnostic_jump_next<CR>")
--- scroll down hover doc or scroll in definition preview
-vim.cmd("nnoremap <silent> <C-f> <cmd>lua require('lspsaga.action').smart_scroll_with_saga(1)<CR>")
--- scroll up hover doc
-vim.cmd("nnoremap <silent> <C-b> <cmd>lua require('lspsaga.action').smart_scroll_with_saga(-1)<CR>")
-vim.cmd('command! -nargs=0 LspVirtualTextToggle lua require("lsp/virtual_text").toggle()')
-
--- Set Default Prefix.
--- Note: You can set a prefix per lsp server in the lv-globals.lua file
-vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(
- vim.lsp.diagnostic.on_publish_diagnostics, {
- virtual_text = {
- prefix = "",
- spacing = 0,
- },
- signs = true,
- underline = true,
- }
-)
-
--- symbols for autocomplete
-vim.lsp.protocol.CompletionItemKind = {
- "  (Text) ",
- "  (Method)",
- "  (Function)",
- "  (Constructor)",
- " ﴲ (Field)",
- "[] (Variable)",
- "  (Class)",
- " ﰮ (Interface)",
- "  (Module)",
- " 襁 (Property)",
- "  (Unit)",
- "  (Value)",
- " 練 (Enum)",
- "  (Keyword)",
- "  (Snippet)",
- "  (Color)",
- "  (File)",
- "  (Reference)",
- "  (Folder)",
- "  (EnumMember)",
- " ﲀ (Constant)",
- " ﳤ (Struct)",
- "  (Event)",
- "  (Operator)",
- "  (TypeParameter)"
-}
-
---[[ " autoformat
-autocmd BufWritePre *.js lua vim.lsp.buf.formatting_sync(nil, 100)
-autocmd BufWritePre *.jsx lua vim.lsp.buf.formatting_sync(nil, 100)
-autocmd BufWritePre *.lua lua vim.lsp.buf.formatting_sync(nil, 100) ]]
--- Java
--- autocmd FileType java nnoremap ca <Cmd>lua require('jdtls').code_action()<CR>
-
-local function documentHighlight(client, bufnr)
- -- Set autocommands conditional on server_capabilities
- if client.resolved_capabilities.document_highlight then
- vim.api.nvim_exec(
- [[
- hi LspReferenceRead cterm=bold ctermbg=red guibg=#464646
- hi LspReferenceText cterm=bold ctermbg=red guibg=#464646
- hi LspReferenceWrite cterm=bold ctermbg=red guibg=#464646
- augroup lsp_document_highlight
- autocmd! * <buffer>
- autocmd CursorHold <buffer> lua vim.lsp.buf.document_highlight()
- autocmd CursorMoved <buffer> lua vim.lsp.buf.clear_references()
- augroup END
- ]],
- false
- )
- end
-end
-local lsp_config = {}
-
-if O.document_highlight then
- function lsp_config.common_on_attach(client, bufnr)
- documentHighlight(client, bufnr)
- end
-end
-
-function lsp_config.tsserver_on_attach(client, bufnr)
- lsp_config.common_on_attach(client, bufnr)
- client.resolved_capabilities.document_formatting = false
-end
-
--- Use a loop to conveniently both setup defined servers
--- and map buffer local keybindings when the language server attaches
--- local servers = {"pyright", "tsserver"}
--- for _, lsp in ipairs(servers) do nvim_lsp[lsp].setup {on_attach = on_attach} end
-return lsp_config
diff --git a/.config/nvim/lua/lsp/json-ls.lua b/.config/nvim/lua/lsp/json-ls.lua
deleted file mode 100644
index 952673a..0000000
--- a/.config/nvim/lua/lsp/json-ls.lua
+++ /dev/null
@@ -1,16 +0,0 @@
--- npm install -g vscode-json-languageserver
-require'lspconfig'.jsonls.setup {
- cmd = {
- "node", DATA_PATH .. "/lspinstall/json/vscode-json/json-language-features/server/dist/node/jsonServerMain.js",
- "--stdio"
- },
- on_attach = require'lsp'.common_on_attach,
-
- commands = {
- Format = {
- function()
- vim.lsp.buf.range_formatting({}, {0, 0}, {vim.fn.line("$"), 0})
- end
- }
- }
-}
diff --git a/.config/nvim/lua/lsp/latex-ls.lua b/.config/nvim/lua/lsp/latex-ls.lua
deleted file mode 100644
index 179c143..0000000
--- a/.config/nvim/lua/lsp/latex-ls.lua
+++ /dev/null
@@ -1,4 +0,0 @@
-require'lspconfig'.texlab.setup{
- cmd = {DATA_PATH .. "/lspinstall/latex/texlab"},
- on_attach = require'lsp'.common_on_attach
-}
diff --git a/.config/nvim/lua/lsp/lua-ls.lua b/.config/nvim/lua/lsp/lua-ls.lua
deleted file mode 100644
index 775eb92..0000000
--- a/.config/nvim/lua/lsp/lua-ls.lua
+++ /dev/null
@@ -1,27 +0,0 @@
--- https://github.com/sumneko/lua-language-server/wiki/Build-and-Run-(Standalone)
-local sumneko_root_path = DATA_PATH .. "/lspinstall/lua"
-local sumneko_binary = sumneko_root_path .. "/sumneko-lua-language-server"
-
-require'lspconfig'.sumneko_lua.setup {
- cmd = {sumneko_binary, "-E", sumneko_root_path .. "/main.lua"},
- on_attach = require'lsp'.common_on_attach,
- settings = {
- Lua = {
- runtime = {
- -- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
- version = 'LuaJIT',
- -- Setup your lua path
- path = vim.split(package.path, ';')
- },
- diagnostics = {
- -- Get the language server to recognize the `vim` global
- globals = {'vim'}
- },
- workspace = {
- -- Make the server aware of Neovim runtime files
- library = {[vim.fn.expand('$VIMRUNTIME/lua')] = true, [vim.fn.expand('$VIMRUNTIME/lua/vim/lsp')] = true},
- maxPreload = 10000
- }
- }
- }
-}
diff --git a/.config/nvim/lua/lsp/python-ls.lua b/.config/nvim/lua/lsp/python-ls.lua
deleted file mode 100644
index d4dfac5..0000000
--- a/.config/nvim/lua/lsp/python-ls.lua
+++ /dev/null
@@ -1,23 +0,0 @@
-
--- npm i -g pyright
-require'lspconfig'.pyright.setup {
- cmd = {DATA_PATH .. "/lspinstall/python/node_modules/.bin/pyright-langserver", "--stdio"},
- on_attach = require'lsp'.common_on_attach,
- handlers = {
- ["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, {
- virtual_text = O.python.diagnostics.virtual_text,
- signs = O.python.diagnostics.signs,
- underline = O.python.diagnostics.underline,
- update_in_insert = true
- })
- },
- settings = {
- python = {
- analysis = {
- typeCheckingMode = O.python.analysis.type_checking,
- autoSearchPaths = O.python.analysis.auto_search_paths,
- useLibraryCodeForTypes = O.python.analysis.use_library_code_types
- }
- }
- }
-}
diff --git a/.config/nvim/lua/lsp/rust-ls.lua b/.config/nvim/lua/lsp/rust-ls.lua
deleted file mode 100644
index 896c693..0000000
--- a/.config/nvim/lua/lsp/rust-ls.lua
+++ /dev/null
@@ -1,4 +0,0 @@
-require'lspconfig'.rust_analyzer.setup{
- cmd = {DATA_PATH .. "/lspinstall/rust/rust-analyzer"},
- on_attach = require'lsp'.common_on_attach
-}
diff --git a/.config/nvim/lua/lsp/vim-ls.lua b/.config/nvim/lua/lsp/vim-ls.lua
deleted file mode 100644
index 39beb11..0000000
--- a/.config/nvim/lua/lsp/vim-ls.lua
+++ /dev/null
@@ -1,5 +0,0 @@
--- npm install -g vim-language-server
-require'lspconfig'.vimls.setup {
- cmd = {DATA_PATH .. "/lspinstall/vim/node_modules/.bin/vim-language-server", "--stdio"},
- on_attach = require'lsp'.common_on_attach
-}
diff --git a/.config/nvim/lua/lsp/yaml-ls.lua b/.config/nvim/lua/lsp/yaml-ls.lua
deleted file mode 100644
index 3fbc41e..0000000
--- a/.config/nvim/lua/lsp/yaml-ls.lua
+++ /dev/null
@@ -1,5 +0,0 @@
--- npm install -g yaml-language-server
-require'lspconfig'.yamlls.setup{
- cmd = {DATA_PATH .. "/lspinstall/yaml/node_modules/.bin/yaml-language-server", "--stdio"},
- on_attach = require'lsp'.common_on_attach,
-}