Replies: 9 comments
-
Have you tried setting "sourcekit-lsp" for |
Beta Was this translation helpful? Give feedback.
-
lspconfig["sourcekit"].setup({
capabilities = capabilities,
on_attach = on_attach,
filetypes = { "swift", "swiftinterface", "c", "cpp", "objective-c", "objective-cpp" },
}) |
Beta Was this translation helpful? Give feedback.
-
I have just tried it and it doesn't make a difference. this is what I see on |
Beta Was this translation helpful? Give feedback.
-
I'm not familiar with sourcekit-lsp internals, I think it would be best to create a ticket here: https://github.com/apple/sourcekit-lsp |
Beta Was this translation helpful? Give feedback.
-
@akaralar try to add this to yours autocommands -- append filetype .swiftinterface to swift group
vim.api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, {
group = augroup("xcode_swiftinterface"),
pattern = { "*.swiftinterface" },
callback = function()
vim.bo.ft = "swift"
end,
}) |
Beta Was this translation helpful? Give feedback.
-
@Woit I replaced your To make things clear, I already set filetype of
so the reason the LSP is not attaching is not because of the filetype. Does LSP in those |
Beta Was this translation helpful? Give feedback.
-
@akaralar you're right, lsp is not attached to .swiftframwork |
Beta Was this translation helpful? Give feedback.
-
I converted this issue into the discussion, as it is not directly related to the plugin functionality. |
Beta Was this translation helpful? Give feedback.
-
@Woit I managed to get it to attach by enabling single file mode, ie lspconfig["sourcekit"].setup({
single_file_support = true, -- Added this line to the config
capabilities = capabilities,
on_attach = on_attach
}) But still navigation does not work. I also opened swiftlang/sourcekit-lsp#1155 on the sourcekit repo to see if anyone has any ideas there |
Beta Was this translation helpful? Give feedback.
-
Is there a way to make the LSP integration work with
.swiftinterface
files? For instance when I go to definition of aSwiftUI
symbol, sayText
, I am directed to a generatedSwiftUI.swiftinterface
file located in a predefined path which can be seen by runningLater in this
SwiftUI.swiftinterface
file, if I try to go to definition of a symbol in anotherSwift
module, sayString
, it doesn't navigate there and just finds occurrences in the current file. Even though I change thefiletype
of a.swiftinterface
file in Neovim to be aswift
file (so that tree-sitter works correctly), I don't see the LSP attached when I check with:LspInfo
.If I go back to my project files and try to navigate to
String
from one of the project files, it navigates me to aSwift.String.swiftinterface
file in that same folder for generated interfaces. So I'm guessing there should be a way to send an LSP request for generating an interface even when the originating file is in that generated interfaces folder.I'm not sure if this issue is better suited to the
xcode-build-server
repo or this one but since I started to interface with LSP through this repo, I wanted to open an issue here first.Beta Was this translation helpful? Give feedback.
All reactions