aboutsummaryrefslogtreecommitdiffstats
path: root/lua/alpha/lsp/servers
diff options
context:
space:
mode:
authorAriel D'Alessandro <dalessandro.ariel@gmail.com>2023-09-18 23:13:11 +0200
committerAriel D'Alessandro <dalessandro.ariel@gmail.com>2023-09-18 23:13:11 +0200
commitaf18201866ea29d179fd61bacd36b849a7d86a7d (patch)
treef91a593c1eac7e5cee50ed470fde903e0ae7ad17 /lua/alpha/lsp/servers
parentf64a1630423087bb020c2c0ea341136abd725c38 (diff)
downloadnvim-conf-af18201866ea29d179fd61bacd36b849a7d86a7d.tar.gz
nvim-conf-af18201866ea29d179fd61bacd36b849a7d86a7d.zip
refactor lsp configurations
Diffstat (limited to 'lua/alpha/lsp/servers')
-rw-r--r--lua/alpha/lsp/servers/emmet_ls.lua12
-rw-r--r--lua/alpha/lsp/servers/html.lua14
-rw-r--r--lua/alpha/lsp/servers/jsonls.lua14
-rw-r--r--lua/alpha/lsp/servers/lua_ls.lua29
-rw-r--r--lua/alpha/lsp/servers/phpactor.lua28
-rw-r--r--lua/alpha/lsp/servers/rust_analyzer.lua24
-rw-r--r--lua/alpha/lsp/servers/tsserver.lua33
7 files changed, 154 insertions, 0 deletions
diff --git a/lua/alpha/lsp/servers/emmet_ls.lua b/lua/alpha/lsp/servers/emmet_ls.lua
new file mode 100644
index 0000000..c4f1cb6
--- /dev/null
+++ b/lua/alpha/lsp/servers/emmet_ls.lua
@@ -0,0 +1,12 @@
+local lsp_attach = require "alpha.lsp.attach"
+local lsp_flags = require "alpha.lsp.flags"
+
+return function(ops)
+ local capabilities = require("cmp_nvim_lsp").default_capabilities(vim.lsp.protocol.make_client_capabilities())
+ return vim.tbl_extend("force", {
+ on_attach = lsp_attach,
+ flags = lsp_flags,
+ capabilities = capabilities,
+ filetypes = { "html", "typescriptreact", "javascriptreact", "css", "sass", "scss", "less", "blade", "vue" },
+ }, ops)
+end
diff --git a/lua/alpha/lsp/servers/html.lua b/lua/alpha/lsp/servers/html.lua
new file mode 100644
index 0000000..7b8ef54
--- /dev/null
+++ b/lua/alpha/lsp/servers/html.lua
@@ -0,0 +1,14 @@
+local lsp_attach = require "alpha.lsp.attach"
+local lsp_flags = require "alpha.lsp.flags"
+
+return function(ops)
+ local config = {
+ on_attach = lsp_attach,
+ flags = lsp_flags,
+ }
+ if vim.fn.executable "html-languageserver" == 1 then
+ config.cmd = { "html-languageserver", "--stdio" }
+ end
+
+ return vim.tbl_extend("force", config, ops)
+end
diff --git a/lua/alpha/lsp/servers/jsonls.lua b/lua/alpha/lsp/servers/jsonls.lua
new file mode 100644
index 0000000..9c731ab
--- /dev/null
+++ b/lua/alpha/lsp/servers/jsonls.lua
@@ -0,0 +1,14 @@
+local lsp_attach = require "alpha.lsp.attach"
+local lsp_flags = require "alpha.lsp.flags"
+
+return function(ops)
+ local config = {
+ on_attach = lsp_attach,
+ flags = lsp_flags,
+ }
+ if vim.fn.executable "json-languageserver" == 1 then
+ config.cmd = { "json-languageserver", "--stdio" }
+ end
+
+ return vim.tbl_extend("force", config, ops)
+end
diff --git a/lua/alpha/lsp/servers/lua_ls.lua b/lua/alpha/lsp/servers/lua_ls.lua
new file mode 100644
index 0000000..64f012c
--- /dev/null
+++ b/lua/alpha/lsp/servers/lua_ls.lua
@@ -0,0 +1,29 @@
+local lsp_attach = require "alpha.lsp.attach"
+local lsp_flags = require("alpha.lsp.flags")
+
+return function(ops)
+ return vim.tbl_extend("force", {
+ on_attach = lsp_attach,
+ flags = lsp_flags,
+ settings = {
+ Lua = {
+ runtime = {
+ version = "LuaJIT",
+ },
+ diagnostics = {
+ globals = { "vim" },
+ },
+ workspace = {
+ library = vim.api.nvim_get_runtime_file("", true),
+ checkThirdParty = false,
+ },
+ telemetry = {
+ enable = false,
+ },
+ hint = {
+ enable = true,
+ },
+ },
+ },
+ }, ops)
+end
diff --git a/lua/alpha/lsp/servers/phpactor.lua b/lua/alpha/lsp/servers/phpactor.lua
new file mode 100644
index 0000000..fd25568
--- /dev/null
+++ b/lua/alpha/lsp/servers/phpactor.lua
@@ -0,0 +1,28 @@
+local lsp_attach = require "alpha.lsp.attach"
+local lsp_flags = require "alpha.lsp.flags"
+
+return function(ops)
+ return vim.tbl_extend("force", {
+ on_attach = lsp_attach,
+ flags = lsp_flags,
+ filetypes = { "php", "blade" },
+ init_options = {
+ ["language_server_worse_reflection.inlay_hints.enable"] = true,
+ ["language_server_worse_reflection.inlay_hints.params"] = true,
+ -- ["language_server_worse_reflection.inlay_hints.types"] = true,
+ ["language_server_configuration.auto_config"] = false,
+ ["code_transform.import_globals"] = true,
+ ["language_server_phpstan.enabled"] = true,
+ ["language_server_phpstan.level"] = 7,
+ ["language_server_phpstan.bin"] = "phpstan",
+ },
+ handlers = {
+ ["textDocument/inlayHint"] = function(err, result, ...)
+ for _, res in ipairs(result) do
+ res.label = res.label .. ": "
+ end
+ vim.lsp.handlers["textDocument/inlayHint"](err, result, ...)
+ end,
+ },
+ }, ops)
+end
diff --git a/lua/alpha/lsp/servers/rust_analyzer.lua b/lua/alpha/lsp/servers/rust_analyzer.lua
new file mode 100644
index 0000000..c0db321
--- /dev/null
+++ b/lua/alpha/lsp/servers/rust_analyzer.lua
@@ -0,0 +1,24 @@
+local lsp_attach = require "alpha.lsp.attach"
+local lsp_flags = require "alpha.lsp.flags"
+
+return function(ops)
+ return vim.tbl_extend("force", {
+ on_attach = lsp_attach,
+ flags = lsp_flags,
+ settings = {
+ ["rust-analyzer"] = {
+ checkOnSave = {
+ allFeatures = true,
+ overrideCommand = {
+ "cargo",
+ "clippy",
+ "--workspace",
+ "--message-format=json",
+ "--all-targets",
+ "--all-features",
+ },
+ },
+ },
+ },
+ }, ops)
+end
diff --git a/lua/alpha/lsp/servers/tsserver.lua b/lua/alpha/lsp/servers/tsserver.lua
new file mode 100644
index 0000000..e27d94a
--- /dev/null
+++ b/lua/alpha/lsp/servers/tsserver.lua
@@ -0,0 +1,33 @@
+local lsp_attach = require "alpha.lsp.attach"
+local lsp_flags = require "alpha.lsp.flags"
+
+return function(ops)
+ return vim.tbl_extend("force", {
+ on_attach = lsp_attach,
+ flags = lsp_flags,
+ settings = {
+ typescript = {
+ inlayHints = {
+ includeInlayParameterNameHints = "all",
+ includeInlayParameterNameHintsWhenArgumentMatchesName = false,
+ includeInlayFunctionParameterTypeHints = true,
+ includeInlayVariableTypeHints = true,
+ includeInlayPropertyDeclarationTypeHints = true,
+ includeInlayFunctionLikeReturnTypeHints = true,
+ includeInlayEnumMemberValueHints = true,
+ },
+ },
+ javascript = {
+ inlayHints = {
+ includeInlayParameterNameHints = "all",
+ includeInlayParameterNameHintsWhenArgumentMatchesName = false,
+ includeInlayFunctionParameterTypeHints = true,
+ includeInlayVariableTypeHints = true,
+ includeInlayPropertyDeclarationTypeHints = true,
+ includeInlayFunctionLikeReturnTypeHints = true,
+ includeInlayEnumMemberValueHints = true,
+ },
+ },
+ },
+ }, ops)
+end