Sublime Text

Install the LSP and sublime-zig-language package (Package Control: Usage)

Zig.sublime-settings

Place the following snippet in the Zig.sublime-settings. (Preferences -> Package Settings -> Zig -> Settings)

{
  // ZLS will run format on save
  "zig.fmt.on_save": false,
  // automatically hide the build/fmt output panel
  "zig.quiet": true
}

LSP.sublime-settings

Place the following snippet in the LSP.sublime-settings. (Preferences -> Package Settings -> LSP -> Settings)

{
  // General settings
  // Keep in mind that these settings apply to any language and not just Zig.

  // Formatting with ZLS matches `zig fmt`.
  "lsp_format_on_save": true,
  "lsp_code_actions_on_format": {
    // Run code actions that currently supports adding and removing discards.
    // "source.fixAll": true,

    // Run code actions that sorts @import declarations.
    // "source.organizeImports": true,
  },
  // Show inlay hints in the editor. Inlay hints are short annotations within the code,
  // which show variable types or parameter names.
  // "show_inlay_hints": true,
  "semantic_highlighting": true,
}

LanguageServers.sublime-settings

Ensure to have the latest version of the LSP plugin installed. This separate configuration file has been added in 4070-2.10.0.

Place the following snippet in the LanguageServers.sublime-settings. (Preferences -> Package Settings -> LSP -> Server Configurations)

{
  "zls": {
    "enabled": true,
    // Set to "zls" if `zls` is in your PATH
    "command": ["/path/to/zls_executable"],
    "selector": "source.zig",
    // There are two ways to set config options:
    //   - edit your `zls.json` that applies to any editor that uses ZLS
    //   - set in-editor config options with the `settings` field below.
    //
    // Further information on how to configure ZLS:
    // https://zigtools.org/zls/configure/
    "settings": {
      "zls": {
        // Whether to enable build-on-save diagnostics
        //
        // Further information about build-on save:
        // https://zigtools.org/zls/guides/build-on-save/
        // "enable_build_on_save": true,

        // omit the following line if `zig` is in your PATH
        "zig_exe_path": "/path/to/zig_executable"
      }
    }
  }
}

Per-project config

The Sublime Text LSP plugin allows setting LSP settings per project via a .sublime-project file. See per-project-overrides.