Allow subscribing to updates of module.providers
data
#723
Labels
enhancement
New feature or request
good first issue
Good for newcomers
modules
Functionality related to the module block and modules generally
workspace/executeCommand
Milestone
Use-cases
#712 introduced a custom command to allow clients obtain data about required and installed providers. Clients may call this command repeatedly at any time and it's relatively cheap to do so. However the client may not necessarily know when is the right time to do so.
Clients should be able to "subscribe" to receive data updates whenever this data changes.
Attempted Solutions
Clients ask repeatedly - can lead to either excessive amount of requests and/or outdated info.
Proposal
The server already has mechanisms allowing it to detect state changes which affect the data returned from
module.providers
via hooksterraform-ls/internal/state/hooks.go
Lines 3 to 11 in 2027413
We can introduce additional optional argument
update-command-id
alongsideuri
terraform-ls/internal/langserver/handlers/command/module_providers.go
Line 29 in 2027413
which clients can use to register a particular client-side command ID which the server will call and pass updated data that way.
Alternatively we could follow the LSP spec a bit more closely and use that command just to trigger client-side re-reading of data, i.e. have client call
module.providers
again. This does require another RPC roundtrip, but aligns more with e.g. semantic tokens or code lens refresh.The text was updated successfully, but these errors were encountered: