Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow subscribing to updates of module.providers data #723

Closed
radeksimko opened this issue Nov 22, 2021 · 1 comment · Fixed by #902
Closed

Allow subscribing to updates of module.providers data #723

radeksimko opened this issue Nov 22, 2021 · 1 comment · Fixed by #902
Assignees
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

Comments

@radeksimko
Copy link
Member

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 hooks

type ModuleChangeHook func(oldMod, newMod *Module)
type ModuleChangeHooks []ModuleChangeHook
func (mh ModuleChangeHooks) notifyModuleChange(oldMod, newMod *Module) {
for _, h := range mh {
h(oldMod, newMod)
}
}

We can introduce additional optional argument update-command-id alongside uri

func ModuleProvidersHandler(ctx context.Context, args cmd.CommandArgs) (interface{}, error) {

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.

@radeksimko radeksimko added the good first issue Good for newcomers label Dec 1, 2021
@radeksimko radeksimko added the modules Functionality related to the module block and modules generally label Mar 2, 2022
@jpogran jpogran self-assigned this Apr 19, 2022
@jpogran jpogran linked a pull request Apr 29, 2022 that will close this issue
@radeksimko radeksimko added this to the v0.28.0 milestone May 3, 2022
@github-actions
Copy link

github-actions bot commented Jun 3, 2022

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 3, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request good first issue Good for newcomers modules Functionality related to the module block and modules generally workspace/executeCommand
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants