Extension preferences can conflict

Extension preferences, in ~/Library/Application Support/Nova/UserConfiguration.json are all mingled together in a single JSON object, allowing cross-extension collisions naming collisions.

Related, the response to the LSP workspaces/configuration request can include configuration parameters which, in this situation, effectively come from a global shared namespace, not scoped to the extension managing the LanguageClient.

I’ve taken the practice of prefixing all my extension preferences with my extension ID, but currently if I do so, but that will not work for things I want the language server to be able to query. The gopls language server queries with "section": "gopls" and to be returned, the preference items must be gopls.<preference name>, not com.example.myextension.gopls.<preference name>.

1 Like

Yes, this is the recommendation. The extension documentation mentions that you should prefix all keys with a uniquing identifier (such as your extension ID).

In this case, gopls is the prefix, as it’s fairly unlikely that another extension will be accessing a key with that prefix unless it also wraps the Go language server.

The issue is that if I’m developing my own gopls extension, while also switching to another one, there isn’t a way to prevent them from sharing settings these setting, such that one breaks the gopls configuration expectations of the other. It is an edge case, I’ll grant, but I’m hard pressed to come up with a scenario reason why extension preferences should ever mingle with each other.

1 Like