Closed wojciech-kulik closed 9 months ago
It shouldn't has any issue. can you run it with environment SOURCEKIT_LOGGING=3 or XBSDEBUG=1 to see the full detailed logs?
also notice main branch version maybe not stable as release version
Do you know how can I run it this way?
lspconfig["sourcekit"].setup({
capabilities = capabilities,
on_attach = on_attach,
cmd = {
"SOURCEKIT_LOGGING=3 /Library/Developer/Toolchains/swift-latest.xctoolchain/usr/bin/sourcekit-lsp",
},
}
This way it doesn't work, it says the path is incorrect
you can set env in parent process like vim or terminal, child process will inherit it. lspconfig seems have cmd_env too(not tested)
I include logs after setting SOURCEKIT_LOGGING=3 lsp.log
It seems different swift toolchain may not compatible. since you use newest toolchain from lsp, you should compile from this toolchain too. this may fix any potential compatible issue.
second, I found there is error: error: unknown argument: '-emit-localized-strings'error: unknown argument: '-emit-localized-strings-path'\n
in your log, maybe this is the specific argument not supported by newest toolchain. delete it from flags may fixes problem.
I will test this case when I have time
I also tried to run the latest snapshot and looks like it doesn't know about a parameter -emit-localized-strings
. Also tried to build a project with latest snapshot, but that parameter is also here as well
error response (Request Failed): error: unknown argument: '-emit-localized-strings'error: unknown argument: '-emit-localized-strings-path'
[Trace - 12:51:23] Received response 'textDocument/diagnostic - (102)' in 1ms.
Result: {
"items": [],
"kind": "full"
}
Second, I found there is error: error: unknown argument: '-emit-localized-strings'error: unknown argument: '-emit-localized-strings-path'\n in your log, maybe this is the specific argument not supported by newest toolchain. delete it from flags may fixes problem.
It appeared after using gd
I will test this case when I have time
Ok, thank you!
since you use newest toolchain from lsp, you should compile from this toolchain too
Do you know how to change toolchain when using Xcode?
And thank you for your amazing work! This tool allowed me to move my iOS development to Neovim. I also built a plugin that integrates all needed Xcode-actions into Neovim. If you also develop iOS/macOS apps you may want to check it out: https://github.com/wojciech-kulik/xcodebuild.nvim Thank you 🍻
xcode can change toolchains by menu. xcodebuild seems has -toolchain parameter too
also you can try to set
export TOOLCHAINS=org.swift.510202402021a
where org.swift.510202402021a can be found in plist of toolchain
I just push newest-toolchain
branch, which reject the -emit-localized-strings
flags. check if this works? @wojciech-kulik
@SolaWing , for me it works fine with your fix, thanks
Also, go to reference works much better with the latest sourcekit-lsp :)
I can't build the project from Xcode using other toolchain. Any idea why?
ld: file cannot be open()ed, errno=2 path=/Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2024-02-03-a.xctoolchain/usr/lib/clang/17/lib/darwin/libclang_rt.profile_iossim.a in '/Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2024-02-03-a.xctoolchain/usr/lib/clang/17/lib/darwin/libclang_rt.profile_iossim.a'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
It turned out that it doesn't work with one of the dependencies. This approach works with other projects after your fix @SolaWing 🙌 .
However, this swift version is not stable enough to use it for work. 50% of my iOS projects don't work with it. But it's good to know that finally, smart rename will work with the new release, I checked it and it renamed classes correctly 🔥 .
Hi, I'm trying to figure out if there is any chance to support smart rename. I found this conversation: https://github.com/apple/sourcekit-lsp/issues/498
and they say that it is supported by the latest swift development snapshot. So I installed it and I switched my lsp cmd to:
I see that the lsp client is attached but the code completion stopped working completely. When I run
:LspLog
I see only:I'm not sure if it is a problem with LSP itself or with xcode-build-server? Is there any difference whether I use sourcekit-lsp from Xcode or from this package?