diff options
Diffstat (limited to '.config/nvim/lua/lsp')
-rw-r--r-- | .config/nvim/lua/lsp/bash.lua | 2 | ||||
-rw-r--r-- | .config/nvim/lua/lsp/docker.lua | 2 | ||||
-rw-r--r-- | .config/nvim/lua/lsp/general.lua | 15 | ||||
-rw-r--r-- | .config/nvim/lua/lsp/json.lua | 10 | ||||
-rw-r--r-- | .config/nvim/lua/lsp/lsp-config.lua | 4 | ||||
-rw-r--r-- | .config/nvim/lua/lsp/lsp-kind.lua | 26 | ||||
-rw-r--r-- | .config/nvim/lua/lsp/lua.lua | 37 | ||||
-rw-r--r-- | .config/nvim/lua/lsp/python.lua | 2 | ||||
-rw-r--r-- | .config/nvim/lua/lsp/vim.lua | 2 | ||||
-rw-r--r-- | .config/nvim/lua/lsp/wrapper.lua | 129 | ||||
-rw-r--r-- | .config/nvim/lua/lsp/yaml.lua | 2 |
11 files changed, 231 insertions, 0 deletions
diff --git a/.config/nvim/lua/lsp/bash.lua b/.config/nvim/lua/lsp/bash.lua new file mode 100644 index 0000000..8be0383 --- /dev/null +++ b/.config/nvim/lua/lsp/bash.lua @@ -0,0 +1,2 @@ +-- npm i -g bash-language-server +require'lspconfig'.bashls.setup{} diff --git a/.config/nvim/lua/lsp/docker.lua b/.config/nvim/lua/lsp/docker.lua new file mode 100644 index 0000000..ad6e220 --- /dev/null +++ b/.config/nvim/lua/lsp/docker.lua @@ -0,0 +1,2 @@ +-- npm install -g dockerfile-language-server-nodejs +require'lspconfig'.dockerls.setup{} diff --git a/.config/nvim/lua/lsp/general.lua b/.config/nvim/lua/lsp/general.lua new file mode 100644 index 0000000..fa28dbc --- /dev/null +++ b/.config/nvim/lua/lsp/general.lua @@ -0,0 +1,15 @@ +require"lspconfig".efm.setup { + init_options = {documentFormatting = true}, + filetypes = {"lua"}, + settings = { + rootMarkers = {".git/"}, + languages = { + lua = { + { + formatCommand = "lua-format -i --no-keep-simple-function-one-line --no-break-after-operator --column-limit=150 --break-after-table-lb", + formatStdin = true + } + } + } + } +} diff --git a/.config/nvim/lua/lsp/json.lua b/.config/nvim/lua/lsp/json.lua new file mode 100644 index 0000000..d13fed3 --- /dev/null +++ b/.config/nvim/lua/lsp/json.lua @@ -0,0 +1,10 @@ +-- npm install -g vscode-json-languageserver +require'lspconfig'.jsonls.setup { + commands = { + Format = { + function() + vim.lsp.buf.range_formatting({},{0,0},{vim.fn.line("$"),0}) + end + } + } +} diff --git a/.config/nvim/lua/lsp/lsp-config.lua b/.config/nvim/lua/lsp/lsp-config.lua new file mode 100644 index 0000000..fe5dfb7 --- /dev/null +++ b/.config/nvim/lua/lsp/lsp-config.lua @@ -0,0 +1,4 @@ +vim.fn.sign_define("LspDiagnosticsSignError", {text = "", numhl = "LspDiagnosticsDefaultError"}) +vim.fn.sign_define("LspDiagnosticsSignWarning", {text = "", numhl = "LspDiagnosticsDefaultWarning"}) +vim.fn.sign_define("LspDiagnosticsSignInformation", {text = "", numhl = "LspDiagnosticsDefaultInformation"}) +vim.fn.sign_define("LspDiagnosticsSignHint", {text = "", numhl = "LspDiagnosticsDefaultHint"}) diff --git a/.config/nvim/lua/lsp/lsp-kind.lua b/.config/nvim/lua/lsp/lsp-kind.lua new file mode 100644 index 0000000..de928c2 --- /dev/null +++ b/.config/nvim/lua/lsp/lsp-kind.lua @@ -0,0 +1,26 @@ +-- commented options are defaults +require('lspkind').init({ + with_text = false, + symbol_map = { + Text = ' ', + Method = ' ', + Function = ' ', + Constructor = ' ', + Variable = '[]', + Class = ' ', + Interface = ' 蘒', + Module = ' ', + Property = ' ', + Unit = ' 塞 ', + Value = ' ', + Enum = ' 練', + Keyword = ' ', + Snippet = ' ', + Color = '', + File = '', + Folder = ' ﱮ ', + EnumMember = ' ', + Constant = ' ', + Struct = ' ' + }, +}) diff --git a/.config/nvim/lua/lsp/lua.lua b/.config/nvim/lua/lsp/lua.lua new file mode 100644 index 0000000..c04219a --- /dev/null +++ b/.config/nvim/lua/lsp/lua.lua @@ -0,0 +1,37 @@ +-- https://github.com/sumneko/lua-language-server/wiki/Build-and-Run-(Standalone) +USER = vim.fn.expand('$USER') + +local sumneko_root_path = "" +local sumneko_binary = "" + +if vim.fn.has("mac") == 1 then + sumneko_root_path = "/Users/" .. USER .. "/.config/nvim/lua-language-server" + sumneko_binary = "/Users/" .. USER .. "/.config/nvim/lua-language-server/bin/macOS/lua-language-server" +elseif vim.fn.has("unix") == 1 then + sumneko_root_path = "/home/" .. USER .. "/.config/nvim/lua-language-server" + sumneko_binary = "/home/" .. USER .. "/.config/nvim/lua-language-server/bin/Linux/lua-language-server" +else + print("Unsupported system for sumneko") +end + +require'lspconfig'.sumneko_lua.setup { + cmd = {sumneko_binary, "-E", sumneko_root_path .. "/main.lua"}, + 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} + } + } + } +} diff --git a/.config/nvim/lua/lsp/python.lua b/.config/nvim/lua/lsp/python.lua new file mode 100644 index 0000000..11eeef9 --- /dev/null +++ b/.config/nvim/lua/lsp/python.lua @@ -0,0 +1,2 @@ +-- npm i -g pyright +require'lspconfig'.pyright.setup{} diff --git a/.config/nvim/lua/lsp/vim.lua b/.config/nvim/lua/lsp/vim.lua new file mode 100644 index 0000000..a7555c6 --- /dev/null +++ b/.config/nvim/lua/lsp/vim.lua @@ -0,0 +1,2 @@ +-- npm install -g vim-language-server +require'lspconfig'.vimls.setup{} diff --git a/.config/nvim/lua/lsp/wrapper.lua b/.config/nvim/lua/lsp/wrapper.lua new file mode 100644 index 0000000..7f3647c --- /dev/null +++ b/.config/nvim/lua/lsp/wrapper.lua @@ -0,0 +1,129 @@ +local lsp_wrapper = {} + +-- buf + +function lsp_wrapper.add_to_workspace_folder() + vim.lsp.buf.add_workspace_folder() +end + +function lsp_wrapper.clear_references() + vim.lsp.buf.clear_references() +end + +function lsp_wrapper.code_action() + vim.lsp.buf.code_action() +end + +function lsp_wrapper.declaration() + vim.lsp.buf.declaration() + vim.lsp.buf.clear_references() +end + +function lsp_wrapper.definition() + vim.lsp.buf.definition() + vim.lsp.buf.clear_references() +end + +function lsp_wrapper.document_highlight() + vim.lsp.buf.document_highlight() +end + +function lsp_wrapper.document_symbol() + vim.lsp.buf.document_symbol() +end + +function lsp_wrapper.formatting() + vim.lsp.buf.formatting() +end + +function lsp_wrapper.formatting_sync() + vim.lsp.buf.formatting_sync() +end + +function lsp_wrapper.hover() + vim.lsp.buf.hover() +end + +function lsp_wrapper.implementation() + vim.lsp.buf.implementation() +end + +function lsp_wrapper.incoming_calls() + vim.lsp.buf.incoming_calls() +end + +function lsp_wrapper.list_workspace_folders() + vim.lsp.buf.list_workspace_folders() +end + +function lsp_wrapper.outgoing_calls() + vim.lsp.buf.outgoing_calls() +end + +function lsp_wrapper.range_code_action() + vim.lsp.buf.range_code_action() +end + +function lsp_wrapper.range_formatting() + vim.lsp.buf.range_formatting() +end + +function lsp_wrapper.references() + vim.lsp.buf.references() + vim.lsp.buf.clear_references() +end + +function lsp_wrapper.remove_workspace_folder() + vim.lsp.buf.remove_workspace_folder() +end + +function lsp_wrapper.rename() + vim.lsp.buf.rename() +end + +function lsp_wrapper.signature_help() + vim.lsp.buf.signature_help() +end + +function lsp_wrapper.type_definition() + vim.lsp.buf.type_definition() +end + +function lsp_wrapper.workspace_symbol() + vim.lsp.buf.workspace_symbol() +end + +-- diagnostic + +function lsp_wrapper.get_all() + vim.lsp.diagnostic.get_all() +end + +function lsp_wrapper.get_next() + vim.lsp.diagnostic.get_next() +end + +function lsp_wrapper.get_prev() + vim.lsp.diagnostic.get_prev() +end + +function lsp_wrapper.goto_next() + vim.lsp.diagnostic.goto_next() +end + +function lsp_wrapper.goto_prev() + vim.lsp.diagnostic.goto_prev() +end + +function lsp_wrapper.show_line_diagnostics() + vim.lsp.diagnostic.show_line_diagnostics() +end + +-- misc + +-- :lua print(vim.inspect(vim.lsp.buf_get_clients())) + +-- autoformat +-- autocmd BufWritePre *.rs lua vim.lsp.buf.formatting_sync(nil, 1000) + +return lsp_wrapper diff --git a/.config/nvim/lua/lsp/yaml.lua b/.config/nvim/lua/lsp/yaml.lua new file mode 100644 index 0000000..904f20e --- /dev/null +++ b/.config/nvim/lua/lsp/yaml.lua @@ -0,0 +1,2 @@ +-- npm install -g yaml-language-server +require'lspconfig'.yamlls.setup{} |