Override Global Configuration in Workspace

Extensions can define both global and per-workspace configuration options. I would like to suggest that Nova implicitly lets the user override any global configuration options per workspace.

Currently, I have extensions where I copy most of the global configuration options to the workspace options and then write code that first looks in the workspace and then in the global options. This works well with values that can be empty – e.g. string or path – but types like boolean don’t have an empty value.

Now does it make sense to let the user override any global value per workspace? I think it does. Often, global configuration specifies things like external tools to use (e.g. language server, compiler, formatter). Different projects might need different versions of these tools. Global configuration might also define behavior, like e.g. whether to auto-format a file on saving. There might be a project where this is unwanted because it uses a different style guide, while you do want to use auto-formatting for other projects.

Mind you, needing to override the global configuration in a workspace doesn’t happen with every second project, it is somewhat of an exotic use-case. Still, it would be great if Nova would support this, because currently, with every global option I add, I think about whether the user might want to override this per workspace, and then usually copy the option to the workspace, because you never know.

1 Like

I initially thought local preferences would always supersede global ones and it was natural for Nova to take care of this for me. It later occurred to me that another use case is for local preferences to combine with global preferences – and that is perhaps why Panic chose to leave implementation up to extension developers. Indeed, I’ve since added a preference where local values are appended to global values.

2 Likes

The problem with implementing that for the extension is that it is very restricted.

For example, suppose I have a setting that auto-formats the code before saving. I can have a global boolean config item for this. However, when I want to provide an option to override it per workspace, I cannot use a boolean setting for that because it doesn’t have a null value – I need to remodel it to an enum with values enabled, disabled and use default.

Would Nova support this, it could provide a UI where the user can, in the project settings, add or remove items from the global config and set their values.

Generally, the current configuration settings don’t make much sense for types that do not have an obvious absent value. What does it mean to set required to false for a boolean config item? This should lead to some way that lets you avoid setting the value to either true or false, but doesn’t. Checkbox could be a tristate at least.

This would also be useful in the case where I want to disable an extension in a single workspace.

2 Likes