neovim, emacs: manually configure sumneko_lua

Also neovim: disable options already set (see ':h nvim-defaults')
This commit is contained in:
FollieHiyuki 2021-09-30 17:09:53 +07:00
parent 5b79df9f6f
commit 820929c2cb
No known key found for this signature in database
GPG Key ID: 813CF484F4993419
3 changed files with 53 additions and 26 deletions

View File

@ -178,8 +178,17 @@
(setq lsp-clients-lua-language-server-bin (expand-file-name "lsp/lua-language-server/bin/Linux/lua-language-server" doom-etc-dir) (setq lsp-clients-lua-language-server-bin (expand-file-name "lsp/lua-language-server/bin/Linux/lua-language-server" doom-etc-dir)
lsp-clients-lua-language-server-main-location (expand-file-name "lsp/lua-language-server/main.lua" doom-etc-dir) lsp-clients-lua-language-server-main-location (expand-file-name "lsp/lua-language-server/main.lua" doom-etc-dir)
lsp-lua-completion-call-snippet "Replace" lsp-lua-completion-call-snippet "Replace"
lsp-lua-hint-enable t
lsp-lua-runtime-path ["?.lua"
"?/init.lua"
"?/?.lua"
"/home/follie/.luarocks/share/lua/5.3/?.lua"
"/home/follie/.luarocks/share/lua/5.3/?/init.lua"
"/usr/share/lua/5.3/?/init.lua"
"/usr/share/5.3/?.lua"]
lsp-lua-runtime-version "Lua 5.3"
lsp-lua-telemetry-enable nil lsp-lua-telemetry-enable nil
lsp-lua-hint-enable t)) lsp-lua-workspace-library '((/home/follie/.luarocks/share/lua/5.3 . t) (/usr/share/lua/5.3 . t))))
;; Quicker which-key ;; Quicker which-key
(after! which-key (after! which-key

View File

@ -89,9 +89,34 @@ function M.lsp_conf()
} }
-- Lua -- Lua
local runtime_path = vim.split(package.path, ';') local lua_lib_path = {}
table.insert(runtime_path, 'lua/?.lua') local lua_runtime_path = {}
table.insert(runtime_path, 'lua/?/init.lua')
-- lua_lib_path[vim.fn.expand('~/.luarocks/share/lua/5.3')] = true
-- lua_lib_path[vim.fn.expand('/usr/share/lua/5.3')] = true
lua_lib_path[os.getenv('VIMRUNTIME') .. '/lua'] = true
-- local function add(lib)
-- for _, p in pairs(vim.fn.expand(lib .. '/lua', false, true)) do
-- p = vim.loop.fs_realpath(p)
-- if p then lua_lib_path[p] = true end
-- end
-- end
-- for _, site in pairs(vim.split(vim.o.packpath, ',')) do
-- add(site .. '/pack/*/opt/*')
-- add(site .. '/pack/*/start/*')
-- end
table.insert(lua_runtime_path, 'lua/?.lua')
table.insert(lua_runtime_path, 'lua/?/init.lua')
-- table.insert(lua_runtime_path, '?.lua')
-- table.insert(lua_runtime_path, '?/?.lua')
-- table.insert(lua_runtime_path, '?/init.lua')
for lib, _ in pairs(lua_lib_path) do
table.insert(lua_runtime_path, lib .. '/?.lua')
table.insert(lua_runtime_path, lib .. '/?/init.lua')
end
lspconf.sumneko_lua.setup { lspconf.sumneko_lua.setup {
on_attach = on_attach, on_attach = on_attach,
capabilities = capabilities, capabilities = capabilities,
@ -103,10 +128,10 @@ function M.lsp_conf()
settings = { settings = {
Lua = { Lua = {
diagnostics = {globals = {'vim'}}, diagnostics = {globals = {'vim'}},
runtime = {version = 'LuaJIT', path = runtime_path}, runtime = {version = 'LuaJIT', path = lua_runtime_path},
workspace = { workspace = {
library = vim.api.nvim_get_runtime_file('', true), library = lua_lib_path,
maxPreload = 1500, maxPreload = 1000,
preloadFileSize = 150 preloadFileSize = 150
}, },
completion = {callSnippet = 'Replace'}, completion = {callSnippet = 'Replace'},
@ -144,15 +169,8 @@ function M.lsp_conf()
-- Others -- Others
local servers = { local servers = {
'dockerls', 'dockerls', 'bashls', 'pyright', 'tsserver',
'bashls', 'html', 'jsonls', 'cmake', 'sqls', 'rust_analyzer'
'pyright',
'tsserver',
'html',
'jsonls',
'cmake',
'sqls',
'rust_analyzer'
} }
for _, server in ipairs(servers) do for _, server in ipairs(servers) do
lspconf[server].setup { lspconf[server].setup {

View File

@ -36,7 +36,7 @@ function M.load_options()
opt.mouse = 'nv' opt.mouse = 'nv'
opt.errorbells = false opt.errorbells = false
opt.visualbell = false opt.visualbell = false
opt.hidden = true -- opt.hidden = true
opt.fileformats = 'unix' opt.fileformats = 'unix'
opt.magic = true opt.magic = true
opt.virtualedit = 'block' opt.virtualedit = 'block'
@ -45,18 +45,18 @@ function M.load_options()
opt.clipboard = 'unnamedplus' opt.clipboard = 'unnamedplus'
opt.wildignorecase = true opt.wildignorecase = true
opt.wildignore = '.git,.hg,.svn,*.pyc,*.o,*.out,*.jpg,*.jpeg,*.png,*.gif,*.zip,**/tmp/**,*.DS_Store,**/node_modules/**' opt.wildignore = '.git,.hg,.svn,*.pyc,*.o,*.out,*.jpg,*.jpeg,*.png,*.gif,*.zip,**/tmp/**,*.DS_Store,**/node_modules/**'
opt.history = 1000 -- opt.history = 10000
-- opt.showmode = false -- opt.showmode = false
opt.jumpoptions = 'stack' opt.jumpoptions = 'stack'
opt.formatoptions = '1jcroql' opt.formatoptions = '1jcroql'
opt.shortmess = 'aoOTIcF' opt.shortmess = 'aoOTIcF'
opt.startofline = false -- opt.startofline = false
opt.wrap = false opt.wrap = false
opt.sidescrolloff = 4 opt.sidescrolloff = 4
opt.scrolloff = 4 opt.scrolloff = 4
opt.whichwrap = '<,>,[,],~' opt.whichwrap = '<,>,[,],~'
opt.ruler = true -- opt.ruler = true
opt.display = 'lastline' -- opt.display = 'lastline'
-- opt.colorcolumn = '80' -- opt.colorcolumn = '80'
-- opt.cursorline = true -- opt.cursorline = true
-- opt.backspace = 'indent,eol,start' -- opt.backspace = 'indent,eol,start'
@ -65,7 +65,7 @@ function M.load_options()
-- opt.cmdheight = 2 -- opt.cmdheight = 2
-- opt.cmdwinheight = 6 -- opt.cmdwinheight = 6
opt.showtabline = 2 opt.showtabline = 2
opt.laststatus = 2 -- opt.laststatus = 2
-- opt.textwidth = 80 -- opt.textwidth = 80
opt.synmaxcol = 2500 opt.synmaxcol = 2500
-- opt.shell = 'bash' -- opt.shell = 'bash'
@ -90,7 +90,7 @@ function M.load_options()
opt.infercase = true opt.infercase = true
-- Searching -- Searching
opt.incsearch = true -- opt.incsearch = true
opt.hlsearch = false opt.hlsearch = false
-- opt.wrapscan = true -- opt.wrapscan = true
@ -108,7 +108,7 @@ function M.load_options()
opt.swapfile = false opt.swapfile = false
-- Completion menu -- Completion menu
opt.wildmenu = true -- opt.wildmenu = true
opt.wildmode = 'full' opt.wildmode = 'full'
opt.complete = '.,w,b,k' opt.complete = '.,w,b,k'
opt.completeopt = 'menu,menuone,noselect' opt.completeopt = 'menu,menuone,noselect'
@ -137,7 +137,7 @@ function M.load_options()
opt.smarttab = true opt.smarttab = true
opt.expandtab = true opt.expandtab = true
opt.smartindent = true opt.smartindent = true
opt.autoindent = true -- opt.autoindent = true
opt.shiftround = true opt.shiftround = true
-- Trailings, line break -- Trailings, line break
@ -150,7 +150,7 @@ function M.load_options()
-- Undo file path -- Undo file path
opt.undofile = true opt.undofile = true
opt.undodir = vim.fn.stdpath('data') .. '/undodir' -- opt.undodir = vim.fn.stdpath('data') .. '/undo'
end end
return M return M