New lua and ts/js lsp config.

Signed-off-by: jmug <u.g.a.mariano@gmail.com>
This commit is contained in:
Mariano Uvalle 2024-11-30 23:42:20 +00:00
parent 34d0d79a33
commit 25a1f1b1be
3 changed files with 32 additions and 52 deletions

View file

@ -8,8 +8,7 @@ require('settings')
require('lsp') require('lsp')
require('lsp.typescript-ls') require('lsp.typescript-ls')
require('lsp.python-ls') require('lsp.python-ls')
-- require('lsp.lua-ls') require('lsp.lua-ls')
-- require('lsp.elixir-ls')
require('lsp.go-ls') require('lsp.go-ls')
require('lsp.ocaml-ls') require('lsp.ocaml-ls')
require('lsp.sml-ls') require('lsp.sml-ls')

View file

@ -1,39 +1,33 @@
-- https://github.com/sumneko/lua-language-server/wiki/Build-and-Run-(Standalone) require'lspconfig'.lua_ls.setup {
USER = vim.fn.expand('$USER') on_init = function(client)
if client.workspace_folders then
local path = client.workspace_folders[1].name
if vim.uv.fs_stat(path..'/.luarc.json') or vim.uv.fs_stat(path..'/.luarc.jsonc') then
return
end
end
local sumneko_root_path = "" client.config.settings.Lua = vim.tbl_deep_extend('force', client.config.settings.Lua, {
local sumneko_binary = ""
if vim.fn.has("mac") == 1 then
sumneko_root_path = "/Users/" .. USER .. "/.config/nvim/lang-srvrs/lua-language-server"
sumneko_binary = "/Users/" .. USER .. "/.config/nvim/lang-srvrs/lua-language-server/bin/macOS/lua-language-server"
elseif vim.fn.has("unix") == 1 then
sumneko_root_path = "/home/" .. USER .. "/.config/nvim/lang-srvrs/lua-language-server"
sumneko_binary = "/home/" .. USER .. "/.config/nvim/lang-srvrs/lua-language-server/bin/Linux/lua-language-server"
else
print("Unsupported system for sumneko")
end
require'lspconfig'.sumneko_lua.setup {
settings = {
Lua = {
runtime = { runtime = {
-- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim) -- Tell the language server which version of Lua you're using
version = 'LuaJIT', -- (most likely LuaJIT in the case of Neovim)
-- Setup your lua path version = 'LuaJIT'
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 -- Make the server aware of Neovim runtime files
library = vim.api.nvim_get_runtime_file("", true), workspace = {
}, checkThirdParty = false,
telemetry = { library = {
enable = false, vim.env.VIMRUNTIME
}, -- Depending on the usage, you might want to add additional paths here.
-- "${3rd}/luv/library"
-- "${3rd}/busted/library",
} }
-- or pull in all of 'runtimepath'. NOTE: this is a lot slower and will cause issues when working on your own configuration (see https://github.com/neovim/nvim-lspconfig/issues/3189)
-- library = vim.api.nvim_get_runtime_file("", true)
}
})
end,
settings = {
Lua = {}
} }
} }

View file

@ -1,17 +1,4 @@
require'lspconfig'.tsserver.setup{ require'lspconfig'.ts_ls.setup{
on_attach = function(client, bufnr)
require "lsp_signature".on_attach({
bind = false,
-- floating_window = true,
--hint_enable = true,
fix_pos = true,
use_lspsaga = true,
--handler_opts = {
-- border = "single" -- double, single, shadow, none
--},
})
end,
cmd = {DATA_PATH .. "/lspinstall/typescript/node_modules/.bin/typescript-language-server", "--stdio"},
filetypes = { "javascript", "javascriptreact", "javascript.jsx", "typescript", "typescriptreact", "typescript.tsx" }, filetypes = { "javascript", "javascriptreact", "javascript.jsx", "typescript", "typescriptreact", "typescript.tsx" },
root_dir = require('lspconfig/util').root_pattern("package.json", "tsconfig.json", "jsconfig.json", ".git") root_dir = require('lspconfig/util').root_pattern("package.json", "tsconfig.json", "jsconfig.json", ".git")
} }