# project_settings: Fix default settings values for \`DiagnosticsSettings\` \(\#30686\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/09503333af0a0f214549c23dcf369b0730ee8865)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: 09503333af0a0f214549c23dcf369b0730ee8865

Requested commit: 09503333af0a0f214549c23dcf369b0730ee8865

Commit: 09503333af0a0f214549c23dcf369b0730ee8865

Tree: 88f5f6be5bca46a25f57d0f44e0fa1662f8f9e61

Author: Finn Evers

Committer: GitHub

## Message

````
project_settings: Fix default settings values for `DiagnosticsSettings` (#30686)

Follow-up to #30565

This PR fixes the default settings values for the `DiagnosticsSettings`.
The issue here was that due to the `#[derive(Default)]`, `button` would
be false by default, which unintentionally hid the diagnostics button by
default. The `#[serde(default = `default_true`)]` would only apply iff
the diagnostics key was already present in the user's settings. Thus, if
you have

```json
{
    "diagnostics": {...}
}
```

in your settings, the button would show (given it was not disabled).
However, if the key was not present, the button was not shown: Due to
the derived default for the entire struct, the value would be false.

This PR fixes this by implementing the default instead and moving the
`#[serde(default)]` up to the level of the struct.
I also did the same for the inline diagnostics settings, which already
had a default impl and thus only needed the serde default on the struct
instead of on all the struct fields.

Lastly, I simplified the title bar settings, since the serde attributes
previously had no effect anyway (deserialization happened in the
`TitlebarSettingsContent`, so these attributes had no effect) and we can
remove the `TitlebarSettingsContent` as well as the attributes if we
implement a proper default implementation instead.

Release Notes:

- Fixed the diagnostics status bar button being hidden by default.
````

## Parents

- [775370fd7d56c91bf191ba40485b9c6f66037446](https://git.cafe/gitcafe/zed/commit/775370fd7d56c91bf191ba40485b9c6f66037446?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/09503333af0a0f214549c23dcf369b0730ee8865?format=markdown)
