aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lua/lspconfig/server_configurations/sourcekit.lua10
1 files changed, 8 insertions, 2 deletions
diff --git a/lua/lspconfig/server_configurations/sourcekit.lua b/lua/lspconfig/server_configurations/sourcekit.lua
index e6f6017d..f5ce4130 100644
--- a/lua/lspconfig/server_configurations/sourcekit.lua
+++ b/lua/lspconfig/server_configurations/sourcekit.lua
@@ -4,7 +4,13 @@ return {
default_config = {
cmd = { 'sourcekit-lsp' },
filetypes = { 'swift', 'c', 'cpp', 'objective-c', 'objective-cpp' },
- root_dir = util.root_pattern('Package.swift', 'buildServer.json', 'compile_commands.json', '.git'),
+ root_dir = function(filename, _)
+ return util.root_pattern 'buildServer.json'(filename)
+ or util.root_pattern('*.xcodeproj', '*.xcworkspace')(filename)
+ or util.find_git_ancestor(filename)
+ -- better to keep it at the end, because some modularized apps contain multiple Package.swift files
+ or util.root_pattern('compile_commands.json', 'Package.swift')(filename)
+ end,
},
docs = {
description = [[
@@ -13,7 +19,7 @@ https://github.com/apple/sourcekit-lsp
Language server for Swift and C/C++/Objective-C.
]],
default_config = {
- root_dir = [[root_pattern("Package.swift", ".git")]],
+ root_dir = [[root_pattern("buildServer.json", "*.xcodeproj", "*.xcworkspace", ".git", "compile_commands.json", "Package.swift")]],
},
},
}