Sublime Text
In Editor Configuration: Supported
Code Action On Save: Supported
- install the LSP and sublime-zig-language package (Package Control Usage)
- place the following snippet in the
LSP.sublime-settings
(Preferences -> Package Settings -> LSP -> Settings) - place the following snippet in the
Zig.sublime-settings
(Preferences -> Package Settings -> Zig -> Settings)
// Zig.sublime-settings
{
// ZLS will run format on save
"zig.fmt.on_save": false,
// automatically hide the build/fmt output panel
"zig.quiet": true
}
Sublime Text 4
// LSP.sublime-settings
{
// General settings
// Keep in mind that these settings apply to any language and not just Zig.
// Formatting with ZLS matches `zig fmt`.
// The Zig FAQ answers some questions about `zig fmt`:
// https://github.com/ziglang/zig/wiki/FAQ
"lsp_format_on_save": true,
"lsp_code_actions_on_save": {
// Run code actions that currently supports adding and removing discards.
// "source.fixAll": true,
// Run code actions that sorts @import declarations.
// Available since ZLS `0.14.0-dev.188+2be424de5`
// "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,
"clients": {
"zig": {
"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": {
// 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"
}
}
}
}
Sublime Text 3
// LSP.sublime-settings
{
"clients": {
"zig": {
"command": ["/path/to/zls_executable"],
"enabled": true,
"languageId": "zig",
"scopes": ["source.zig"],
"syntaxes": ["Packages/Zig Language/Syntaxes/Zig.tmLanguage"]
}
}
}