Move lsp config to local file structure
This commit is contained in:
parent
e5c3bb2492
commit
20801272fc
383 changed files with 11829 additions and 114 deletions
40
.config/nvim/lsp/sourcekit.lua
Normal file
40
.config/nvim/lsp/sourcekit.lua
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
---@brief
|
||||
---
|
||||
--- https://github.com/swiftlang/sourcekit-lsp
|
||||
---
|
||||
--- Language server for Swift and C/C++/Objective-C.
|
||||
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
---@type vim.lsp.Config
|
||||
return {
|
||||
cmd = { 'sourcekit-lsp' },
|
||||
filetypes = { 'swift', 'objc', 'objcpp', 'c', 'cpp' },
|
||||
root_dir = function(bufnr, on_dir)
|
||||
local filename = vim.api.nvim_buf_get_name(bufnr)
|
||||
on_dir(
|
||||
util.root_pattern('buildServer.json', '.bsp')(filename)
|
||||
or util.root_pattern('*.xcodeproj', '*.xcworkspace')(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)
|
||||
or vim.fs.dirname(vim.fs.find('.git', { path = filename, upward = true })[1])
|
||||
)
|
||||
end,
|
||||
get_language_id = function(_, ftype)
|
||||
local t = { objc = 'objective-c', objcpp = 'objective-cpp' }
|
||||
return t[ftype] or ftype
|
||||
end,
|
||||
capabilities = {
|
||||
workspace = {
|
||||
didChangeWatchedFiles = {
|
||||
dynamicRegistration = true,
|
||||
},
|
||||
},
|
||||
textDocument = {
|
||||
diagnostic = {
|
||||
dynamicRegistration = true,
|
||||
relatedDocumentSupport = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue