New lua and ts/js lsp config.
Signed-off-by: jmug <u.g.a.mariano@gmail.com>
This commit is contained in:
parent
34d0d79a33
commit
25a1f1b1be
3 changed files with 32 additions and 52 deletions
3
init.lua
3
init.lua
|
|
@ -8,8 +8,7 @@ require('settings')
|
|||
require('lsp')
|
||||
require('lsp.typescript-ls')
|
||||
require('lsp.python-ls')
|
||||
-- require('lsp.lua-ls')
|
||||
-- require('lsp.elixir-ls')
|
||||
require('lsp.lua-ls')
|
||||
require('lsp.go-ls')
|
||||
require('lsp.ocaml-ls')
|
||||
require('lsp.sml-ls')
|
||||
|
|
|
|||
|
|
@ -1,39 +1,33 @@
|
|||
-- https://github.com/sumneko/lua-language-server/wiki/Build-and-Run-(Standalone)
|
||||
USER = vim.fn.expand('$USER')
|
||||
require'lspconfig'.lua_ls.setup {
|
||||
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 = ""
|
||||
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 = {
|
||||
client.config.settings.Lua = 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',
|
||||
-- Setup your lua path
|
||||
path = vim.split(package.path, ';')
|
||||
-- Tell the language server which version of Lua you're using
|
||||
-- (most likely LuaJIT in the case of Neovim)
|
||||
version = 'LuaJIT'
|
||||
},
|
||||
diagnostics = {
|
||||
-- Get the language server to recognize the `vim` global
|
||||
globals = {'vim'}
|
||||
},
|
||||
workspace = {
|
||||
-- Make the server aware of Neovim runtime files
|
||||
library = vim.api.nvim_get_runtime_file("", true),
|
||||
},
|
||||
telemetry = {
|
||||
enable = false,
|
||||
},
|
||||
workspace = {
|
||||
checkThirdParty = false,
|
||||
library = {
|
||||
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 = {}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,17 +1,4 @@
|
|||
require'lspconfig'.tsserver.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"},
|
||||
require'lspconfig'.ts_ls.setup{
|
||||
filetypes = { "javascript", "javascriptreact", "javascript.jsx", "typescript", "typescriptreact", "typescript.tsx" },
|
||||
root_dir = require('lspconfig/util').root_pattern("package.json", "tsconfig.json", "jsconfig.json", ".git")
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue