Skip to content

Commit

Permalink
internal/lsp: make ShowDocument RPC available to gopls
Browse files Browse the repository at this point in the history
The window/showDocument RPC is now correctly classified as being
sent from the server to the client.

Change-Id: I659528af69662fb709242d326563d52070fd5702
Reviewed-on: https://go-review.googlesource.com/c/tools/+/315990
Run-TryBot: Peter Weinberger <pjw@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Peter Weinberger <pjw@google.com>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
  • Loading branch information
pjweinbgo committed May 3, 2021
1 parent 3e17c62 commit 062bf4e
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 20 deletions.
4 changes: 4 additions & 0 deletions internal/lsp/cmd/cmd.go
Expand Up @@ -443,6 +443,10 @@ func (c *cmdClient) Progress(context.Context, *protocol.ProgressParams) error {
return nil
}

func (c *cmdClient) ShowDocument(context.Context, *protocol.ShowDocumentParams) (*protocol.ShowDocumentResult, error) {
return nil, nil
}

func (c *cmdClient) WorkDoneProgressCreate(context.Context, *protocol.WorkDoneProgressCreateParams) error {
return nil
}
Expand Down
4 changes: 4 additions & 0 deletions internal/lsp/fake/client.go
Expand Up @@ -111,6 +111,10 @@ func (c *Client) WorkDoneProgressCreate(ctx context.Context, params *protocol.Wo
return nil
}

func (c *Client) ShowDocument(context.Context, *protocol.ShowDocumentParams) (*protocol.ShowDocumentResult, error) {
return nil, nil
}

// ApplyEdit applies edits sent from the server.
func (c *Client) ApplyEdit(ctx context.Context, params *protocol.ApplyWorkspaceEditParams) (*protocol.ApplyWorkspaceEditResponse, error) {
if len(params.Edit.Changes) != 0 {
Expand Down
16 changes: 16 additions & 0 deletions internal/lsp/protocol/tsclient.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 0 additions & 16 deletions internal/lsp/protocol/tsserver.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions internal/lsp/protocol/typescript/code.ts
Expand Up @@ -135,6 +135,7 @@ function setReceives() {
receives.set('workspace/applyEdit', 'client');
receives.set('textDocument/publishDiagnostics', 'client');
receives.set('window/workDoneProgress/create', 'client');
receives.set('window/showDocument', 'client');
receives.set('$/progress', 'client');
// a small check
receives.forEach((_, k) => {
Expand Down
4 changes: 0 additions & 4 deletions internal/lsp/server_gen.go
Expand Up @@ -228,10 +228,6 @@ func (s *Server) SetTrace(context.Context, *protocol.SetTraceParams) error {
return notImplemented("SetTrace")
}

func (s *Server) ShowDocument(context.Context, *protocol.ShowDocumentParams) (*protocol.ShowDocumentResult, error) {
return nil, notImplemented("ShowDocument")
}

func (s *Server) Shutdown(ctx context.Context) error {
return s.shutdown(ctx)
}
Expand Down

0 comments on commit 062bf4e

Please sign in to comment.