update lsp.lua so it works again with sourcekit (swift)
This commit is contained in:
1 parent
1d77c215ea
commit
00228510f3
1 file changed
+11
-5
@@ -99,6 +99,9 @@ return { {
|
||||
vim.api.nvim_create_autocmd('LspAttach', {
|
||||
desc = 'LSP actions',
|
||||
callback = function(event)
|
||||
vim.lsp.inlay_hint.enable(true, { bufnr = event.buf })
|
||||
vim.lsp.inline_completion.enable(true, { bufnr = event.buf })
|
||||
|
||||
-- Autoformat on save
|
||||
local id = vim.tbl_get(event, 'data', 'client_id')
|
||||
local client = id and vim.lsp.get_client_by_id(id)
|
||||
@@ -196,12 +199,15 @@ return { {
|
||||
cmd = {
|
||||
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/sourcekit-lsp",
|
||||
},
|
||||
root_dir = function(filename, _)
|
||||
root_dir = function(bufnr, on_dir)
|
||||
local fname = vim.api.nvim_buf_get_name(bufnr)
|
||||
local util = require("lspconfig.util")
|
||||
return util.root_pattern("buildServer.json")(filename)
|
||||
or util.root_pattern("*.xcodeproj", "*.xcworkspace")(filename)
|
||||
or util.find_git_ancestor(filename)
|
||||
or util.root_pattern("Package.swift")(filename)
|
||||
on_dir(
|
||||
util.root_pattern("buildServer.json")(fname)
|
||||
or util.root_pattern("*.xcodeproj", "*.xcworkspace")(fname)
|
||||
or util.root_pattern("Package.swift")(fname)
|
||||
or vim.fs.root(fname, ".git")
|
||||
)
|
||||
end,
|
||||
})
|
||||
|
||||
|
||||
Reference in new issue
Block a user