Code Monkey home page Code Monkey logo

xcode-build-server's Introduction

Xcode-Build-Server

apple's sourcekit-lsp doesn't support xcode project. but I found it provide a build server protocol to integrate with other build system. this is why I created this repo.

This repo aims to integrate xcode with sourcekit-lsp, support all languages(swift, c, cpp, objc, objcpp) xcode supports, so I can develop iOS with my favorate editor.

Install

this repo require Python3.9. The latest macos already contains this tool.

then just clone this repo, and ln -s ABSPATH/TO/xcode-build-server /usr/local/bin

here is script for quick install if your terminal cd to the dir you what save this repo:

git clone "[email protected]:SolaWing/xcode-build-server.git" && ln -s "$PWD"/xcode-build-server/xcode-build-server /usr/local/bin

or

git clone "https://github.com/SolaWing/xcode-build-server.git" && ln -s "$PWD"/xcode-build-server/xcode-build-server /usr/local/bin

or install from brew

brew install xcode-build-server

or install from Macports:

sudo port install xcode-build-server

Usage

choose one of the following usage. No matter which method you use, you need to ensure that the directory where buildServer.json is located is the root directory of lsp

Bind to Xcode

Go to your workspace directory and execute one of the following commands:

# *.xcworkspace or *.xcodeproj should be unique. can be omit and will auto choose the unique workspace or project.
xcode-build-server config -workspace *.xcworkspace -scheme <XXX> 
xcode-build-server config -project *.xcodeproj -scheme <XXX> 

This will create or update the buildServer.json file, with a kind: xcode key, which instructs xcode-build-server to watch and use compile flags from the newest xcode build log.

After this, you can open your file with sourcekit-lsp enabled, and it should works.

If your compile info is outdated and something is not working properly, just build in xcode to refresh compile flags.

PS: xcodebuild can generate same build log as xcode, if you don't overwrite build dir and specify a -resultBundlePath. this way you don't have to open xcode to build. eg:

rm .bundle; xcodebuild -workspace *.xcworkspace -scheme <XXX> -destination 'generic/platform=iOS Simulator' -resultBundlePath .bundle build

Manual Parse Xcodebuild log

If you are not building with Xcode, you can manually parse the build log to extract compile info using one of the following commands:

xcode-build-server parse [-a] <build_log_file>
<command_to_generate_build_log> | xcode-build-server parse [-a]

this will parse the log, save compile info in a .compile file, and update buildServer.json with a kind: manual key to instruct xcode-build-server to use the flags from the .compile file.

<build_log_file> can be created by redirecting xcodebuild build output to a file, or exported from xcode's build log UI.

<cmd generate build log> will usually be xcodebuild, or pbpaste if copy from xcode's build log. for example:

xcodebuild -workspace *.xcworkspace -scheme <XXX> -configuration Debug build | xcode-build-server parse [-a]

pbpaste | xcode-build-server parse [-a]

When running for the first time, you need to ensure that the log is complete, otherwise some files cannot obtain the correct flags.

After completing these steps, restart your language server, and it should work as expected.

if your build environment changes(eg: add new files, switch sdk, toggle debug/release, conditional macro, etc..) and your language server stops working, just repeat the previous steps to update the compile info. In these incremental update cases, you should make sure to use the -a flag, which will only add new flags, and other irrelevant old flags will remain unchanged.

if you use xcodebuild and want to see raw output, currently you can use the following commands: xcodebuild ... | tee build.log; xcode-build-server parse -a build.log >/dev/null 2>&1

[Deprecated] Sync Xcodebuild log

this usage is deprecated by bind xcodeproj, which just a command and won't pollute your xcodeproj's config.
switch from this usage to bind xcodeproj, you'll need to delete the post-build-action first. Otherwise, bind may not work properly. since kind will change to manual by post-build-action.

xcode-build-server provider post-build-action script to auto parse newest log into .compile and generate buildServer.json.
just add xcode-build-server postaction | bash & into script in scheme -> Build -> Post-actions. and script should choose provide build settings from target 图片

after this, the compile info should auto generate when xcode build and no need further manual parse.

Indexing While Building

sourcekit-lsp use indexing while build. if you found find definition or references is not work correctly, just build it to update index

More

current implementation is basicly work, but may have some rough edges. Please report issue if you have any problem. If you want to help, can check the open issue list. PR is always welcome.

Common Issues

  • If you use multiple versions of xcode or sourcekit-lsp, and it doesn't work properly, such as Loading the standard library failed, you should check that the build and sourcekit-lsp versions are consistent. Usually you can use xcode-select to switch toolchains, and use xcrun sourcekit-lsp to use the corresponding lsp version.
  • If cross-file references don't work for you, the "build_root" property might not be configured correctly in buildServer.json. It should look like "build_root": "/Users/yourusername/Library/Developer/Xcode/DerivedData/Simulator_Controller-adadrfjxhdizubdktugddworgvuj" rather than "build_root": "/Users/yourusername". Fix this by running sudo xcode-select -s /Applications/Xcode.app/Contents/Developer in the root of your XCode project. For more details, see this issue.

Development

Release new version

  1. Create a new tag with git tag -a v0.1.0 -m "release 0.1.0"
  2. Push tag with git push origin v0.1.0
  3. GitHub action will create release

xcode-build-server's People

Contributors

hristost avatar hyzyla avatar selfire1 avatar shinichy avatar solawing avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

xcode-build-server's Issues

Issue with Xcode 13.2

Recently I upgrade to Xcode13.2, jumping to definition works well with Xcode 12, while in the same project within Xcode13.2 it will fail with a "Definition not found" error in some case. Don't know what changes in sourcekit-lsp and build system whithin it cause this...

Loading the standard library failed (Xcode 15.3 beta)

Hi,

Thanks for this tool. I've installed this tool from brew.

I'm using Xcode 15.3 beta (15E5178i) and the autocomplete doesn't work in neovim. I don't know if this tool should be working with Xcode beta.

This is the output from :LspLog

[ERROR][2024-02-21 23:09:28] .../vim/lsp/rpc.lua:734	"rpc"	"/Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/sourcekit-lsp"	"stderr"	"INFO:root:Xcode Build Server Startup. Waiting Request...\nWARNING:root:observe thread exit by exception: invalid literal for int() with base 10: b'94*{'\n"
[ERROR][2024-02-21 23:09:33] .../vim/lsp/rpc.lua:734	"rpc"	"/Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/sourcekit-lsp"	"stderr"	"[2024-02-21 23:09:33.218] error response (Request Failed): Loading the standard library failed\n"

buildServer.json

{
    "name": "xcode build server",
    "version": "0.2",
    "bspVersion": "2.0",
    "languages": [
        "c",
        "cpp",
        "objective-c",
        "objective-cpp",
        "swift"
    ],
    "argv": [
        "/opt/homebrew/bin/xcode-build-server"
    ],
    "workspace": "/Users/kuglee/Downloads/NeovimTest/NeovimTest.xcodeproj/project.xcworkspace",
    "build_root": "/Users/kuglee/Library/Developer/Xcode/DerivedData/NeovimTest-epiyiyxemrrqtehjglonzjurbatt",
    "scheme": "NeovimTest",
    "kind": "xcode"
}

If I remove the buildServer.json, I get autocompletion, so the LSP support is working correctly.

v1.0.0 via Homebrew requires to set up a symlink manually

I switched to the latest version from Homebrew and I get:

[ERROR][2024-02-20 11:45:40] .../vim/lsp/rpc.lua:734	"rpc"	"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/sourcekit-lsp"	"stderr"	'[2024-02-20 11:45:40.473] failed to start build server: Error Domain=NSCocoaErrorDomain Code=4 "The file “xcode-build-server” doesn’t exist." UserInfo={NSFilePath=/usr/local/bin/xcode-build-server}\n[2024-02-20 11:45:40.473] could not find manifest, or not a SwiftPM package: /Users/wkulik/repositories/MyApp/dev\n'
[ERROR][2024-02-20 11:45:40] .../vim/lsp/rpc.lua:734	"rpc"	"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/sourcekit-lsp"	"stderr"	"[2024-02-20 11:45:40.864] could not open compilation database for /Users/wkulik/repositories/MyApp/dev/MyAppLib/Modules/Lib/MyFile.swift\n"

It turns out that I had to manually create a symlink:

sudo ln -s /opt/homebrew/bin/xcode-build-server /usr/local/bin

Is it possible to make it automatically via Homebrew? If not then it should be documented in the readme.

Description of the process

Hi!

I'm very curious how it all works. In issues, I constantly see the keyword flags, but I don't understand what they are for and how they are used or produced (besides that they come from build logs).

It would be really nice if you could provide in README or in another document a short description of the process. I guess it could help others to contribute and better understand the tool and its limitations.

Overal improvements

Hey, thank you for this awesome project, it's really the breath for making it possible to work with Xcode projects without it, and the most reliable this kind solution so far I've tried.

And therefore I'd be happy to participate with improving this project even further. Here's the places where I see a room for improvements:

  • overall reliability (currently the server could working in unreliable state depending on an completeness of a build logs that user is provided to it, another one issue here is with the incremental updates relying on the Xcode post build command)
  • background updates (currently I've faced such behavior that if I create a new type within my coding session it's keeping unreachable to such server until the next rebuild, where (obviously) it gets available pretty instantly within Xcode itself), so as I saw in the command output this server relies in a some way on Xcode NoIndex db, as the source of the completion, so I wonder if this could be fixed with a relatively low effort?
  • raw xcodebuild output support. I'm seeing this enhancement as a logical step further for this solution, to make it possible something like the follow xcodebuild -project YourWorkspace.xcodeproj -scheme YourScheme -destination "generic/platform=iOS Simulator" build | xcode-build-server --whatever, this one will provide users with the option to completely avoid back switching to Xcode to perform incremental build to increase their completion experience.

Though so far I have a lack of knowledge within both lsp, bsp servers and your implementation, I'd really appreciate any hints or other kind of support that could lowering the learning curve within all of that scope for me.

iOS project issues with XCode 15.3

Hello.

After updating to XCode 15.3 yesterday I have issues where most of the files (except pure Objective-C code) in my mixed C++/Objective-C iOS project are not processed correctly in VSCode when using official and recommended by sourcekit-lsp Swift extension and xcode-build-server. Previously it worked fine. I have read previous topic about that and updated to xcode-build-server 1.0.1 via brew now with no luck.

Here's relevant information and clues (I have replaced file and directory names with generic "MyCompany", "ProjectName", "projectdir", "TargetName", "SchemeName" placeholders before pasting it here):

  1. My project is mixed C/C++/Objective-C/Objective-C++ project with Cocoapods, so it's a workspace.
  2. It uses PCH file for C++ code.
  3. It seems that now pure Objective C/C++ files are parsed correctly while pure C/C++ or mixed C++/Objective-C++ files have issues.
  4. In order to trigger all things to work in VSCode I have created dummy Package.swift file in the project root, without it it doesn't even tries to parse any .cpp or .mm, or other supported files, Swift extension is not loaded. Not really sure if it's correct, I'm not much into Swift and just experimented. Here it is:
import PackageDescription

let package = Package(
    name: "DummySwiftPackage",
    platforms: [.iOS("17.4")],
    products: [
        .executable(
            name: "DummySwiftPackage",
            targets: ["DummySwiftPackage"])
    ],
    targets: [
        .executableTarget(
            name: "DummySwiftPackage"
        )
    ]
)
  1. Here is my buildServer.json file, located at the /Users/anton/Projects/MyCompany/projectdir/ which was generated by this command: xcode-build-server config -workspace Projects/iOS/ProjectName.xcworkspace -scheme "SchemeName". I have jus recreated it after updating xcode-build-server.
{
	"name": "xcode build server",
	"version": "0.2",
	"bspVersion": "2.0",
	"languages": [
		"c",
		"cpp",
		"objective-c",
		"objective-cpp",
		"swift"
	],
	"argv": [
		"/usr/local/bin/xcode-build-server"
	],
	"workspace": "/Users/anton/Projects/MyCompany/projectdir/Projects/iOS/ProjectName.xcworkspace",
	"build_root": "/Users/anton/Projects/MyCompany/projectdir/Projects/iOS/DerivedData/ProjectName",
	"scheme": "SchemeName",
	"kind": "xcode"
}
  1. Here is the log of the sourcekit-lsp server from within VSCode (wrapped long lines):
[Trace - 1:02:29 PM] Sending request 'initialize - (0)'.
[Trace - 1:02:29 PM] Received response 'initialize - (0)' in 94ms.
[Trace - 1:02:29 PM] Sending notification 'initialized'.
[Trace - 1:02:29 PM] Sending notification 'textDocument/didOpen'.
INFO:server:Xcode Build Server Startup
INFO:server:use flags from /Users/anton/Library/Caches/xcode-build-server/-Users-anton-Projects-MyCompany-projectdir/compile_file-SchemeName-c094da7cb62ed8124e6eccd5abb424b2
The flag `-index` is obsolete and ignored.
I[13:02:29.975] Apple clangd version 15.0.0 (clang-1500.3.9.4)
I[13:02:29.975] Features: mac+xpc
I[13:02:29.975] PID: 5346
I[13:02:29.975] Working directory: /Users/anton/Projects/MyCompany/projectdir
I[13:02:29.975] argv[0]: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clangd
I[13:02:29.975] argv[1]: -compile_args_from=lsp
I[13:02:29.975] argv[2]: -background-index=false
I[13:02:29.975] argv[3]: -index=false
I[13:02:29.975] Starting LSP over stdin/stdout
I[13:02:29.979] <-- initialize(1)
I[13:02:30.008] --> reply:initialize(1) 29 ms
I[13:02:30.013] <-- initialized
[Trace - 1:02:30 PM] Received request 'client/registerCapability - (1)'.
[Trace - 1:02:30 PM] Sending response 'client/registerCapability - (1)'. Processing request took 0ms
[Trace - 1:02:30 PM] Received request 'client/registerCapability - (2)'.
[Trace - 1:02:30 PM] Sending response 'client/registerCapability - (2)'. Processing request took 0ms
[Trace - 1:02:30 PM] Received request 'client/registerCapability - (3)'.
[Trace - 1:02:30 PM] Sending response 'client/registerCapability - (3)'. Processing request took 0ms
[Trace - 1:02:30 PM] Received request 'client/registerCapability - (4)'.
[Trace - 1:02:30 PM] Sending response 'client/registerCapability - (4)'. Processing request took 1ms
[Trace - 1:02:30 PM] Received request 'client/registerCapability - (5)'.
[Trace - 1:02:30 PM] Sending response 'client/registerCapability - (5)'. Processing request took 0ms
[Trace - 1:02:30 PM] Received request 'client/registerCapability - (6)'.
[Trace - 1:02:30 PM] Sending response 'client/registerCapability - (6)'. Processing request took 1ms
I[13:02:30.316] <-- workspace/didChangeConfiguration
I[13:02:30.317] <-- textDocument/didOpen
I[13:02:30.319] ASTWorker building file /Users/anton/Projects/MyCompany/projectdir/Sources/Core/AppCore.cpp version 1 with command 
[/Users/anton/Projects/MyCompany/projectdir]
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
 -ivfsstatcache
 /Users/anton/Projects/MyCompany/projectdir/Projects/iOS/DerivedData/SDKStatCaches.noindex/iphoneos17.4-21E210-99a79c02cfa501706f5b564e46d84afe.sdkstatcache
 -fmessage-length=0
 -fdiagnostics-show-note-include-stack
 -fmacro-backtrace-limit=0
 -fno-color-diagnostics
 -fmodules-prune-interval=86400
 -fmodules-prune-after=345600
 -fbuild-session-file=/Users/anton/Projects/MyCompany/projectdir/Projects/iOS/DerivedData/ModuleCache.noindex/Session.modulevalidation
 -fmodules-validate-once-per-build-session
 -Wno-trigraphs
 -Wmissing-field-initializers
 -Wno-missing-prototypes
 -Werror=return-type
 -Wunreachable-code
 -Werror=deprecated-objc-isa-usage
 -Werror=objc-root-class
 -Wno-non-virtual-dtor
 -Woverloaded-virtual
 -Wno-exit-time-destructors
 -Wno-missing-braces
 -Wparentheses
 -Wswitch
 -Wunused-function
 -Wno-unused-label
 -Wno-unused-parameter
 -Wunused-variable
 -Wunused-value
 -Wempty-body
 -Wuninitialized
 -Wno-unknown-pragmas
 -Wno-shadow
 -Wno-four-char-constants
 -Wno-conversion
 -Wconstant-conversion
 -Wint-conversion
 -Wbool-conversion
 -Wenum-conversion
 -Wno-float-conversion
 -Wnon-literal-null-conversion
 -Wobjc-literal-conversion
 -Wshorten-64-to-32
 -Wnewline-eof
 -Wno-c++11-extensions
 -Wno-implicit-fallthrough
 -fstrict-aliasing
 -Wno-deprecated-declarations
 -Winvalid-offsetof
 -Wno-sign-conversion
 -Winfinite-recursion
 -Wmove
 -Wcomma
 -Wblock-capture-autoreleasing
 -Wstrict-prototypes
 -Wrange-loop-analysis
 -Wno-semicolon-before-method-body
 -index-store-path
 /Users/anton/Projects/MyCompany/projectdir/Projects/iOS/DerivedData/ProjectName/Index.noindex/DataStore
 -include
 /Users/anton/Projects/MyCompany/projectdir/Projects/iOS/ProjectName_Prefix.pch
 -MMD
 -MT
 dependencies
 -MF
 /Users/anton/Projects/MyCompany/projectdir/Projects/iOS/DerivedData/ProjectName/Build/Intermediates.noindex/ProjectName.build/Debug-iphoneos/TargetName.build/Objects-normal/arm64/AppCore.d
 --serialize-diagnostics
 /Users/anton/Projects/MyCompany/projectdir/Projects/iOS/DerivedData/ProjectName/Build/Intermediates.noindex/ProjectName.build/Debug-iphoneos/TargetName.build/Objects-normal/arm64/AppCore.dia
 -c
 -index-unit-output-path
 /ProjectName.build/Debug-iphoneos/TargetName.build/Objects-normal/arm64/AppCore.o
 -working-directory
 /Users/anton/Projects/MyCompany/projectdir
 -resource-dir=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/15.0.0
 -isysroot
 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk
 --
 /Users/anton/Projects/MyCompany/projectdir/Sources/Core/AppCore.cpp
[Trace - 1:02:31 PM] Sending request 'textDocument/documentColor - (1)'.
[Trace - 1:02:31 PM] Received response 'textDocument/documentColor - (1)' in 1ms.
[Trace - 1:02:31 PM] Sending request 'textDocument/codeAction - (2)'.
I[13:02:31.233] <-- textDocument/codeAction(2)
[Trace - 1:02:31 PM] Sending request 'textDocument/inlayHint - (3)'.
[Trace - 1:02:32 PM] Sending request 'textDocument/foldingRange - (4)'.
I[13:02:32.261] Indexing c++98 standard library in the context of /Users/anton/Projects/MyCompany/projectdir/Sources/Core/AppCore.cpp
[Trace - 1:02:32 PM] Sending request 'textDocument/semanticTokens/full - (5)'.
I[13:02:32.319] <-- textDocument/inlayHint(3)
I[13:02:32.319] <-- textDocument/foldingRange(4)
I[13:02:32.321] --> reply:textDocument/foldingRange(4) 1 ms
[Trace - 1:02:32 PM] Received response 'textDocument/foldingRange - (4)' in 18ms.
I[13:02:32.330] <-- textDocument/semanticTokens/full(5)
I[13:02:33.099] Built preamble of size 6997588 for file /Users/anton/Projects/MyCompany/projectdir/Sources/Core/AppCore.cpp version 1 in 2.78 seconds
I[13:02:33.101] --> workspace/semanticTokens/refresh(0)
[Trace - 1:02:33 PM] Received request 'workspace/semanticTokens/refresh - (7)'.
[Trace - 1:02:33 PM] Sending response 'workspace/semanticTokens/refresh - (7)'. Processing request took 0ms
I[13:02:33.103] <-- reply(0)
E[13:02:33.103] Failed to decode workspace/semanticTokens/refresh reply: expected null
E[13:02:33.103] Failed to refresh semantic tokens: -32602: failed to decode workspace/semanticTokens/refresh reply: expected null
I[13:02:33.207] --> textDocument/publishDiagnostics
I[13:02:33.209] --> reply:textDocument/codeAction(2) 1975 ms
I[13:02:33.209] --> reply:textDocument/inlayHint(3) 889 ms
I[13:02:33.210] --> reply:textDocument/semanticTokens/full(5) 879 ms
[Trace - 1:02:33 PM] Received response 'textDocument/inlayHint - (3)' in 1293ms.
[Trace - 1:02:33 PM] Received notification 'textDocument/publishDiagnostics'.
[Trace - 1:02:33 PM] Received response 'textDocument/codeAction - (2)' in 2001ms.
[Trace - 1:02:33 PM] Received response 'textDocument/semanticTokens/full - (5)' in 896ms.
[Trace - 1:02:33 PM] Sending request 'textDocument/codeAction - (6)'.
I[13:02:33.264] <-- textDocument/codeAction(6)
I[13:02:33.264] --> reply:textDocument/codeAction(6) 0 ms
[Trace - 1:02:33 PM] Received response 'textDocument/codeAction - (6)' in 5ms.
[Trace - 1:02:33 PM] Sending request 'textDocument/codeAction - (7)'.
I[13:02:33.873] <-- textDocument/codeAction(7)
I[13:02:33.873] --> reply:textDocument/codeAction(7) 0 ms
[Trace - 1:02:33 PM] Received response 'textDocument/codeAction - (7)' in 1ms.
[Trace - 1:02:33 PM] Sending request 'textDocument/semanticTokens/full/delta - (8)'.
I[13:02:33.954] <-- textDocument/semanticTokens/full/delta(8)
I[13:02:33.955] --> reply:textDocument/semanticTokens/full/delta(8) 0 ms
[Trace - 1:02:33 PM] Received response 'textDocument/semanticTokens/full/delta - (8)' in 4ms.
[Trace - 1:02:34 PM] Sending notification '$/setTrace'.
[Trace - 1:02:34 PM] Sending request 'textDocument/codeAction - (9)'.
I[13:02:34.573] <-- textDocument/codeAction(9)
I[13:02:34.573] --> reply:textDocument/codeAction(9) 0 ms
[Trace - 1:02:34 PM] Received response 'textDocument/codeAction - (9)' in 1ms.
[Trace - 1:02:34 PM] Sending request 'textDocument/codeAction - (10)'.
I[13:02:34.576] <-- textDocument/codeAction(10)
I[13:02:34.576] --> reply:textDocument/codeAction(10) 0 ms
[Trace - 1:02:34 PM] Received response 'textDocument/codeAction - (10)' in 2ms.
[Trace - 1:02:35 PM] Sending request 'textDocument/codeAction - (11)'.
I[13:02:35.629] <-- textDocument/codeAction(11)
I[13:02:35.630] --> reply:textDocument/codeAction(11) 0 ms
[Trace - 1:02:35 PM] Received response 'textDocument/codeAction - (11)' in 3ms.
[Trace - 1:02:35 PM] Sending request 'textDocument/documentColor - (12)'.
[Trace - 1:02:35 PM] Received response 'textDocument/documentColor - (12)' in 1ms.
I[13:02:35.897] Indexed c++98 standard library (incomplete due to errors): 8257 symbols, 2778 filtered
[Trace - 1:02:36 PM] Sending request 'textDocument/foldingRange - (13)'.
I[13:02:36.517] <-- textDocument/foldingRange(12)
I[13:02:36.519] --> reply:textDocument/foldingRange(12) 1 ms
[Trace - 1:02:36 PM] Received response 'textDocument/foldingRange - (13)' in 3ms.
[Trace - 1:02:36 PM] Sending notification '$/setTrace'.
[Trace - 1:02:36 PM] Sending request 'textDocument/codeAction - (14)'.
I[13:02:36.969] <-- textDocument/codeAction(13)
I[13:02:36.970] --> reply:textDocument/codeAction(13) 0 ms
[Trace - 1:02:36 PM] Received response 'textDocument/codeAction - (14)' in 1ms.
[Trace - 1:02:36 PM] Sending request 'textDocument/documentSymbol - (15)'.
I[13:02:36.978] <-- textDocument/documentSymbol(14)
I[13:02:36.979] --> reply:textDocument/documentSymbol(14) 0 ms
[Trace - 1:02:36 PM] Received response 'textDocument/documentSymbol - (15)' in 7ms.
[Trace - 1:02:37 PM] Sending notification '$/setTrace'.
  1. And here is the part of the file /Users/anton/Library/Caches/xcode-build-server/-Users-anton-Projects-MyCompany-projectdir/compile_file-SchemeName-c094da7cb62ed8124e6eccd5abb424b2, I took only block that relates to the opened file in this example (wrapped long lines):
{
	"directory": "/Users/anton/Projects/MyCompany/projectdir/Projects/iOS",
	"command": "
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
 -x
 c++
 -ivfsstatcache
 /Users/anton/Projects/MyCompany/projectdir/Projects/iOS/DerivedData/SDKStatCaches.noindex/iphoneos17.4-21E210-99a79c02cfa501706f5b564e46d84afe.sdkstatcache
 -fmessage-length\\=0
 -fdiagnostics-show-note-include-stack
 -fmacro-backtrace-limit\\=0
 -fno-color-diagnostics
 -fmodules-prune-interval\\=86400
 -fmodules-prune-after\\=345600
 -fbuild-session-file\\=/Users/anton/Projects/MyCompany/projectdir/Projects/iOS/DerivedData/ModuleCache.noindex/Session.modulevalidation
 -fmodules-validate-once-per-build-session
 -Wno-trigraphs
 -Wmissing-field-initializers
 -Wno-missing-prototypes
 -Werror\\=return-type
 -Wunreachable-code
 -Werror\\=deprecated-objc-isa-usage
 -Werror\\=objc-root-class
 -Wno-non-virtual-dtor
 -Woverloaded-virtual
 -Wno-exit-time-destructors
 -Wno-missing-braces
 -Wparentheses
 -Wswitch
 -Wunused-function
 -Wno-unused-label
 -Wno-unused-parameter
 -Wunused-variable
 -Wunused-value
 -Wempty-body
 -Wuninitialized
 -Wno-unknown-pragmas
 -Wno-shadow
 -Wno-four-char-constants
 -Wno-conversion
 -Wconstant-conversion
 -Wint-conversion
 -Wbool-conversion
 -Wenum-conversion
 -Wno-float-conversion
 -Wnon-literal-null-conversion
 -Wobjc-literal-conversion
 -Wshorten-64-to-32
 -Wnewline-eof
 -Wno-c++11-extensions
 -Wno-implicit-fallthrough
 -fstrict-aliasing
 -Wno-deprecated-declarations
 -Winvalid-offsetof
 -Wno-sign-conversion
 -Winfinite-recursion
 -Wmove
 -Wcomma
 -Wblock-capture-autoreleasing
 -Wstrict-prototypes
 -Wrange-loop-analysis
 -Wno-semicolon-before-method-body
 -index-store-path
 /Users/anton/Projects/MyCompany/projectdir/Projects/iOS/DerivedData/ProjectName/Index.noindex/DataStore
 @/Users/anton/Projects/MyCompany/projectdir/Projects/iOS/DerivedData/ProjectName/Build/Intermediates.noindex/ProjectName.build/Debug-iphoneos/TargetName.build/Objects-normal/arm64/82b82416624d2658e5098eb0a28c15c5-common-args.resp
 -include
 /Users/anton/Projects/MyCompany/projectdir/Projects/iOS/ProjectName_Prefix.pch
 -MMD
 -MT
 dependencies
 -MF
 /Users/anton/Projects/MyCompany/projectdir/Projects/iOS/DerivedData/ProjectName/Build/Intermediates.noindex/ProjectName.build/Debug-iphoneos/TargetName.build/Objects-normal/arm64/AppCore.d
 --serialize-diagnostics
 /Users/anton/Projects/MyCompany/projectdir/Projects/iOS/DerivedData/ProjectName/Build/Intermediates.noindex/ProjectName.build/Debug-iphoneos/TargetName.build/Objects-normal/arm64/AppCore.dia
 -c
 /Users/anton/Projects/MyCompany/projectdir/Sources/Core/AppCore.cpp
 -o
 /Users/anton/Projects/MyCompany/projectdir/Projects/iOS/DerivedData/ProjectName/Build/Intermediates.noindex/ProjectName.build/Debug-iphoneos/TargetName.build/Objects-normal/arm64/AppCore.o
 -index-unit-output-path
 /ProjectName.build/Debug-iphoneos/TargetName.build/Objects-normal/arm64/AppCore.o",
	"file": "/Users/anton/Projects/MyCompany/projectdir/Sources/Core/AppCore.cpp",
	"output": "/Users/anton/Projects/MyCompany/projectdir/Projects/iOS/DerivedData/ProjectName/Build/Intermediates.noindex/ProjectName.build/Debug-iphoneos/TargetName.build/Objects-normal/arm64/AppCore.o"
},
  1. I tried closing everything and deleting /Users/anton/Library/Caches/xcode-build-server directory multiple times - no luck.
  2. I tried closing everything and deleting /Users/anton/Projects/MyCompany/projectdir/Projects/iOS/DerivedData completely and rebuilding project using the same scheme that I selected above in Xcode multiple times (it builds OK) - no luck.
  3. I tried using different source-kit-lsp paths: one installed at /usr/bin/sourcekit-lsp, other within 'Xcode.app' (should be more fresh), and even building a release build from the release that was just made yesterday (was putting it in my local bin dir: /Users/anton/bin).
  4. Tried specifying iOS paltform in Swift advanced settings, it sets this VSCode option:
    "swift.SDK": "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS17.4.sdk". Not sure if it affects anything...

It really seems that problems lies with clang flags now being wrong and that it selects MacOS platform instead of iPhone platform (note the -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk in the VSCode output), and probably is missing some flags. Maybe it is something caused by changes in flags, parsing of responce file. Because previously I remember that there were more options to clangd passed, including various defines, etc. But I assure you that ".resp" file to which build command points in the build directory within "DerivedData" exists and is populated with correct info.

run 'xocde-build-server' err

error:
Requested but did not find extension point with identifier Xcode.InterfaceBuilderBuildSupport.PlatformDefinition
find root :/Users/user/Library/Developer/Xcode/DerivedData/{app}-befxrmrzdkuusgfvwcjivakwkmpn
updated buildServer.json

I tried several projects and reported this error.

buildServer.json is not updated if the path to xcode build server is changed

Hi, just noticed the following issue (copied xcode-build-server to different locations and ran)

  1. run "path_1/xcode-build-server" config -scheme "SOME_SCHEME" -workspace "some_workspace.xcworkspace"
  2. buildServer.json is generated with
     "argv": [
     	"path1/xcode-build-server"
     ]
3. run "path_2/xcode-build-server" config -scheme "SOME_SCHEME" -workspace "some_workspace.xcworkspace"
 buildServer.json still has 
    ```json 
    "argv": [
		"path1/xcode-build-server"
	]

Expected is:

 "argv": [
 	"path2/xcode-build-server"
 ]

when I run Xcode-build-server, there is a problem : Requested but did not find extension point with identifier Xcode.InterfaceBuilderBuildSupport.PlatformDefinition

test  xcode-build-server config -scheme test -project test.xcodeproj
2023-12-16 15:26:47.072 xcodebuild[98951:6786614] Requested but did not find extension point with identifier Xcode.InterfaceBuilderBuildSupport.PlatformDefinition
find root: /Users/nofoot/Library/Developer/Xcode/DerivedData/test-fzbkifohhgxgrrgkozifedysolbm
updated buildServer.json

test  xcodebuild -version
Xcode 15.0.1
Build version 15A507

Can't get cross file jump to definition works

I'm using VSCode with an installed Swift extension.
I'm using this build command to build the app
rm -r .bundle*; xcodebuild -project *.xcodeproj -sdk ${command:ios-debug.targetSdk} -destination 'generic/platform=iOS Simulator' -configuration Debug -resultBundlePath .bundle build | xcpretty && exit ${PIPESTATUS[0]} | xcode-build-server parse -a | pbpaste | xcode-build-server parse -a
It is built correctly.
Xcode version: 15.2
Server path in Swift extension: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/sourcekit-lsp

Here is my log file from sourcekit lsp:
log.txt

In this issue, I found that message from you. But I can't figure out how to set other sdk, mb I shouldn't change it 😅
#32

from the log seems xcode-builld-server cannot read correct flags, and return the default flags: ["/Users/beng/Downloads/NewTest/NewTest/NewTest/ViewController.swift", "-sdk", "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/"], which is not compatible with your Xcode-15.2.0.app version.

buildServer.json looks like that
Screenshot 2024-02-16 at 01 21 11

Jump to definition of modules like SwiftUI

Hey @SolaWing , I wonder if this can be fixed somehow or is it strictly an Xcode IDE thing..

Basically, sometimes I find it helpful to jump to protocols like View and understand it bit. On Xcode, this just works.

Thanks

Does this works with bazel?

If not, what would be needed to make it work?

From my understanding this uses xcode build log. What information would Bazel build log need so we can do the same?

Is it possible to support generated `.swiftinterface` files?

Would xcode-build-server be able to support browsing and navigating .swiftinterface files? For instance when I go to definition of a SwiftUI symbol in my project, say Text, I am directed to a generated SwiftUI.swiftinterface file located in a predefined path which can be seen as --generated-interfaces-path by running

xcrun --toolchain swift sourcekit-lsp --help

Later in this SwiftUI.swiftinterface file, if I try to go to definition of a symbol in another Swift module, say String, it doesn't navigate there and my editor (Neovim) falls back to finding occurrences in the current file. Also I see the LSP is attached and it's running in "single file mode" when I'm in this .swiftinterface file.

If I go back to my project files and try to navigate to String from one of the project files, it navigates me to a Swift.String.swiftinterface file that is generated in the 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 but I'm not sure how or whether LSP can be configured to do so and whether this tool would be able to support this. Any thoughts?

Add to homebrew

I find that the current method of installing xcode-build-server via git can be challenging for new users compared to using homebrew. Also, regular users must manually check and pull changes for new updates. It would be great to have a Homebrew formula for your project to address those issues. I don't have much experience with creating Homebrew formulas, but I can try to prepare a pull request for homebrew-core. But before I start, I would like to know what you think about it?

License?

Hello! This is a nice and useful project, but currently there is no license information/file anywhere that I can find, which means the work is under exclusive copyright by default. If this is intended, no worries, but if not, could information about the license of this project be specified/added somewhere (perhaps in the form of a LICENSE file/similar)?

Thanks!

sourcekit-lsp does not seem to communicate with xcode-build-server

I have been able to use xcode-build-server in an iOS project in the past, but now it does not seem to work reliably with my setup anymore -- I was able to get it to work just once, and could not reproduce afterwards.

Looking at the .compile file, I see that the sdk flag is set correctly for each module:

-sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.5.sdk 

The log for sourcekit-lsp reveals that the debugServer.json file is read succesfully, and that it retrieves the IndexStoreDB paths:

[2021-06-13 21:42:51.070] initialized build server xcode build server
[2021-06-13 21:42:51.072] opened IndexStoreDB at /Users/hs/Library/Caches/xcode-build-server/file:---Users-hs-amaziograph-src-/indexDatabasePath with store path /Users/hs/Library/Caches/xcode-build-server/file:---Users-hs-amaziograph-src-/indexStorePath

However, all subsequent logs show the wrong sdk flag:

[2021-06-13 21:42:54.353] {
  key.request: source.request.editor.open,
  key.name: "/Users/hs/amaziograph/src/Symmetry/Types/symmetryKaleidoscope.swift",
  key.compilerargs: [
    "-sdk",
    "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk",
    "/Users/hs/amaziograph/src/Symmetry/Types/symmetryKaleidoscope.swift"
  ],
  key.sourcetext: "..."
}

What are some good steps to debug this? I believe that textDocument_sourceKitOptions() is never called, as the log from xcode-build-server only shows calls to build/initialize, build/initialized, and textDocument/registerForChanges.

My swift version is

Apple Swift version 5.4 (swiftlang-1205.0.26.9 clang-1205.0.19.55)
Target: x86_64-apple-darwin20.5.0

Find References and Jump to Definition

Hi
Thanks for making this :)

Is the BSP setup supposed to make those features work too?
The basic LSP features like seeing variables definitions, documentation, code completion and the like works but I haven't been able to get "find references" and jump to definition to work. I get no results or no references found.

Are those features also supposed to work? if not, is it possible to make it work through BSP and what would it take?
I have little knowledge about LSP and BSP but I am more than happy to help if it's possible.

If it helps... I am on mac os 12 and my editor is Sublime Text 4.

Document setting correct sourcekit-lsp path

I ran into the same problem as in #45, and some related XCode 15.3+ issues. At least on my system /usr/bin/sourcekit-lsp simply does not work as expected, emitting the standard library related error message in those threads. @wojciech-kulik's config fix below worked great for using the correct LSP binary. That plus clearing out old DerviedData dirs and rebuilding my project got me up and running with xcode-build-server.

Also, make sure that you are running the correct sourcekit-lsp by setting the following path:

cmd = {
  vim.trim(vim.fn.system("xcrun -f sourcekit-lsp")), -- maybe just "xcrun sourcekit-lsp" would be enough?
},

in your nvim-lspconfig.

Probably the problem is somewhere else, but it's worth checking the configuration first :).

Originally posted by @wojciech-kulik in #45 (comment)

Go to Reference works wierd

Hi, thanks for the great work and server. Really awesome.
By the way do you know why "Go To Reference" stops working if there's an error in a line of code.
For example:

func callMethod() {
        let a = 10
        print("\(a),\(self.po)")
        someFunc(B: "", d: 10)
    }

    func someFunc(
        B: String,
        d: String  
    ) {
    }

in that case if I put the cursor to someFunc and try to "Go to reference" it doesn't work, However if I change the line to someFunc(B: "", d: "") it starts working immediately

[Fix] Cross References Not Working with LSP

Firstly, thank you so much for building this tool. It is a great pleasure to be able to use my NeoVim environment to code swift!✨

I had a lot of trouble getting the BSP to work with sourcekit lsp, and couldn't find any resources online so documenting my issues and fix in case anyone stumbles on this.

I was unable to get cross-file references to work. The sourcekit lsp was unable to find project references in scope. The issue arised from xcode-build-server not being able to find the build_root after the config step, and a symptom of this is if your "build_root" property in your buildServer.json looks like "build_root": "/Users/arshonsaadati" rather than "build_root": "/Users/arshonsaadati/Library/Developer/Xcode/DerivedData/Simulator_Controller-adadrfjxhdizubdktugddworgvuj". If this is the case, the server.py of the BSP will hang waiting for stdin.

FIX:
The source of the issue is xcode-select if running xcode-select in your command line gives the error xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance. It can be fixed by running sudo xcode-select -s /Applications/Xcode.app/Contents/Developer.

Assuming Xcode is installed in your applications folder, xcode-select, xcodebuild, and xcode-build-server config should function correctly. I've attached a buildServer.json that works for my project as an example, since as a noob I was confused what to put for the scheme argument.
buildServer.json

Feel free to close this issue, as no action is required! Thank you!

Does this project work with Cocoapods?

I have an app that uses pods, and for some reason it isn't able to detect pod libraries (everything else like foundation works). Is it a workspace thing? Is there a specific setup I need to do to run with cocoapods?

Sorry if I'm new!

Discussion: Possible to implement _inside_ an iOS / macOS application?

As suggested! I see you've managed to get the lib executing outside it's normal environment. Might be a long shot, but I'm curious if you've experimented with bundling the LSP with another project, for runtime-execution. Use case being I could open my app with this implementation, run a file through it, and execute LSP requests on it.

I think this may essentially require a JIT in the runtime since it may require a full compilation pass, but hey, figured I'd ask.

Thank you so much for posting this information, and sharing your hard work!

Sample project?

I cannot get it working. Can you setup a sample project to get it working? I am using Emacs (still need an xcworkspace though but I am building using xcodebuild with parsed information from xcworkspace/xcodeproj), I need to pass any argument to source kit-lsp or (target|sdk)?.

I can get the basics of swiftui and foundation completions but not from my own code.
Earlier I used the trick with a package.swift in the root to fool sourcekit-lsp but it doesn't seem to work with xcode15.

Xcode 15.3 - loading standard library failed error

Hello,

After upgrading to Xcode 15.3 I am encountering this error. Here is the full text of my lsp.log (I cleared it, restarted Neovim, and this is what I got:

[START][2024-03-15 15:28:37] LSP logging initiated
[WARN][2024-03-15 15:28:37] ...lsp/handlers.lua:137 "The language server copilot triggers a registerCapability handler despite dynamicRegistration set to false. Report upstream, this warning is harmless"
[ERROR][2024-03-15 15:28:38] .../vim/lsp/rpc.lua:734 "rpc" "/usr/local/bin/sourcekit-lsp" "stderr" "INFO:root:Xcode Build Server Startup. Waiting Request...\n"
[ERROR][2024-03-15 15:28:38] .../vim/lsp/rpc.lua:734 "rpc" "/usr/local/bin/sourcekit-lsp" "stderr" "WARNING:root:observe thread exit by exception: invalid literal for int() with base 10: b'92*{'\n"
[ERROR][2024-03-15 15:28:41] .../vim/lsp/rpc.lua:734 "rpc" "/usr/local/bin/sourcekit-lsp" "stderr" "[2024-03-15 15:28:41.184] error response (Request Failed): Loading the standard library failed\n"
[ERROR][2024-03-15 15:28:41] .../vim/lsp/rpc.lua:734 "rpc" "/usr/local/bin/sourcekit-lsp" "stderr" '[2024-03-15 15:28:41.187] cursor info failed DocumentURI(storage: file:///Users/joel/code/classmate/ios/Classmate/Classmate/Views/Messaging/MessagesList.swift):7:44: ResponseError(code: LanguageServerProtocol.ErrorCode(rawValue: -32001), message: "sourcekitd request failed: error response (Request Failed): Loading the standard library failed")\n'

Notes:

  • I've tried clearing derived data, making sure my command line tools are set to 15.3, restarting machine.

Hmmmm....tried creating a simple project, one page iOS app from scratch and...LSP works (in that project)...still broken in my app though.

Do you know how I can track this down?

Issues with Autocomplete

Hello! Thank you very much for your work on this tool!

I was trying to use it with https://github.com/wojciech-kulik/ios-dev-starter-nvim and it seems that it is almost working for me. However, when I scroll through a couple of sugestions presented by auto completion, they stop working. I see Client 1 quit with exit code 0 and signal 5 in :messages and below is my LSP log and checkhealth xcodebuild

[START][2024-06-16 11:17:25] LSP logging initiated
[ERROR][2024-06-16 11:17:25] .../vim/lsp/rpc.lua:734	"rpc"	"/usr/bin/sourcekit-lsp"	"stderr"	"INFO:server:Xcode Build Server Startup\nINFO:server:use flags from /Users/rodion/Library/Caches/xcode-build-server/-Users-rodion-src-mnemosyne/compile_file-mnemosyne-8566984e1260641bb2dba37bc2456893\n"
[ERROR][2024-06-16 11:17:33] .../vim/lsp/rpc.lua:734	"rpc"	"/usr/bin/sourcekit-lsp"	"stderr"	"/AppleInternal/Library/BuildRoots/860631e9-c1c5-11ee-98ee-b6ef2fd8d87b/Library/Caches/com.apple.xbs/Sources/SourceKitLSP/dependencies/swift-syntax/Sources/SwiftParser/Lexer/Cursor.swift:620: Fatal error\n"
==============================================================================
xcodebuild: require("xcodebuild.health").check()

Checking xcodebuild.nvim ~
- OK xcodebuild.nvim: commit #2c11361

Checking OS ~
- OK macOS 14+: release 23.5.0

Checking plugins ~
- OK telescope.nvim installed.
- OK nui.nvim installed.
- OK nvim-tree installed.
- WARNING neo-tree not installed. (Optional to visually manage project files)
- WARNING oil.nvim not installed. (Optional to visually manage project files)
- OK nvim-dap installed.
- OK nvim-dap-ui installed.
- OK nvim-treesitter installed.
- OK nvim-treesitter: Swift parser installed.

Checking required dependencies ~
- OK xcodebuild: version 15.3
- OK xcodebuild: installed
- OK xcrun: installed
- OK xcode-build-server: installed

Checking optional dependencies ~
- WARNING pymobiledevice3: not installed. Required for debugging on physical devices and/or running apps on devices below iOS 17. (https://github.com/doronz88/pymobiledevice3)
- OK xcodeproj: installed
- OK xcbeautify: installed
- OK ruby: version 3.3.3

Checking debugger ~
- OK nvim-dap: codelldb adapter configured.
- OK nvim-dap: swift configuration found.
- OK codelldb: installed

Checking buildServer.json ~
- OK buildServer.json: found

Checking .nvim/xcodebuild/settings.json ~
- OK .nvim/xcodebuild: found
- OK .nvim/xcodebuild/settings.json: found

Is there an issue with xcode-build-server here? Thank you!

Xcode 16 beta support

I installed Xcode 16 beta 2 and autocompletion doesn't work, vs code extension says that compile_flags.json is not provided.

Has anybody tested it for a new Xcode ?

[Question] How to show errors from other files?

Hello,

first of all, thank you for this amazing tool. I've been trying for months to run sourcekit-lsp with my projects and finally this tool made it possible effortlessly 🍺 !

I've got one question. Usually, when I break one file it affects other places. For example, if I rename some method,Xcode shows errors in other files. Sourcekit-lsp only shows me errors in currently opened buffers. Is it possible to show also errors from unopened files? This information is already in build logs, so I guess it is just a matter of passing it to vim.diagnostic.

Any help would be very appreciated. Thank you!

PS. Side question: what is buildServer.json does it come from sourcekit-lsp, or is it standard for BuildServerProtocol, or does it come from your tool? Can I find somewhere documentation for this file?

LSP root?

Hi, I cloned the repo, ran the ln -s command, and then the config command. I got the Requested but did not find extension point with identifier Xcode error when running the config command but it seemed to work successfully because a buildServer.json file was created at the root of my project directory. I rebuilt in Xcode, restarted VSCode (I use a VSCode fork called Cursor), and Swift autocomplete doesn't seem to be working.

Screenshot 2023-11-06 at 10 25 01 AM Screenshot 2023-11-06 at 10 26 23 AM

What do you mean by LSP root? Should the buildServer.json be somewhere other than the root of my project directory?

buildServer.json:
Screenshot 2023-11-06 at 10 27 32 AM

Integration with Swift Development Snapshot? (support for smart rename)

Hi, I'm trying to figure out if there is any chance to support smart rename. I found this conversation:
swiftlang/sourcekit-lsp#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:

/Library/Developer/Toolchains/swift-latest.xctoolchain/usr/bin/sourcekit-lsp

I see that the lsp client is attached but the code completion stopped working completely. When I run :LspLog I see only:

[START][2024-02-04 12:57:59] LSP logging initiated
[ERROR][2024-02-04 12:57:59] .../vim/lsp/rpc.lua:734	"rpc"	"/Library/Developer/Toolchains/swift-latest.xctoolchain/usr/bin/sourcekit-lsp"	"stderr"	"SWIFT TASK CONTINUATION MISUSE: run() leaked its continuation!\nINFO:root:Xcode Build Server Startup. Waiting Request...\n"

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?

xcode-build-server not starting?

Hello, and thanks for putting this together! I'm trying to find a replacement for AppCode with IdeaVim since it's going away at the end of the year, and if I can get this to work it would be a huge help!

Following your instructions, I got this working with a simple personal project. But when I perform the same setup with a much larger project, it doesn't work. When I check the process tree for the simple project, I get:

<my editor>sourcekit-lspPython

But on the larger project the Python process is absent, which I assume is why I can't jump to definition, for example.

How do I get started debugging this? I tried looking for something in Console logs but couldn't find anything useful.

Support for Xcode 15.3

It looks like xcode-build-server doesn't work with Xcode 15.3:

2024-03-06 01:55:54.640 xcodebuild[96558:26618928]  DVTPlugInQuery: Requested but did not find extension point with identifier 'Xcode.InterfaceBuilderBuildSupport.PlatformDefinition'. This is programmer error; code should only request extension points that are defined by itself or its dependencies.
find root: /Users/wkulik/Library/Developer/Xcode/DerivedData/MyProj-adasdasdadasd
updated buildServer.json
[START][2024-03-06 01:58:28] LSP logging initiated
[ERROR][2024-03-06 01:58:28] .../vim/lsp/rpc.lua:784	"rpc"	"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/sourcekit-lsp"	"stderr"	"INFO:root:Xcode Build Server Startup. Waiting Request...\n"

Monitoring changes and transparency/echo mode

First of all, this is my life saver for continue using Emacs, thanks!

  1. I usually automate my builds in Emacs and parses the warnings/errors directly from the output from Xcodebuild. I would love to have a transparency/echo mode from xcode-build-server parse that just echoes back everything from xcodebuild so I can continue to do both parsing while I am compiling and updating the BSP .compile file.
  • For echoing back xcodebuild's output yet another flag like -quiet would be nice, then you just get the warnings, notes and errors. An easy start is just to return outputs that starts with a path and if the compilation for successful or not.
  1. Would be nice to have a tool that detect changes in the rootfolder and subfolders and automatically runs an Xcodebuild and updates the indices for BSP. So we get some kind of background indexing. I think this is possible within emacs, but it would be nice to have for every user not just emacs users.

xcode-build-server has been added to MacPorts

Thank you so much for making this tool! It has been working perfectly for nearly a year now and making my workday so much easier! 🌟

I wanted to let you know that I have added xcode-build-server to MacPorts: macports/macports-ports#22707 So this can also be included as an installation method in the README.

(If you'd like I can open up a PR myself to update the README.)

xcodebuild config support

Hi, I had read man once more and have found that there's such option as config for this tool that allows to stick xcode-build-server with the original Index.noindex db skipping an intermediate .compile file in a project root folder.

I've found that if to call xcodebuild -resultBundlePath /whatever/ it spits some build logs (*.xcactivitylog) into the very same folder as the Xcode itself and even updates the LogStoreManifest.plist on the path that is watched by xcode-build-server.

But when I try this approach to update lsp-server index it spits empty responses.

Any ideas why?

Detecting changes in other files

This is most likely connected with #43.

Besides the problem with new files, there is also one more annoying. Whenever I update some other file by for example adding a new parameter to a function, these changes are not visible for LSP until I rebuild the project and restart LSP.

Actually, LSP restart is not needed if I alternatively just update buffers with errors. However, diagnostics won't disappear automatically until some changes are made.

I wonder how Xcode handles it. Does it recompile just a single file? Because Xcode is able to almost instantly notice new params.

Running a build in a background for every change in a buffer, doesn't seem reasonable, so probably it is more difficult case than #43.

LSP doesn't come with code completions/suggestions

Hello, i haven't code completions/suggestions while my LSP is successfully activate and i've generate buildServer.json in the root of my working directories. Here are some screenshoots for my problem:

  • I want to integrate SourceKit-LSP with my NeoVim, and here are my configurations:
    Screenshot 2024-01-28 at 09 33 12

  • Here are my cloned xcode-build-server repos:
    Screenshot 2024-01-28 at 09 34 17

  • Here are my generated buildServer.json
    Screenshot 2024-01-28 at 09 35 33

  • Here are my working directories
    Screenshot 2024-01-28 at 09 36 12

  • Here are my LspLog when i open my Swift file:
    Screenshot 2024-01-28 at 09 38 10

  • I try to type import and Lsp doesn't give anything about suggestions/completions:
    Screenshot 2024-01-28 at 09 37 29

So, that's my report for you. I hope i can develop iOS app outside XCode environment.
Thank you very much for your great work, mate 🍻

sourcekit-lsp crashed when functions use no argument label

OS version
MacOS 13.0.1

Editor
neovim v0.8.1 with coc.nvim extension and vscode 1.74.0 with Swift extension

Simple code
sourcekit-lsp crashed when I typed self.test(). According to my test, when typing a function with only one parameter that use no argument label, if no parameters are filled in, sourcekit-lsp will crash.

class ViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        self.test(1)//sourcekit-lsp works fine
        self.test()//sourcekit-lsp crashed
    }

    func test(_ params: Int) {
    }
}

vscode sourcekit-lsp output

[Trace - 9:39:39 PM] Sending request 'textDocument/hover - (23)'.
[Trace - 9:39:39 PM] Received response 'textDocument/hover - (23)' in 13ms.
[Trace - 9:39:40 PM] Sending notification 'textDocument/didChange'.
[Trace - 9:39:40 PM] Received notification 'textDocument/publishDiagnostics'.
[Trace - 9:39:40 PM] Sending request 'textDocument/completion - (24)'.
[Trace - 9:39:40 PM] Sending notification 'textDocument/didChange'.
[Trace - 9:39:40 PM] Received notification 'textDocument/publishDiagnostics'.
[Trace - 9:39:40 PM] Sending notification 'textDocument/didChange'.
[Trace - 9:39:40 PM] Received notification 'textDocument/publishDiagnostics'.
[Trace - 9:39:40 PM] Sending request 'textDocument/semanticTokens/full - (25)'.
[Trace - 9:39:40 PM] Received response 'textDocument/semanticTokens/full - (25)' in 1ms.
[Trace - 9:39:40 PM] Sending notification 'textDocument/didChange'.
[Trace - 9:39:40 PM] Received notification 'textDocument/publishDiagnostics'.
[Trace - 9:39:41 PM] Sending notification '$/cancelRequest'.
[Trace - 9:39:41 PM] Sending notification 'textDocument/didChange'.
[Trace - 9:39:41 PM] Sending request 'textDocument/completion - (26)'.
[Trace - 9:39:41 PM] Received notification 'textDocument/publishDiagnostics'.
[Trace - 9:39:41 PM] Received notification 'textDocument/publishDiagnostics'.
[Trace - 9:39:41 PM] Received request 'workspace/semanticTokens/refresh - (10)'.
[Trace - 9:39:41 PM] Sending response 'workspace/semanticTokens/refresh - (10)'. Processing request took 0ms
[Trace - 9:39:41 PM] Sending request 'textDocument/foldingRange - (27)'.
[Trace - 9:39:41 PM] Received response 'textDocument/foldingRange - (27)' in 2ms.
[Trace - 9:39:41 PM] Sending request 'textDocument/semanticTokens/full - (28)'.
[Trace - 9:39:41 PM] Received response 'textDocument/semanticTokens/full - (28)' in 1ms.
[Trace - 9:39:41 PM] Sending request 'textDocument/documentSymbol - (29)'.
[Trace - 9:39:41 PM] Received response 'textDocument/documentSymbol - (29)' in 2ms.
[Trace - 9:39:41 PM] Sending request 'textDocument/codeAction - (30)'.
[Trace - 9:39:41 PM] Received response 'textDocument/codeAction - (30)' in 3ms.
[Trace - 9:39:41 PM] Sending request 'textDocument/documentColor - (31)'.
[Trace - 9:39:41 PM] Received response 'textDocument/documentColor - (31)' in 2ms.
[Trace - 9:39:42 PM] Received response 'textDocument/completion - (26)' in 1039ms.
[Trace - 9:39:42 PM] Received response 'textDocument/completion - (24)' in 1428ms.
[Trace - 9:39:42 PM] Sending request 'textDocument/inlayHint - (32)'.
[Trace - 9:39:42 PM] Received response 'textDocument/inlayHint - (32)' in 7ms.
[Trace - 9:39:42 PM] Sending notification 'textDocument/didChange'.
[Trace - 9:39:42 PM] Sending request 'textDocument/completion - (33)'.
[Trace - 9:39:42 PM] Received notification 'textDocument/publishDiagnostics'.
[Trace - 9:39:42 PM] Received response 'textDocument/completion - (33)' in 8ms.
[Trace - 9:39:42 PM] Sending notification 'textDocument/didChange'.
[Trace - 9:39:42 PM] Sending request 'textDocument/completion - (34)'.
[Trace - 9:39:42 PM] Received notification 'textDocument/publishDiagnostics'.
[Trace - 9:39:42 PM] Received response 'textDocument/completion - (34)' in 22ms.
[Trace - 9:39:42 PM] Received notification 'textDocument/publishDiagnostics'.
[Trace - 9:39:42 PM] Received request 'workspace/semanticTokens/refresh - (11)'.
[Trace - 9:39:42 PM] Sending response 'workspace/semanticTokens/refresh - (11)'. Processing request took 0ms
[Trace - 9:39:42 PM] Sending request 'textDocument/semanticTokens/full - (35)'.
[Trace - 9:39:42 PM] Received response 'textDocument/semanticTokens/full - (35)' in 2ms.
[Trace - 9:39:42 PM] Sending notification 'textDocument/didChange'.
[Trace - 9:39:42 PM] Sending request 'textDocument/completion - (36)'.
[Trace - 9:39:42 PM] Received notification 'textDocument/publishDiagnostics'.
[Trace - 9:39:42 PM] Received response 'textDocument/completion - (36)' in 18ms.
[Trace - 9:39:42 PM] Received notification 'textDocument/publishDiagnostics'.
[Trace - 9:39:42 PM] Received request 'workspace/semanticTokens/refresh - (12)'.
[Trace - 9:39:42 PM] Sending response 'workspace/semanticTokens/refresh - (12)'. Processing request took 0ms
[Trace - 9:39:42 PM] Sending request 'textDocument/semanticTokens/full - (37)'.
[Trace - 9:39:42 PM] Received response 'textDocument/semanticTokens/full - (37)' in 1ms.
[Trace - 9:39:42 PM] Sending request 'textDocument/foldingRange - (38)'.
[Trace - 9:39:42 PM] Received response 'textDocument/foldingRange - (38)' in 2ms.
[Trace - 9:39:43 PM] Sending request 'textDocument/documentSymbol - (39)'.
[Trace - 9:39:43 PM] Received response 'textDocument/documentSymbol - (39)' in 5ms.
[Trace - 9:39:43 PM] Sending request 'textDocument/codeAction - (40)'.
[Trace - 9:39:43 PM] Received response 'textDocument/codeAction - (40)' in 5ms.
[Trace - 9:39:43 PM] Sending request 'textDocument/documentColor - (41)'.
[Trace - 9:39:43 PM] Received response 'textDocument/documentColor - (41)' in 5ms.
[Trace - 9:39:43 PM] Sending request 'textDocument/inlayHint - (42)'.
[Trace - 9:39:43 PM] Received response 'textDocument/inlayHint - (42)' in 8ms.
[Trace - 9:39:46 PM] Sending notification 'textDocument/didChange'.
[Trace - 9:39:46 PM] Received notification 'textDocument/publishDiagnostics'.
[Trace - 9:39:46 PM] Received notification 'textDocument/publishDiagnostics'.
[Trace - 9:39:46 PM] Received request 'workspace/semanticTokens/refresh - (13)'.
[Trace - 9:39:46 PM] Sending response 'workspace/semanticTokens/refresh - (13)'. Processing request took 0ms
[Trace - 9:39:46 PM] Sending request 'textDocument/semanticTokens/full - (43)'.
[Trace - 9:39:46 PM] Received response 'textDocument/semanticTokens/full - (43)' in 1ms.
[Trace - 9:39:47 PM] Sending request 'textDocument/foldingRange - (44)'.
[Trace - 9:39:47 PM] Received response 'textDocument/foldingRange - (44)' in 3ms.
[Trace - 9:39:47 PM] Sending request 'textDocument/documentSymbol - (45)'.
[Trace - 9:39:47 PM] Received response 'textDocument/documentSymbol - (45)' in 5ms.
[Trace - 9:39:47 PM] Sending request 'textDocument/codeAction - (46)'.
[Trace - 9:39:47 PM] Received response 'textDocument/codeAction - (46)' in 4ms.
[Trace - 9:39:47 PM] Sending request 'textDocument/documentColor - (47)'.
[Trace - 9:39:47 PM] Received response 'textDocument/documentColor - (47)' in 3ms.
[Trace - 9:39:48 PM] Sending request 'textDocument/inlayHint - (48)'.
[Trace - 9:39:48 PM] Received response 'textDocument/inlayHint - (48)' in 7ms.
[Trace - 9:39:48 PM] Sending notification 'textDocument/didChange'.
[Trace - 9:39:48 PM] Received notification 'textDocument/publishDiagnostics'.
[Info  - 9:39:49 PM] Connection to server got closed. Server will restart.
[Trace - 9:39:49 PM] Sending request 'initialize - (0)'.
[Trace - 9:39:49 PM] Received response 'initialize - (0)' in 68ms.
[Trace - 9:39:49 PM] Sending notification 'initialized'.
[Trace - 9:39:49 PM] Sending notification 'textDocument/didOpen'.
[Trace - 9:39:49 PM] Sending request 'textDocument/documentSymbol - (1)'.
[Trace - 9:39:49 PM] Sending request 'textDocument/documentColor - (2)'.
[Trace - 9:39:49 PM] Sending request 'textDocument/codeAction - (3)'.
INFO:root:Xcode Build Server Startup. Waiting Request...
DEBUG:root:Req --> {"jsonrpc":"2.0","method":"build\/initialize","id":1,"params":{"rootUri":"file:\/\/\/Users\/xboxdevcat\/Desktop\/test\/","capabilities":{"languageIds":["c","cpp","objective-c","objective-cpp","swift"]},"bspVersion":"2.0","displayName":"SourceKit-LSP","version":"1.0"}}
DEBUG:root:Res <-- {"jsonrpc": "2.0", "id": 1, "result": {"displayName": "xcode build server", "version": "0.1", "bspVersion": "2.0", "rootUri": "file:///Users/xboxdevcat/Desktop/test/", "capabilities": {"languageIds": ["swift", "objective-c", "c", "cpp", "objective-cpp"]}, "data": {"indexDatabasePath": "/Users/xboxdevcat/Library/Caches/xcode-build-server/file:---Users-xboxdevcat-Desktop-test-/indexDatabasePath", "indexStorePath": "/Users/xboxdevcat/Library/Developer/Xcode/DerivedData/test-ekuzomazcpfusagtzgfezuahoglm/Index.noindex/DataStore"}}}
DEBUG:root:Req --> {"jsonrpc":"2.0","method":"build\/initialized","params":{}}
[Trace - 9:39:49 PM] Received request 'client/registerCapability - (1)'.
[Trace - 9:39:49 PM] Sending response 'client/registerCapability - (1)'. Processing request took 1ms
[Trace - 9:39:49 PM] Received request 'client/registerCapability - (2)'.
[Trace - 9:39:49 PM] Sending response 'client/registerCapability - (2)'. Processing request took 0ms
[Trace - 9:39:49 PM] Received request 'client/registerCapability - (3)'.
[Trace - 9:39:49 PM] Sending response 'client/registerCapability - (3)'. Processing request took 0ms
[Trace - 9:39:49 PM] Received request 'client/registerCapability - (4)'.
[Trace - 9:39:49 PM] Sending response 'client/registerCapability - (4)'. Processing request took 0ms
DEBUG:root:Req --> {"jsonrpc":"2.0","method":"textDocument\/registerForChanges","id":2,"params":{"uri":"file:\/\/\/Users\/xboxdevcat\/Desktop\/test\/test\/ViewController.swift","action":"register"}}
[Trace - 9:39:49 PM] Received request 'client/registerCapability - (5)'.
[Trace - 9:39:49 PM] Sending response 'client/registerCapability - (5)'. Processing request took 0ms
DEBUG:root:Res <-- {"jsonrpc": "2.0", "id": 2, "result": null}
[Trace - 9:39:49 PM] Received request 'client/registerCapability - (6)'.
[Trace - 9:39:49 PM] Sending response 'client/registerCapability - (6)'. Processing request took 1ms
[Trace - 9:39:49 PM] Sending request 'textDocument/inlayHint - (4)'.
DEBUG:root:Res <-- {"jsonrpc": "2.0", "method": "build/sourceKitOptionsChanged", "params": {"uri": "file:///Users/xboxdevcat/Desktop/test/test/ViewController.swift", "updatedOptions": {"options": ["-module-name", "test", "-Onone", "-enforce-exclusivity=checked", "/Users/xboxdevcat/Desktop/test/test/ViewController.swift", "/Users/xboxdevcat/Desktop/test/test/AppDelegate.swift", "/Users/xboxdevcat/Desktop/test/test/SceneDelegate.swift", "-DDEBUG", "-sdk", "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.0.sdk", "-target", "x86_64-apple-ios16.0-simulator", "-enable-bare-slash-regex", "-g", "-module-cache-path", "/Users/xboxdevcat/Library/Developer/Xcode/DerivedData/ModuleCache.noindex", "-Xfrontend", "-serialize-debugging-options", "-enable-testing", "-index-store-path", "/Users/xboxdevcat/Library/Developer/Xcode/DerivedData/test-ekuzomazcpfusagtzgfezuahoglm/Index.noindex/DataStore", "-swift-version", "5", "-I", "/Users/xboxdevcat/Library/Developer/Xcode/DerivedData/test-ekuzomazcpfusagtzgfezuahoglm/Build/Products/Debug-iphonesimulator", "-F", "/Users/xboxdevcat/Library/Developer/Xcode/DerivedData/test-ekuzomazcpfusagtzgfezuahoglm/Build/Products/Debug-iphonesimulator", "-emit-localized-strings", "-emit-localized-strings-path", "/Users/xboxdevcat/Library/Developer/Xcode/DerivedData/test-ekuzomazcpfusagtzgfezuahoglm/Build/Intermediates.noindex/test.build/Debug-iphonesimulator/test.build/Objects-normal/x86_64", "-c", "-j8", "-enable-batch-mode", "-incremental", "-output-file-map", "/Users/xboxdevcat/Library/Developer/Xcode/DerivedData/test-ekuzomazcpfusagtzgfezuahoglm/Build/Intermediates.noindex/test.build/Debug-iphonesimulator/test.build/Objects-normal/x86_64/test-OutputFileMap.json", "-save-temps", "-no-color-diagnostics", "-serialize-diagnostics", "-emit-dependencies", "-emit-module", "-emit-module-path", "/Users/xboxdevcat/Library/Developer/Xcode/DerivedData/test-ekuzomazcpfusagtzgfezuahoglm/Build/Intermediates.noindex/test.build/Debug-iphonesimulator/test.build/Objects-normal/x86_64/test.swiftmodule", "-Xcc", "-I/Users/xboxdevcat/Library/Developer/Xcode/DerivedData/test-ekuzomazcpfusagtzgfezuahoglm/Build/Intermediates.noindex/test.build/Debug-iphonesimulator/test.build/swift-overrides.hmap", "-Xcc", "-iquote", "-Xcc", "/Users/xboxdevcat/Library/Developer/Xcode/DerivedData/test-ekuzomazcpfusagtzgfezuahoglm/Build/Intermediates.noindex/test.build/Debug-iphonesimulator/test.build/test-generated-files.hmap", "-Xcc", "-I/Users/xboxdevcat/Library/Developer/Xcode/DerivedData/test-ekuzomazcpfusagtzgfezuahoglm/Build/Intermediates.noindex/test.build/Debug-iphonesimulator/test.build/test-own-target-headers.hmap", "-Xcc", "-I/Users/xboxdevcat/Library/Developer/Xcode/DerivedData/test-ekuzomazcpfusagtzgfezuahoglm/Build/Intermediates.noindex/test.build/Debug-iphonesimulator/test.build/test-all-target-headers.hmap", "-Xcc", "-iquote", "-Xcc", "/Users/xboxdevcat/Library/Developer/Xcode/DerivedData/test-ekuzomazcpfusagtzgfezuahoglm/Build/Intermediates.noindex/test.build/Debug-iphonesimulator/test.build/test-project-headers.hmap", "-Xcc", "-I/Users/xboxdevcat/Library/Developer/Xcode/DerivedData/test-ekuzomazcpfusagtzgfezuahoglm/Build/Products/Debug-iphonesimulator/include", "-Xcc", "-I/Users/xboxdevcat/Library/Developer/Xcode/DerivedData/test-ekuzomazcpfusagtzgfezuahoglm/Build/Intermediates.noindex/test.build/Debug-iphonesimulator/test.build/DerivedSources-normal/x86_64", "-Xcc", "-I/Users/xboxdevcat/Library/Developer/Xcode/DerivedData/test-ekuzomazcpfusagtzgfezuahoglm/Build/Intermediates.noindex/test.build/Debug-iphonesimulator/test.build/DerivedSources/x86_64", "-Xcc", "-I/Users/xboxdevcat/Library/Developer/Xcode/DerivedData/test-ekuzomazcpfusagtzgfezuahoglm/Build/Intermediates.noindex/test.build/Debug-iphonesimulator/test.build/DerivedSources", "-Xcc", "-DDEBUG=1", "-emit-objc-header", "-emit-objc-header-path", "/Users/xboxdevcat/Library/Developer/Xcode/DerivedData/test-ekuzomazcpfusagtzgfezuahoglm/Build/Intermediates.noindex/test.build/Debug-iphonesimulator/test.build/Objects-normal/x86_64/test-Swift.h", "-working-directory", "/Users/xboxdevcat/Desktop/test", "-experimental-emit-module-separately"], "workingDirectory": "/Users/xboxdevcat/Desktop/test"}}}
[Trace - 9:39:49 PM] Sending notification '$/cancelRequest'.
[Trace - 9:39:49 PM] Sending request 'textDocument/documentSymbol - (5)'.
[Trace - 9:39:49 PM] Received notification 'textDocument/publishDiagnostics'.
[Trace - 9:39:49 PM] Received response 'textDocument/documentSymbol - (1)' in 114ms.
[Trace - 9:39:49 PM] Received response 'textDocument/documentColor - (2)' in 114ms.
[Trace - 9:39:49 PM] Received response 'textDocument/documentSymbol - (5)' in 25ms.
[Trace - 9:39:49 PM] Received response 'textDocument/inlayHint - (4)' in 166ms.
[Trace - 9:39:49 PM] Received response 'textDocument/codeAction - (3)' in 240ms.
[Trace - 9:39:49 PM] Sending request 'textDocument/foldingRange - (6)'.
[Info  - 9:39:49 PM] Connection to server got closed. Server will restart.
[Trace - 9:39:49 PM] Sending request 'initialize - (0)'.
[Trace - 9:39:49 PM] Received response 'initialize - (0)' in 65ms.
[Trace - 9:39:49 PM] Sending notification 'initialized'.
[Trace - 9:39:49 PM] Sending notification 'textDocument/didOpen'.
[Trace - 9:39:49 PM] Sending request 'textDocument/documentSymbol - (1)'.
[Trace - 9:39:49 PM] Sending request 'textDocument/documentColor - (2)'.
[Trace - 9:39:49 PM] Sending request 'textDocument/codeAction - (3)'.
INFO:root:Xcode Build Server Startup. Waiting Request...
DEBUG:root:Req --> {"jsonrpc":"2.0","method":"build\/initialize","id":1,"params":{"rootUri":"file:\/\/\/Users\/xboxdevcat\/Desktop\/test\/","capabilities":{"languageIds":["c","cpp","objective-c","objective-cpp","swift"]},"bspVersion":"2.0","displayName":"SourceKit-LSP","version":"1.0"}}
DEBUG:root:Res <-- {"jsonrpc": "2.0", "id": 1, "result": {"displayName": "xcode build server", "version": "0.1", "bspVersion": "2.0", "rootUri": "file:///Users/xboxdevcat/Desktop/test/", "capabilities": {"languageIds": ["swift", "objective-c", "c", "cpp", "objective-cpp"]}, "data": {"indexDatabasePath": "/Users/xboxdevcat/Library/Caches/xcode-build-server/file:---Users-xboxdevcat-Desktop-test-/indexDatabasePath", "indexStorePath": "/Users/xboxdevcat/Library/Developer/Xcode/DerivedData/test-ekuzomazcpfusagtzgfezuahoglm/Index.noindex/DataStore"}}}
DEBUG:root:Req --> {"jsonrpc":"2.0","method":"build\/initialized","params":{}}
[Trace - 9:39:49 PM] Received request 'client/registerCapability - (1)'.
[Trace - 9:39:49 PM] Sending response 'client/registerCapability - (1)'. Processing request took 0ms
[Trace - 9:39:49 PM] Received request 'client/registerCapability - (2)'.
[Trace - 9:39:49 PM] Sending response 'client/registerCapability - (2)'. Processing request took 1ms
[Trace - 9:39:49 PM] Received request 'client/registerCapability - (3)'.
[Trace - 9:39:49 PM] Sending response 'client/registerCapability - (3)'. Processing request took 1ms
DEBUG:root:Req --> {"jsonrpc":"2.0","method":"textDocument\/registerForChanges","id":2,"params":{"uri":"file:\/\/\/Users\/xboxdevcat\/Desktop\/test\/test\/ViewController.swift","action":"register"}}
DEBUG:root:Res <-- {"jsonrpc": "2.0", "id": 2, "result": null}
[Trace - 9:39:49 PM] Received request 'client/registerCapability - (4)'.
[Trace - 9:39:49 PM] Sending response 'client/registerCapability - (4)'. Processing request took 0ms
[Trace - 9:39:49 PM] Received request 'client/registerCapability - (5)'.
[Trace - 9:39:49 PM] Sending response 'client/registerCapability - (5)'. Processing request took 0ms
[Trace - 9:39:49 PM] Received request 'client/registerCapability - (6)'.
[Trace - 9:39:49 PM] Sending response 'client/registerCapability - (6)'. Processing request took 0ms
[Trace - 9:39:49 PM] Sending request 'textDocument/inlayHint - (4)'.
DEBUG:root:Res <-- {"jsonrpc": "2.0", "method": "build/sourceKitOptionsChanged", "params": {"uri": "file:///Users/xboxdevcat/Desktop/test/test/ViewController.swift", "updatedOptions": {"options": ["-module-name", "test", "-Onone", "-enforce-exclusivity=checked", "/Users/xboxdevcat/Desktop/test/test/ViewController.swift", "/Users/xboxdevcat/Desktop/test/test/AppDelegate.swift", "/Users/xboxdevcat/Desktop/test/test/SceneDelegate.swift", "-DDEBUG", "-sdk", "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.0.sdk", "-target", "x86_64-apple-ios16.0-simulator", "-enable-bare-slash-regex", "-g", "-module-cache-path", "/Users/xboxdevcat/Library/Developer/Xcode/DerivedData/ModuleCache.noindex", "-Xfrontend", "-serialize-debugging-options", "-enable-testing", "-index-store-path", "/Users/xboxdevcat/Library/Developer/Xcode/DerivedData/test-ekuzomazcpfusagtzgfezuahoglm/Index.noindex/DataStore", "-swift-version", "5", "-I", "/Users/xboxdevcat/Library/Developer/Xcode/DerivedData/test-ekuzomazcpfusagtzgfezuahoglm/Build/Products/Debug-iphonesimulator", "-F", "/Users/xboxdevcat/Library/Developer/Xcode/DerivedData/test-ekuzomazcpfusagtzgfezuahoglm/Build/Products/Debug-iphonesimulator", "-emit-localized-strings", "-emit-localized-strings-path", "/Users/xboxdevcat/Library/Developer/Xcode/DerivedData/test-ekuzomazcpfusagtzgfezuahoglm/Build/Intermediates.noindex/test.build/Debug-iphonesimulator/test.build/Objects-normal/x86_64", "-c", "-j8", "-enable-batch-mode", "-incremental", "-output-file-map", "/Users/xboxdevcat/Library/Developer/Xcode/DerivedData/test-ekuzomazcpfusagtzgfezuahoglm/Build/Intermediates.noindex/test.build/Debug-iphonesimulator/test.build/Objects-normal/x86_64/test-OutputFileMap.json", "-save-temps", "-no-color-diagnostics", "-serialize-diagnostics", "-emit-dependencies", "-emit-module", "-emit-module-path", "/Users/xboxdevcat/Library/Developer/Xcode/DerivedData/test-ekuzomazcpfusagtzgfezuahoglm/Build/Intermediates.noindex/test.build/Debug-iphonesimulator/test.build/Objects-normal/x86_64/test.swiftmodule", "-Xcc", "-I/Users/xboxdevcat/Library/Developer/Xcode/DerivedData/test-ekuzomazcpfusagtzgfezuahoglm/Build/Intermediates.noindex/test.build/Debug-iphonesimulator/test.build/swift-overrides.hmap", "-Xcc", "-iquote", "-Xcc", "/Users/xboxdevcat/Library/Developer/Xcode/DerivedData/test-ekuzomazcpfusagtzgfezuahoglm/Build/Intermediates.noindex/test.build/Debug-iphonesimulator/test.build/test-generated-files.hmap", "-Xcc", "-I/Users/xboxdevcat/Library/Developer/Xcode/DerivedData/test-ekuzomazcpfusagtzgfezuahoglm/Build/Intermediates.noindex/test.build/Debug-iphonesimulator/test.build/test-own-target-headers.hmap", "-Xcc", "-I/Users/xboxdevcat/Library/Developer/Xcode/DerivedData/test-ekuzomazcpfusagtzgfezuahoglm/Build/Intermediates.noindex/test.build/Debug-iphonesimulator/test.build/test-all-target-headers.hmap", "-Xcc", "-iquote", "-Xcc", "/Users/xboxdevcat/Library/Developer/Xcode/DerivedData/test-ekuzomazcpfusagtzgfezuahoglm/Build/Intermediates.noindex/test.build/Debug-iphonesimulator/test.build/test-project-headers.hmap", "-Xcc", "-I/Users/xboxdevcat/Library/Developer/Xcode/DerivedData/test-ekuzomazcpfusagtzgfezuahoglm/Build/Products/Debug-iphonesimulator/include", "-Xcc", "-I/Users/xboxdevcat/Library/Developer/Xcode/DerivedData/test-ekuzomazcpfusagtzgfezuahoglm/Build/Intermediates.noindex/test.build/Debug-iphonesimulator/test.build/DerivedSources-normal/x86_64", "-Xcc", "-I/Users/xboxdevcat/Library/Developer/Xcode/DerivedData/test-ekuzomazcpfusagtzgfezuahoglm/Build/Intermediates.noindex/test.build/Debug-iphonesimulator/test.build/DerivedSources/x86_64", "-Xcc", "-I/Users/xboxdevcat/Library/Developer/Xcode/DerivedData/test-ekuzomazcpfusagtzgfezuahoglm/Build/Intermediates.noindex/test.build/Debug-iphonesimulator/test.build/DerivedSources", "-Xcc", "-DDEBUG=1", "-emit-objc-header", "-emit-objc-header-path", "/Users/xboxdevcat/Library/Developer/Xcode/DerivedData/test-ekuzomazcpfusagtzgfezuahoglm/Build/Intermediates.noindex/test.build/Debug-iphonesimulator/test.build/Objects-normal/x86_64/test-Swift.h", "-working-directory", "/Users/xboxdevcat/Desktop/test", "-experimental-emit-module-separately"], "workingDirectory": "/Users/xboxdevcat/Desktop/test"}}}
[Trace - 9:39:49 PM] Received notification 'textDocument/publishDiagnostics'.
[Trace - 9:39:49 PM] Received response 'textDocument/documentSymbol - (1)' in 108ms.
[Trace - 9:39:49 PM] Received response 'textDocument/documentColor - (2)' in 108ms.
[Trace - 9:39:49 PM] Received response 'textDocument/inlayHint - (4)' in 140ms.
[Trace - 9:39:49 PM] Received response 'textDocument/codeAction - (3)' in 211ms.
[Trace - 9:39:49 PM] Sending request 'textDocument/foldingRange - (5)'.
[Info  - 9:39:49 PM] Connection to server got closed. Server will restart.
[Trace - 9:39:49 PM] Sending request 'initialize - (0)'.
[Trace - 9:39:49 PM] Received response 'initialize - (0)' in 68ms.
[Trace - 9:39:49 PM] Sending notification 'initialized'.
[Trace - 9:39:49 PM] Sending notification 'textDocument/didOpen'.
[Trace - 9:39:49 PM] Sending request 'textDocument/documentSymbol - (1)'.
[Trace - 9:39:49 PM] Sending request 'textDocument/documentColor - (2)'.
[Trace - 9:39:49 PM] Sending request 'textDocument/codeAction - (3)'.
INFO:root:Xcode Build Server Startup. Waiting Request...
DEBUG:root:Req --> {"jsonrpc":"2.0","method":"build\/initialize","id":1,"params":{"rootUri":"file:\/\/\/Users\/xboxdevcat\/Desktop\/test\/","capabilities":{"languageIds":["c","cpp","objective-c","objective-cpp","swift"]},"bspVersion":"2.0","displayName":"SourceKit-LSP","version":"1.0"}}
DEBUG:root:Res <-- {"jsonrpc": "2.0", "id": 1, "result": {"displayName": "xcode build server", "version": "0.1", "bspVersion": "2.0", "rootUri": "file:///Users/xboxdevcat/Desktop/test/", "capabilities": {"languageIds": ["swift", "objective-c", "c", "cpp", "objective-cpp"]}, "data": {"indexDatabasePath": "/Users/xboxdevcat/Library/Caches/xcode-build-server/file:---Users-xboxdevcat-Desktop-test-/indexDatabasePath", "indexStorePath": "/Users/xboxdevcat/Library/Developer/Xcode/DerivedData/test-ekuzomazcpfusagtzgfezuahoglm/Index.noindex/DataStore"}}}
DEBUG:root:Req --> {"jsonrpc":"2.0","method":"build\/initialized","params":{}}
[Trace - 9:39:49 PM] Received request 'client/registerCapability - (1)'.
[Trace - 9:39:49 PM] Sending response 'client/registerCapability - (1)'. Processing request took 0ms
[Trace - 9:39:49 PM] Received request 'client/registerCapability - (2)'.
[Trace - 9:39:49 PM] Sending response 'client/registerCapability - (2)'. Processing request took 0ms
[Trace - 9:39:49 PM] Received request 'client/registerCapability - (3)'.
[Trace - 9:39:49 PM] Sending response 'client/registerCapability - (3)'. Processing request took 1ms
[Trace - 9:39:49 PM] Received request 'client/registerCapability - (4)'.
[Trace - 9:39:49 PM] Sending response 'client/registerCapability - (4)'. Processing request took 0ms
DEBUG:root:Req --> {"jsonrpc":"2.0","method":"textDocument\/registerForChanges","id":2,"params":{"uri":"file:\/\/\/Users\/xboxdevcat\/Desktop\/test\/test\/ViewController.swift","action":"register"}}
[Trace - 9:39:49 PM] Received request 'client/registerCapability - (5)'.
[Trace - 9:39:49 PM] Sending response 'client/registerCapability - (5)'. Processing request took 0ms
DEBUG:root:Res <-- {"jsonrpc": "2.0", "id": 2, "result": null}
[Trace - 9:39:49 PM] Received request 'client/registerCapability - (6)'.
[Trace - 9:39:49 PM] Sending response 'client/registerCapability - (6)'. Processing request took 0ms
[Trace - 9:39:49 PM] Sending request 'textDocument/inlayHint - (4)'.
DEBUG:root:Res <-- {"jsonrpc": "2.0", "method": "build/sourceKitOptionsChanged", "params": {"uri": "file:///Users/xboxdevcat/Desktop/test/test/ViewController.swift", "updatedOptions": {"options": ["-module-name", "test", "-Onone", "-enforce-exclusivity=checked", "/Users/xboxdevcat/Desktop/test/test/ViewController.swift", "/Users/xboxdevcat/Desktop/test/test/AppDelegate.swift", "/Users/xboxdevcat/Desktop/test/test/SceneDelegate.swift", "-DDEBUG", "-sdk", "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.0.sdk", "-target", "x86_64-apple-ios16.0-simulator", "-enable-bare-slash-regex", "-g", "-module-cache-path", "/Users/xboxdevcat/Library/Developer/Xcode/DerivedData/ModuleCache.noindex", "-Xfrontend", "-serialize-debugging-options", "-enable-testing", "-index-store-path", "/Users/xboxdevcat/Library/Developer/Xcode/DerivedData/test-ekuzomazcpfusagtzgfezuahoglm/Index.noindex/DataStore", "-swift-version", "5", "-I", "/Users/xboxdevcat/Library/Developer/Xcode/DerivedData/test-ekuzomazcpfusagtzgfezuahoglm/Build/Products/Debug-iphonesimulator", "-F", "/Users/xboxdevcat/Library/Developer/Xcode/DerivedData/test-ekuzomazcpfusagtzgfezuahoglm/Build/Products/Debug-iphonesimulator", "-emit-localized-strings", "-emit-localized-strings-path", "/Users/xboxdevcat/Library/Developer/Xcode/DerivedData/test-ekuzomazcpfusagtzgfezuahoglm/Build/Intermediates.noindex/test.build/Debug-iphonesimulator/test.build/Objects-normal/x86_64", "-c", "-j8", "-enable-batch-mode", "-incremental", "-output-file-map", "/Users/xboxdevcat/Library/Developer/Xcode/DerivedData/test-ekuzomazcpfusagtzgfezuahoglm/Build/Intermediates.noindex/test.build/Debug-iphonesimulator/test.build/Objects-normal/x86_64/test-OutputFileMap.json", "-save-temps", "-no-color-diagnostics", "-serialize-diagnostics", "-emit-dependencies", "-emit-module", "-emit-module-path", "/Users/xboxdevcat/Library/Developer/Xcode/DerivedData/test-ekuzomazcpfusagtzgfezuahoglm/Build/Intermediates.noindex/test.build/Debug-iphonesimulator/test.build/Objects-normal/x86_64/test.swiftmodule", "-Xcc", "-I/Users/xboxdevcat/Library/Developer/Xcode/DerivedData/test-ekuzomazcpfusagtzgfezuahoglm/Build/Intermediates.noindex/test.build/Debug-iphonesimulator/test.build/swift-overrides.hmap", "-Xcc", "-iquote", "-Xcc", "/Users/xboxdevcat/Library/Developer/Xcode/DerivedData/test-ekuzomazcpfusagtzgfezuahoglm/Build/Intermediates.noindex/test.build/Debug-iphonesimulator/test.build/test-generated-files.hmap", "-Xcc", "-I/Users/xboxdevcat/Library/Developer/Xcode/DerivedData/test-ekuzomazcpfusagtzgfezuahoglm/Build/Intermediates.noindex/test.build/Debug-iphonesimulator/test.build/test-own-target-headers.hmap", "-Xcc", "-I/Users/xboxdevcat/Library/Developer/Xcode/DerivedData/test-ekuzomazcpfusagtzgfezuahoglm/Build/Intermediates.noindex/test.build/Debug-iphonesimulator/test.build/test-all-target-headers.hmap", "-Xcc", "-iquote", "-Xcc", "/Users/xboxdevcat/Library/Developer/Xcode/DerivedData/test-ekuzomazcpfusagtzgfezuahoglm/Build/Intermediates.noindex/test.build/Debug-iphonesimulator/test.build/test-project-headers.hmap", "-Xcc", "-I/Users/xboxdevcat/Library/Developer/Xcode/DerivedData/test-ekuzomazcpfusagtzgfezuahoglm/Build/Products/Debug-iphonesimulator/include", "-Xcc", "-I/Users/xboxdevcat/Library/Developer/Xcode/DerivedData/test-ekuzomazcpfusagtzgfezuahoglm/Build/Intermediates.noindex/test.build/Debug-iphonesimulator/test.build/DerivedSources-normal/x86_64", "-Xcc", "-I/Users/xboxdevcat/Library/Developer/Xcode/DerivedData/test-ekuzomazcpfusagtzgfezuahoglm/Build/Intermediates.noindex/test.build/Debug-iphonesimulator/test.build/DerivedSources/x86_64", "-Xcc", "-I/Users/xboxdevcat/Library/Developer/Xcode/DerivedData/test-ekuzomazcpfusagtzgfezuahoglm/Build/Intermediates.noindex/test.build/Debug-iphonesimulator/test.build/DerivedSources", "-Xcc", "-DDEBUG=1", "-emit-objc-header", "-emit-objc-header-path", "/Users/xboxdevcat/Library/Developer/Xcode/DerivedData/test-ekuzomazcpfusagtzgfezuahoglm/Build/Intermediates.noindex/test.build/Debug-iphonesimulator/test.build/Objects-normal/x86_64/test-Swift.h", "-working-directory", "/Users/xboxdevcat/Desktop/test", "-experimental-emit-module-separately"], "workingDirectory": "/Users/xboxdevcat/Desktop/test"}}}
[Trace - 9:39:49 PM] Received notification 'textDocument/publishDiagnostics'.
[Trace - 9:39:49 PM] Received response 'textDocument/documentSymbol - (1)' in 114ms.
[Trace - 9:39:49 PM] Received response 'textDocument/documentColor - (2)' in 114ms.
[Trace - 9:39:50 PM] Received response 'textDocument/inlayHint - (4)' in 146ms.
[Trace - 9:39:50 PM] Received response 'textDocument/codeAction - (3)' in 222ms.
[Trace - 9:39:50 PM] Sending request 'textDocument/foldingRange - (5)'.
[Info  - 9:39:50 PM] Connection to server got closed. Server will restart.
[Trace - 9:39:50 PM] Sending request 'initialize - (0)'.
[Trace - 9:39:50 PM] Received response 'initialize - (0)' in 73ms.
[Trace - 9:39:50 PM] Sending notification 'initialized'.
[Trace - 9:39:50 PM] Sending notification 'textDocument/didOpen'.
[Trace - 9:39:50 PM] Sending request 'textDocument/documentSymbol - (1)'.
[Trace - 9:39:50 PM] Sending request 'textDocument/documentColor - (2)'.
[Trace - 9:39:50 PM] Sending request 'textDocument/codeAction - (3)'.
INFO:root:Xcode Build Server Startup. Waiting Request...
DEBUG:root:Req --> {"jsonrpc":"2.0","method":"build\/initialize","id":1,"params":{"rootUri":"file:\/\/\/Users\/xboxdevcat\/Desktop\/test\/","capabilities":{"languageIds":["c","cpp","objective-c","objective-cpp","swift"]},"bspVersion":"2.0","displayName":"SourceKit-LSP","version":"1.0"}}
DEBUG:root:Res <-- {"jsonrpc": "2.0", "id": 1, "result": {"displayName": "xcode build server", "version": "0.1", "bspVersion": "2.0", "rootUri": "file:///Users/xboxdevcat/Desktop/test/", "capabilities": {"languageIds": ["swift", "objective-c", "c", "cpp", "objective-cpp"]}, "data": {"indexDatabasePath": "/Users/xboxdevcat/Library/Caches/xcode-build-server/file:---Users-xboxdevcat-Desktop-test-/indexDatabasePath", "indexStorePath": "/Users/xboxdevcat/Library/Developer/Xcode/DerivedData/test-ekuzomazcpfusagtzgfezuahoglm/Index.noindex/DataStore"}}}
DEBUG:root:Req --> {"jsonrpc":"2.0","method":"build\/initialized","params":{}}
[Trace - 9:39:50 PM] Received request 'client/registerCapability - (1)'.
[Trace - 9:39:50 PM] Sending response 'client/registerCapability - (1)'. Processing request took 0ms
[Trace - 9:39:50 PM] Received request 'client/registerCapability - (2)'.
[Trace - 9:39:50 PM] Sending response 'client/registerCapability - (2)'. Processing request took 0ms
[Trace - 9:39:50 PM] Received request 'client/registerCapability - (3)'.
[Trace - 9:39:50 PM] Sending response 'client/registerCapability - (3)'. Processing request took 0ms
[Trace - 9:39:50 PM] Received request 'client/registerCapability - (4)'.
[Trace - 9:39:50 PM] Sending response 'client/registerCapability - (4)'. Processing request took 0ms
[Trace - 9:39:50 PM] Received request 'client/registerCapability - (5)'.
[Trace - 9:39:50 PM] Sending response 'client/registerCapability - (5)'. Processing request took 0ms
[Trace - 9:39:50 PM] Received request 'client/registerCapability - (6)'.
[Trace - 9:39:50 PM] Sending response 'client/registerCapability - (6)'. Processing request took 1ms
DEBUG:root:Req --> {"jsonrpc":"2.0","method":"textDocument\/registerForChanges","id":2,"params":{"uri":"file:\/\/\/Users\/xboxdevcat\/Desktop\/test\/test\/ViewController.swift","action":"register"}}
DEBUG:root:Res <-- {"jsonrpc": "2.0", "id": 2, "result": null}
DEBUG:root:Res <-- {"jsonrpc": "2.0", "method": "build/sourceKitOptionsChanged", "params": {"uri": "file:///Users/xboxdevcat/Desktop/test/test/ViewController.swift", "updatedOptions": {"options": ["-module-name", "test", "-Onone", "-enforce-exclusivity=checked", "/Users/xboxdevcat/Desktop/test/test/ViewController.swift", "/Users/xboxdevcat/Desktop/test/test/AppDelegate.swift", "/Users/xboxdevcat/Desktop/test/test/SceneDelegate.swift", "-DDEBUG", "-sdk", "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.0.sdk", "-target", "x86_64-apple-ios16.0-simulator", "-enable-bare-slash-regex", "-g", "-module-cache-path", "/Users/xboxdevcat/Library/Developer/Xcode/DerivedData/ModuleCache.noindex", "-Xfrontend", "-serialize-debugging-options", "-enable-testing", "-index-store-path", "/Users/xboxdevcat/Library/Developer/Xcode/DerivedData/test-ekuzomazcpfusagtzgfezuahoglm/Index.noindex/DataStore", "-swift-version", "5", "-I", "/Users/xboxdevcat/Library/Developer/Xcode/DerivedData/test-ekuzomazcpfusagtzgfezuahoglm/Build/Products/Debug-iphonesimulator", "-F", "/Users/xboxdevcat/Library/Developer/Xcode/DerivedData/test-ekuzomazcpfusagtzgfezuahoglm/Build/Products/Debug-iphonesimulator", "-emit-localized-strings", "-emit-localized-strings-path", "/Users/xboxdevcat/Library/Developer/Xcode/DerivedData/test-ekuzomazcpfusagtzgfezuahoglm/Build/Intermediates.noindex/test.build/Debug-iphonesimulator/test.build/Objects-normal/x86_64", "-c", "-j8", "-enable-batch-mode", "-incremental", "-output-file-map", "/Users/xboxdevcat/Library/Developer/Xcode/DerivedData/test-ekuzomazcpfusagtzgfezuahoglm/Build/Intermediates.noindex/test.build/Debug-iphonesimulator/test.build/Objects-normal/x86_64/test-OutputFileMap.json", "-save-temps", "-no-color-diagnostics", "-serialize-diagnostics", "-emit-dependencies", "-emit-module", "-emit-module-path", "/Users/xboxdevcat/Library/Developer/Xcode/DerivedData/test-ekuzomazcpfusagtzgfezuahoglm/Build/Intermediates.noindex/test.build/Debug-iphonesimulator/test.build/Objects-normal/x86_64/test.swiftmodule", "-Xcc", "-I/Users/xboxdevcat/Library/Developer/Xcode/DerivedData/test-ekuzomazcpfusagtzgfezuahoglm/Build/Intermediates.noindex/test.build/Debug-iphonesimulator/test.build/swift-overrides.hmap", "-Xcc", "-iquote", "-Xcc", "/Users/xboxdevcat/Library/Developer/Xcode/DerivedData/test-ekuzomazcpfusagtzgfezuahoglm/Build/Intermediates.noindex/test.build/Debug-iphonesimulator/test.build/test-generated-files.hmap", "-Xcc", "-I/Users/xboxdevcat/Library/Developer/Xcode/DerivedData/test-ekuzomazcpfusagtzgfezuahoglm/Build/Intermediates.noindex/test.build/Debug-iphonesimulator/test.build/test-own-target-headers.hmap", "-Xcc", "-I/Users/xboxdevcat/Library/Developer/Xcode/DerivedData/test-ekuzomazcpfusagtzgfezuahoglm/Build/Intermediates.noindex/test.build/Debug-iphonesimulator/test.build/test-all-target-headers.hmap", "-Xcc", "-iquote", "-Xcc", "/Users/xboxdevcat/Library/Developer/Xcode/DerivedData/test-ekuzomazcpfusagtzgfezuahoglm/Build/Intermediates.noindex/test.build/Debug-iphonesimulator/test.build/test-project-headers.hmap", "-Xcc", "-I/Users/xboxdevcat/Library/Developer/Xcode/DerivedData/test-ekuzomazcpfusagtzgfezuahoglm/Build/Products/Debug-iphonesimulator/include", "-Xcc", "-I/Users/xboxdevcat/Library/Developer/Xcode/DerivedData/test-ekuzomazcpfusagtzgfezuahoglm/Build/Intermediates.noindex/test.build/Debug-iphonesimulator/test.build/DerivedSources-normal/x86_64", "-Xcc", "-I/Users/xboxdevcat/Library/Developer/Xcode/DerivedData/test-ekuzomazcpfusagtzgfezuahoglm/Build/Intermediates.noindex/test.build/Debug-iphonesimulator/test.build/DerivedSources/x86_64", "-Xcc", "-I/Users/xboxdevcat/Library/Developer/Xcode/DerivedData/test-ekuzomazcpfusagtzgfezuahoglm/Build/Intermediates.noindex/test.build/Debug-iphonesimulator/test.build/DerivedSources", "-Xcc", "-DDEBUG=1", "-emit-objc-header", "-emit-objc-header-path", "/Users/xboxdevcat/Library/Developer/Xcode/DerivedData/test-ekuzomazcpfusagtzgfezuahoglm/Build/Intermediates.noindex/test.build/Debug-iphonesimulator/test.build/Objects-normal/x86_64/test-Swift.h", "-working-directory", "/Users/xboxdevcat/Desktop/test", "-experimental-emit-module-separately"], "workingDirectory": "/Users/xboxdevcat/Desktop/test"}}}
[Trace - 9:39:50 PM] Sending request 'textDocument/inlayHint - (4)'.
[Trace - 9:39:50 PM] Received notification 'textDocument/publishDiagnostics'.
[Trace - 9:39:50 PM] Received response 'textDocument/documentSymbol - (1)' in 126ms.
[Trace - 9:39:50 PM] Received response 'textDocument/documentColor - (2)' in 127ms.
[Trace - 9:39:50 PM] Received response 'textDocument/inlayHint - (4)' in 144ms.
[Trace - 9:39:50 PM] Received response 'textDocument/codeAction - (3)' in 238ms.
[Trace - 9:39:50 PM] Sending request 'textDocument/foldingRange - (5)'.
[Error - 9:39:50 PM] The SourceKit Language Server server crashed 5 times in the last 3 minutes. The server will not be restarted. See the output for more information.

if don't use xcode-build-server (there are no buildServer.json and .compile files in the project root directory), sourcekit-lsp works fine. Is this problem caused by sourcekit-lsp? Or is it a problem with xcode-build-server?

"use index_store_path_at..." message

I tried running this on an existing project and got "use index_path_at" error message. Presumably this is because my project has "enable index while building" set. I did try passing in the data store path specified by this error to sourcekit-lsp to try to use the data store directly, but the error logs complained about "no swift package management file found" (or something like that). That makes sense as my understanding is that sourcekit-lsp only supports IndexStoreDB for projects that user Swift Package Manager. And that shortcoming seems to be the basis for this project. So, my question is what should I do with this error?

Thanks for your help. This looks like it shows a lot of promise I hope to get it working.

Symbols from pch file not found when GCC_PRECOMPILE_PREFIX_HEADER=YES

When GCC_PRECOMPILE_PREFIX_HEADER=YES, those symbols that are derived from the import statements contained within the project's precompiled header are not found.

I'm not sure if this qualifies as an xcode-build-server issue or a clangd issue but I thought I should start with xcode-build-server for reasons that will be made clear.


Steps to reproduce

I created a minimal project that reproduces the issue as follows:

  • Create an iOS project using XCode's "App" template.
  • Add an obj-c header file that defines a simple protocol, e.g., DummyProtocol.h. Ensure that this file includes references to symbols found in Foundation/Foundation.h, e.g., NSSring, NSObject, NS_ASSUME_NONNULL_BEGIN, etc. Ensure that it does NOT include #import <Foundation/Foundation.h>.
  • Add an obj-c header/implementation pair that defines a simple class that implements the protocol, e.g., DummyClass.h and DummyClass.m. Ensure that these files include references to symbols found in Foundation/Foundation.h, e.g., NSSring, NSObject, NS_ASSUME_NONNULL_BEGIN, etc. Ensure that they do NOT include #import <Foundation/Foundation.h>.
  • Ensure <project name>-Bridging-Header.h gets created as part of this process (https://developer.apple.com/documentation/swift/importing-objective-c-into-swift).
  • Add a prefix header and make sure it contains #import <Foundation/Foundation.h>.
  • In Build Settings, set "Precompile Prefix Header" (GCC_PRECOMPILE_PREFIX_HEADER) to YES and set Prefix Header (GCC_PREFIX_HEADER) to the name of your prefix header file.
  • Build the project and generate .compile and buildServer.json as normal.

Navigate to any of the objective C files and note that symbols defined in Foundation.h are not found.


Some background info

I found this while working on a legacy project that is configured with a pch file. This project includes both Swift and Objc files so what I normally do is I use xcode-build-server/sourcekit-lsp for Swift files and clangd for ojbc files (two different lsp servers). To export XCode's objc build information, I use xcpretty to generate a compile_commands.json that clangd can use directly in lieu of BSP.

However, after working on Pull Request #18 recently I noticed you added logic to support Objc and C family languages so I reconfigured to use sourcekit-lsp for all files, not just swift files. That's when I found the issue.


Possible solution

Note that things work correctly in both my legacy project and in my minimal test project when I switch back to using clangd/xcpretty/compile_commands.json. In looking at the difference between your .compile file and xcpretty's compile_commands.json I notice the following diff:

This line in .compile

-include /Users/charshep/Library/Developer/Xcode/DerivedData-cxwpiawnfpmhvieflvvjcmiquuiw/Build/Intermediates.noindex/PrecompiledHeaders/SharedPrecompiledHeaders/4370315142437641375/Test_Prefix.pch

is replaced in compile_commands.json with

-include /Users/charshep/Projects/Test/Test/Test_Prefix.pch

which is the relative path of my pch file. When I manually replace the line in .compile with the line from compile_commands.json it works. I have more to say about this but I'll save that for a follow-up comment.

Please let me know if you have any questions or would like any additional info. Also, I know that English is not your native language so please let me know if there's anything in this report that I can clarify.

I've attached the objc files I used for my minimal test project.

objc_files.zip

Does it work with Clang or ObjectiveC?

Hello, I use this plugin with Swift/SwiftUI project, and it works perfectlly. But LSP does not works with ObjectiveC project without .compile file or compile_commands.json file.
Is it necessary to generate a .compile file or compile_commands.json file.

False positives (for functions) and duplicates (for properties) for vim.lsp.buf.definition()

Hi, I'm getting false positives for vim.lsp.buf.definition() of functions.

For example, when I am at the call site of the function fetchXML() at https://github.com/AlphaWallet/alpha-wallet-ios/blob/e870048dfde93923ce88d798d22c3bff8d1116f8/modules/AlphaWalletTokenScript/AlphaWalletTokenScript/Models/AssetDefinitionStore.swift#L130 and do vim.lsp.buf.definition(), I get these 2:

AssetDefinitionStore.swift|136 col 17| /// IMPLEMENTATION NOTE: Current implementation will fetch the same XML multiple times if this function is called again before the previous attempt has completed. A check (which requires tracking completion handlers) hasn't been implemented because this doesn't usually happen in practice
AssetDefinitionStore.swift|137 col 17| public func fetchXML(forContract contract: AlphaWallet.Address, server: RPCServer?, useCacheAndFetch: Bool = false, completionHandler: ((Result) -> Void)? = nil) {

The 1st entry is just the comment for the function 1 line above the function definition and the 2nd entry is the correct match.


I'm also getting duplicates for some type properties with vim.lsp.buf.definition(). eg.

When cursor is at https://github.com/AlphaWallet/alpha-wallet-ios/blob/e870048dfde93923ce88d798d22c3bff8d1116f8/AlphaWallet/Tokens/Collectibles/ViewModels/NFTAssetViewModel.swift#L35

I get these correct, but 2 duplicated matches:

NFTAssetViewModel.swift|35 col 17| private let service: TokensProcessingPipeline
NFTAssetViewModel.swift|35 col 17| private let service: TokensProcessingPipeline

Have tried cleaning and rebuilding in Xcode. Any idea what might be wrong? Or if you could suggest where to look, I might dig into the code a bit.

Thanks. xcode-build-server is a great tool.

Parse log with UnicodeDecodeError

I parse my xcodebuild log with the command below and got UnicodeDecodeError. Any suggestion for this?

xcode-build-server parse .nvim/xcodebuild/original_logs.log -o .nvim/xcodebuild/.compile

image

my xcodebuild log file
original_logs.log

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.