Config.observe not triggered for workspace preferences

I’m duplicating global preference config options to workspace preferences, and have noticed a couple issues. I’m using nova.config.observe() and notice:

  1. Changes to global extension preferences trigger my callback, but changes to workspace preferences do not.
  2. My callback is called 7 times whenever I change the global config.

My changes to workspace preferences are properly written to .nova/Configuration.json, but are always obscured by the global preference because my callback isn’t called with the workspace setting.

Ah, just noticed that nova.workspace has its own config object. I was under the impression that Nova reconciled global and workspace preferences in nova.config, but now see that’s my responsibility. Carry on!

Im getting my feet wet with Nova’s API, and had a similar issue, thus that means you need to check the nova.workspace.config first and if null check nova.config?

@ctkjose Yes, if you’re looking to overwrite global preferences with local ones. Another option is to merge global and workspace preferences, depending on the use case. The door is wide open for other logic too. This helped me understand why Panic chose not to reconcile global and workspace preferences in its API.

One more point, – my memory is fuzzy but I think empty values aren’t necessarily null. The may be an empty string or array, depending on the preference type. Something I and other extension devs have done is to have a “use global setting” option in the workspace preference that explicitly sets the value to null.

nice, thanks!

will definitely play with it…