Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
internal/lsp: return err if ExecuteCommand prerequisites aren't met
Some Commands require that the buffer is saved before running them (i.e. generate, test and toggle details). If the buffer isn't saved gopls sends a ShowMessage request to the client. Before this change it did not return any error from the ExecuteCommand request itself (unless ShowMessage failed). A progress token can be provided by the client as a part of the ExecuteCommand request, and that is, according to the LSP spec one way to start a WorkDoneProgress. At this point the client expects that gopls send progress updates. With this change, ExecuteCommand now return an error if the buffer isn't saved, so that the client know that it shouldn't expect any progress updates with this specific token. Change-Id: I8a7af20a0c1532fc4ad03efd4e04bfb1a6871644 Reviewed-on: https://go-review.googlesource.com/c/tools/+/248766 Run-TryBot: Pontus Leitzler <leitzler@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Robert Findley <rfindley@google.com>
- Loading branch information