Code completion and indexing
Completion, go to definition and error checking for Swift, Objective-C and C/C++, ready as soon as you open the project. When you need to build once first, and what to do when completion misbehaves.
Supported files
| Files | Provided by |
|---|---|
| .swift | Built into the extension. Starts the first time you open a Swift file. |
| .m .mm .h .c .cpp | The clangd extension, installed alongside KXBuild |
Don't run KXBuild's Swift support and the official Swift extension (swiftlang.swift-vscode) at the same time. If the official extension is installed, KXBuild steps aside and tells you once.
When you need to build first
Modules produced by other targets in the project, such as other frameworks or Swift packages, don't exist until they're built. Until then, imports of them show as not found. Build once and they resolve.
When code completion misbehaves
- Run KXBuild: Restart Code Completion. Use this too if you just installed the toolchain and the language server hasn't started.
- Run KXBuild: Re-Index Project after changing many files or switching branches.
- If a new file isn't recognized, make sure it's added to the project, then right-click the .xcodeproj in the Explorer and choose "Generate compile_commands.json".
- Check Output > SourceKit Language Server, or Output > clangd for Objective-C.
Next steps
Run and debug
Three ways to start (Build & Run, Run and Attach), what you see if a step fails after F5, panels and output during a debug session, launch.json fields and Dart debugging for Flutter.
Project Settings Editor
No need to open project.pbxproj. Change identity, deployment, signing and version on the General page, and view and edit Build Settings by Basic, Customized, All and by level, with resolved values shown live.