Add "code_actions_on_format"
(#7860)
This lets Go programmers configure `"code_actions_on_format": { "source.organizeImports": true, }` so that they don't have to manage their imports manually I landed on `code_actions_on_format` instead of `code_actions_on_save` (the VSCode version of this) because I want to run these when I explicitly format (and not if `format_on_save` is disabled). Co-Authored-By: Thorsten <thorsten@zed.dev> Release Notes: - Added `"code_actions_on_format"` to control additional formatting steps on format/save ([#5232](https://github.com/zed-industries/zed/issues/5232)). - Added a `"code_actions_on_format"` of `"source.organizeImports"` for Go ([#4886](https://github.com/zed-industries/zed/issues/4886)). Co-authored-by: Thorsten <thorsten@zed.dev>
This commit is contained in:
parent
e1ae0d46da
commit
ea322e1d1c
5 changed files with 221 additions and 13 deletions
|
@ -93,6 +93,8 @@ pub struct LanguageSettings {
|
|||
pub inlay_hints: InlayHintSettings,
|
||||
/// Whether to automatically close brackets.
|
||||
pub use_autoclose: bool,
|
||||
/// Which code actions to run on save
|
||||
pub code_actions_on_format: HashMap<String, bool>,
|
||||
}
|
||||
|
||||
/// The settings for [GitHub Copilot](https://github.com/features/copilot).
|
||||
|
@ -215,6 +217,11 @@ pub struct LanguageSettingsContent {
|
|||
///
|
||||
/// Default: true
|
||||
pub use_autoclose: Option<bool>,
|
||||
|
||||
/// Which code actions to run on save
|
||||
///
|
||||
/// Default: {} (or {"source.organizeImports": true} for Go).
|
||||
pub code_actions_on_format: Option<HashMap<String, bool>>,
|
||||
}
|
||||
|
||||
/// The contents of the GitHub Copilot settings.
|
||||
|
@ -550,6 +557,10 @@ fn merge_settings(settings: &mut LanguageSettings, src: &LanguageSettingsContent
|
|||
merge(&mut settings.use_autoclose, src.use_autoclose);
|
||||
merge(&mut settings.show_wrap_guides, src.show_wrap_guides);
|
||||
merge(&mut settings.wrap_guides, src.wrap_guides.clone());
|
||||
merge(
|
||||
&mut settings.code_actions_on_format,
|
||||
src.code_actions_on_format.clone(),
|
||||
);
|
||||
|
||||
merge(
|
||||
&mut settings.preferred_line_length,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue