diff options
author | awy <awy@awy.one> | 2025-10-14 18:27:29 +0300 |
---|---|---|
committer | awy <awy@awy.one> | 2025-10-14 18:27:29 +0300 |
commit | de009fd679e10d053fdcc10785f91ad5317449ea (patch) | |
tree | 60918a488b579588596cf4d509fde298dccbf15d /.config/nvim/lsp/sourcekit.lua | |
parent | 9ea6cf81adb5d6abc59843de1db45913210f9320 (diff) | |
download | hyprdots-de009fd679e10d053fdcc10785f91ad5317449ea.tar.gz |
nvim revamp
Diffstat (limited to '.config/nvim/lsp/sourcekit.lua')
-rw-r--r-- | .config/nvim/lsp/sourcekit.lua | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/.config/nvim/lsp/sourcekit.lua b/.config/nvim/lsp/sourcekit.lua new file mode 100644 index 0000000..11d7b02 --- /dev/null +++ b/.config/nvim/lsp/sourcekit.lua @@ -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'(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, + }, + }, + }, +} |