-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
30 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,41 @@ | ||
local fn = vim.fn | ||
local common_on_attach = require('lsp.utils').common_on_attach | ||
|
||
local system_name | ||
if fn.has('mac') == 1 then | ||
system_name = 'macOS' | ||
elseif fn.has('unix') == 1 then | ||
system_name = 'Linux' | ||
elseif fn.has('win32') == 1 then | ||
system_name = 'Windows' | ||
else | ||
print('Unsuported system for sumneko') | ||
end | ||
|
||
local runtime_path = vim.split(package.path, ';') | ||
table.insert(runtime_path, "lua/?.lua") | ||
table.insert(runtime_path, "lua/?/init.lua") | ||
|
||
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 | ||
|
||
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' | ||
}, | ||
-- Make the server aware of Neovim runtime files | ||
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 = { | ||
runtime = { version = 'LuaJIT', path = runtime_path }, | ||
diagnostics = { globals = { 'vim' } }, | ||
workspace = { library = vim.api.nvim_get_runtime_file("", true) }, | ||
telemetry = { enable = false } | ||
} | ||
Lua = {} | ||
}, | ||
on_attach = common_on_attach | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters