From c4a2316af995ef5e4c007d6d603267308d3489f0 Mon Sep 17 00:00:00 2001 From: Marco Date: Mon, 16 Oct 2023 17:14:21 +0200 Subject: [PATCH] Add lsp for css html and php --- after/plugin/lsp/lsp-css.lua | 7 ++++++ after/plugin/lsp/lsp-html.lua | 7 ++++++ after/plugin/lsp/lsp-lua.lua | 47 ++++++++++++++--------------------- after/plugin/lsp/lsp-php.lua | 1 + 4 files changed, 34 insertions(+), 28 deletions(-) create mode 100644 after/plugin/lsp/lsp-css.lua create mode 100644 after/plugin/lsp/lsp-html.lua create mode 100644 after/plugin/lsp/lsp-php.lua diff --git a/after/plugin/lsp/lsp-css.lua b/after/plugin/lsp/lsp-css.lua new file mode 100644 index 0000000..2216419 --- /dev/null +++ b/after/plugin/lsp/lsp-css.lua @@ -0,0 +1,7 @@ +--Enable (broadcasting) snippet capability for completion +local capabilities = vim.lsp.protocol.make_client_capabilities() +capabilities.textDocument.completion.completionItem.snippetSupport = true + +require'lspconfig'.cssls.setup { + capabilities = capabilities, +} diff --git a/after/plugin/lsp/lsp-html.lua b/after/plugin/lsp/lsp-html.lua new file mode 100644 index 0000000..2171ad5 --- /dev/null +++ b/after/plugin/lsp/lsp-html.lua @@ -0,0 +1,7 @@ +--Enable (broadcasting) snippet capability for completion +local capabilities = vim.lsp.protocol.make_client_capabilities() +capabilities.textDocument.completion.completionItem.snippetSupport = true + +require'lspconfig'.html.setup { + capabilities = capabilities, +} diff --git a/after/plugin/lsp/lsp-lua.lua b/after/plugin/lsp/lsp-lua.lua index 67bb36a..16e97a0 100644 --- a/after/plugin/lsp/lsp-lua.lua +++ b/after/plugin/lsp/lsp-lua.lua @@ -1,31 +1,22 @@ --- lua lsp is not installed by packer but is actually a package installed with pacman -require'lspconfig'.lua_ls.setup { - on_init = function(client) - local path = client.workspace_folders[1].name - if not vim.loop.fs_stat(path..'/.luarc.json') and not vim.loop.fs_stat(path..'/.luarc.jsonc') then - client.config.settings = vim.tbl_deep_extend('force', client.config.settings, { - Lua = { - runtime = { - -- Tell the language server which version of Lua you're using - -- (most likely LuaJIT in the case of Neovim) - version = 'LuaJIT' - }, - -- Make the server aware of Neovim runtime files - workspace = { - checkThirdParty = false, - library = { - vim.env.VIMRUNTIME - -- "${3rd}/luv/library" - -- "${3rd}/busted/library", - } - -- or pull in all of 'runtimepath'. NOTE: this is a lot slower - -- library = vim.api.nvim_get_runtime_file("", true) - } - } - }) +-- lua lsp is not installed by packer but is actually a package installed with pacman +require 'lspconfig'.lua_ls.setup { + on_init = function(client) + local path = client.workspace_folders[1].name + if not vim.loop.fs_stat(path .. '/.luarc.json') and not vim.loop.fs_stat(path .. '/.luarc.jsonc') then + client.config.settings = vim.tbl_deep_extend('force', client.config.settings, { + Lua = { + runtime = { + version = 'LuaJIT' + }, + workspace = { + checkThirdParty = false, + library = vim.api.nvim_get_runtime_file("", true) + } + } + }) - client.notify("workspace/didChangeConfiguration", { settings = client.config.settings }) + client.notify("workspace/didChangeConfiguration", { settings = client.config.settings }) + end + return true end - return true - end } diff --git a/after/plugin/lsp/lsp-php.lua b/after/plugin/lsp/lsp-php.lua new file mode 100644 index 0000000..9b2fa18 --- /dev/null +++ b/after/plugin/lsp/lsp-php.lua @@ -0,0 +1 @@ +require'lspconfig'.phpactor.setup{}