mirror of
https://github.com/LunarVim/LunarVim.git
synced 2025-07-12 10:24:43 +02:00
easy install LSP
This commit is contained in:
parent
353a643170
commit
7367ca68b7
7 changed files with 14 additions and 26 deletions
1
init.lua
1
init.lua
|
@ -1,6 +1,7 @@
|
||||||
-- General mappings
|
-- General mappings
|
||||||
require('plugins')
|
require('plugins')
|
||||||
require('nv-utils')
|
require('nv-utils')
|
||||||
|
require('nv-globals')
|
||||||
require('settings')
|
require('settings')
|
||||||
require('keymappings')
|
require('keymappings')
|
||||||
require('colorscheme')
|
require('colorscheme')
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
-- require'illuminate'.on_attach(client)
|
-- require'illuminate'.on_attach(client)
|
||||||
-- end
|
-- end
|
||||||
require'lspconfig'.tsserver.setup {
|
require'lspconfig'.tsserver.setup {
|
||||||
|
cmd = {DATA_PATH .. "/lspinstall/typescript/node_modules/.bin/typescript-language-server", "--stdio"},
|
||||||
on_attach = require'lsp'.tsserver_on_attach,
|
on_attach = require'lsp'.tsserver_on_attach,
|
||||||
-- This makes sure tsserver is not used for formatting (I prefer prettier)
|
-- This makes sure tsserver is not used for formatting (I prefer prettier)
|
||||||
-- on_attach = require'lsp'.common_on_attach,
|
-- on_attach = require'lsp'.common_on_attach,
|
||||||
|
|
|
@ -1,22 +1,7 @@
|
||||||
-- https://github.com/sumneko/lua-language-server/wiki/Build-and-Run-(Standalone)
|
-- https://github.com/sumneko/lua-language-server/wiki/Build-and-Run-(Standalone)
|
||||||
USER = vim.fn.expand('$USER')
|
-- USER = vim.fn.expand('$USER')
|
||||||
|
local sumneko_root_path = DATA_PATH .. "/lspinstall/lua"
|
||||||
local sumneko_root_path = ""
|
local sumneko_binary = sumneko_root_path .. "/sumneko-lua-language-server"
|
||||||
local sumneko_binary = ""
|
|
||||||
|
|
||||||
if vim.fn.has("mac") == 1 then
|
|
||||||
sumneko_root_path = "/Users/" .. USER ..
|
|
||||||
"/.config/nvim/.language-servers/lua-language-server"
|
|
||||||
sumneko_binary = "/Users/" .. USER ..
|
|
||||||
"/.config/nvim/.language-servers/lua-language-server/bin/macOS/lua-language-server"
|
|
||||||
elseif vim.fn.has("unix") == 1 then
|
|
||||||
sumneko_root_path = "/home/" .. USER ..
|
|
||||||
"/.config/nvim/.language-servers/lua-language-server"
|
|
||||||
sumneko_binary = "/home/" .. USER ..
|
|
||||||
"/.config/nvim/.language-servers/lua-language-server/bin/Linux/lua-language-server"
|
|
||||||
else
|
|
||||||
print("Unsupported system for sumneko")
|
|
||||||
end
|
|
||||||
|
|
||||||
require'lspconfig'.sumneko_lua.setup {
|
require'lspconfig'.sumneko_lua.setup {
|
||||||
cmd = {sumneko_binary, "-E", sumneko_root_path .. "/main.lua"},
|
cmd = {sumneko_binary, "-E", sumneko_root_path .. "/main.lua"},
|
||||||
|
@ -35,10 +20,7 @@ require'lspconfig'.sumneko_lua.setup {
|
||||||
},
|
},
|
||||||
workspace = {
|
workspace = {
|
||||||
-- Make the server aware of Neovim runtime files
|
-- Make the server aware of Neovim runtime files
|
||||||
library = {
|
library = {[vim.fn.expand('$VIMRUNTIME/lua')] = true, [vim.fn.expand('$VIMRUNTIME/lua/vim/lsp')] = true}
|
||||||
[vim.fn.expand('$VIMRUNTIME/lua')] = true,
|
|
||||||
[vim.fn.expand('$VIMRUNTIME/lua/vim/lsp')] = true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
-- npm i -g pyright
|
-- npm i -g pyright
|
||||||
-- local capabilities = vim.lsp.protocol.make_client_capabilities()
|
-- local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||||
-- capabilities.textDocument.completion.completionItem.snippetSupport = true
|
-- capabilities.textDocument.completion.completionItem.snippetSupport = true
|
||||||
require'lspconfig'.pyright.setup{
|
require'lspconfig'.pyright.setup {
|
||||||
on_attach = require'lsp'.common_on_attach,
|
cmd = {DATA_PATH .. "/lspinstall/python/node_modules/.bin/pyright-langserver", "--stdio"},
|
||||||
|
on_attach = require'lsp'.common_on_attach
|
||||||
-- capabilities = capabilities
|
-- capabilities = capabilities
|
||||||
}
|
}
|
||||||
|
|
2
lua/nv-globals.lua
Normal file
2
lua/nv-globals.lua
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
DATA_PATH = vim.fn.stdpath('data')
|
||||||
|
CACHE_PATH = vim.fn.stdpath('cache')
|
|
@ -35,8 +35,8 @@ nv_utils.define_augroups({
|
||||||
{'BufWinEnter', '.sol', 'setlocal filetype=solidity'},
|
{'BufWinEnter', '.sol', 'setlocal filetype=solidity'},
|
||||||
|
|
||||||
{'FileType', 'dashboard', 'set showtabline=0 | autocmd WinLeave <buffer> set showtabline=2'},
|
{'FileType', 'dashboard', 'set showtabline=0 | autocmd WinLeave <buffer> set showtabline=2'},
|
||||||
{'BufRead', '*.sol', 'setlocal filetype=solidity'},
|
{'BufRead', '*.sol', 'setlocal filetype=solidity'}, {'BufNewFile', '*.sol', 'setlocal filetype=solidity'},
|
||||||
{'BufNewFile', '*.sol', 'setlocal filetype=solidity'},
|
|
||||||
{'BufWritePre', '*.jsx', 'lua vim.lsp.buf.formatting_sync(nil, 1000)'},
|
{'BufWritePre', '*.jsx', 'lua vim.lsp.buf.formatting_sync(nil, 1000)'},
|
||||||
{'BufWritePre', '*.js', 'lua vim.lsp.buf.formatting_sync(nil, 1000)'},
|
{'BufWritePre', '*.js', 'lua vim.lsp.buf.formatting_sync(nil, 1000)'},
|
||||||
{'BufWritePre', '*.py', 'lua vim.lsp.buf.formatting_sync(nil, 1000)'},
|
{'BufWritePre', '*.py', 'lua vim.lsp.buf.formatting_sync(nil, 1000)'},
|
||||||
|
|
|
@ -27,6 +27,7 @@ return require('packer').startup(function(use)
|
||||||
use 'onsails/lspkind-nvim'
|
use 'onsails/lspkind-nvim'
|
||||||
use 'kosayoda/nvim-lightbulb'
|
use 'kosayoda/nvim-lightbulb'
|
||||||
use 'mfussenegger/nvim-jdtls'
|
use 'mfussenegger/nvim-jdtls'
|
||||||
|
use 'kabouzeid/nvim-lspinstall'
|
||||||
|
|
||||||
-- Debugging
|
-- Debugging
|
||||||
use 'mfussenegger/nvim-dap'
|
use 'mfussenegger/nvim-dap'
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue