The workspace/didChangeConfiguration
is not a message you send from your extension, but is sent by Nova itself. The data Nova sends comes from your extension’s Preferences and properties set with the Configuration API.
Here I have a user visible preferences item, defined in the extension’s config JSON (this being just a fragment of the config):
{
"key": "gopls.ui.completion.usePlaceholders",
"title": "usePlaceholders",
"description": "placeholders enables placeholders for function parameters or struct fields in completion responses.",
"type": "boolean",
"default": false
}
When I check or uncheck the box in the extension preferences UI, Nova sends this language server automatically:
[Trace - 20:10:03.667 PM] Sending notification 'workspace/didChangeConfiguration'.
Params: {"settings":{"gopls":{"ui.completion.usePlaceholders":true}}}
So, it is a matter of arranging the data, either with the user visible Preferences configuration, or set programmatically with the Configuration API, but then letting Nova and the language server handle the actually message exchange.
Related to this, the language server can also ask Nova for workspace configuration more or less whenever it wants. Continuing with the example, Nova gets this request from the gopls language server, which asks for configuration scoped to a “section” named gopls, where a “section” in Nova’s universe is simply the first part before the first dot (.
) of extension preferences key. So for this request from gopls for the "gopls"
section:
[Trace - 20:10:03.667 PM] Received request 'workspace/configuration - (2)'.
Params: {"items":[{"section":"gopls"}]}
Nova responds with all the extension preferences keys starting with gopls.
:
[Trace - 20:10:03.668 PM] Sending response 'workspace/configuration - (2)' in 0ms.
Result: [{"ui.completion.usePlaceholders":true,"ui.navigation.importShortcut":"Both","build.buildFlags":[],"formatting.gofumpt":false,"ui.navigation.symbolMatcher":"Fuzzy","formatting.local":"","ui.documentation.linksInHover":true,"ui.navigation.symbolStyle":"Dynamic","build.directoryFilters":[],"ui.documentation.hoverKind":"FullDocumentation","ui.completion.matcher":"Fuzzy","ui.documentation.linkTarget":"pkg.go.dev"}]
I hope that helps!
-john