Zig SDK
RepositoryFinancesDiscussionsDiscordZulip
  • Home
  • Usage
  • Configuration
    • Editor
    • Properties
    • Items
Powered by GitBook

Copyright © Vezel Contributors

On this page
  • ZLS
  • clangd
Edit on GitHub
Export as PDF
  1. Configuration

Editor

Last updated 2 years ago

The Zig SDK is capable of integrating with and . This means that any editor with support for those language servers (e.g. ) can be used to edit a project using the Zig SDK.

ZLS

Start by . The is highly recommended.

At the moment, no further configuration is necessary.

clangd

Start by . The is highly recommended.

You have to tell clangd where to find the compile_commands.json compilation database. The Zig SDK creates these files in IntermediateOutputPath, i.e. obj/Debug/linux-x64 if you build with Configuration=Debug and RuntimeIdentifier=linux-x64. Due to the nature of C/C++ compilation, these compilation databases have to be dependent on build flags. So, you will have to pick one of them to use for your editing experience. The good news is that you can change which compilation database you use at any point if you need to.

To tell clangd where to find the compilation database, create a file called .clangd in your project directory with the following contents:

CompileFlags:
    CompilationDatabase: obj/Debug/linux-x64

(You may want to add this file to .gitignore.)

You can now restart the clangd language server. You should start to see rich editor features like code completion, hover widgets, navigation, etc.

ZLS
clangd
Visual Studio Code
installing ZLS
Visual Studio Code extension
installing clangd
Visual Studio Code extension