@@ -11,27 +11,27 @@ import (
1111func readParams (method string , raw * json.RawMessage ) (interface {}, error ) {
1212 switch method {
1313 case "textDocument/didOpen" :
14- params := & lsp.DidOpenTextDocumentParams {}
14+ params := new ( lsp.DidOpenTextDocumentParams )
1515 err := json .Unmarshal (* raw , params )
1616 return params , err
1717 case "textDocument/didChange" :
18- params := & lsp.DidChangeTextDocumentParams {}
18+ params := new ( lsp.DidChangeTextDocumentParams )
1919 err := json .Unmarshal (* raw , params )
2020 return params , err
2121 case "textDocument/didSave" :
22- params := & lsp.DidSaveTextDocumentParams {}
22+ params := new ( lsp.DidSaveTextDocumentParams )
2323 err := json .Unmarshal (* raw , params )
2424 return params , err
2525 case "textDocument/didClose" :
26- params := & lsp.DidCloseTextDocumentParams {}
26+ params := new ( lsp.DidCloseTextDocumentParams )
2727 err := json .Unmarshal (* raw , params )
2828 return params , err
2929 case "textDocument/completion" :
30- params := & lsp.CompletionParams {}
30+ params := new ( lsp.CompletionParams )
3131 err := json .Unmarshal (* raw , params )
3232 return params , err
3333 case "textDocument/codeAction" :
34- params := & lsp.CodeActionParams {}
34+ params := new ( lsp.CodeActionParams )
3535 err := json .Unmarshal (* raw , params )
3636 return params , err
3737 case "textDocument/hover" :
@@ -43,11 +43,15 @@ func readParams(method string, raw *json.RawMessage) (interface{}, error) {
4343 case "textDocument/implementation" :
4444 fallthrough
4545 case "textDocument/documentHighlight" :
46- params := & lsp.TextDocumentPositionParams {}
46+ params := new (lsp.TextDocumentPositionParams )
47+ err := json .Unmarshal (* raw , params )
48+ return params , err
49+ case "textDocument/references" :
50+ params := new (lsp.ReferenceParams )
4751 err := json .Unmarshal (* raw , params )
4852 return params , err
4953 case "textDocument/publishDiagnostics" :
50- params := & lsp.PublishDiagnosticsParams {}
54+ params := new ( lsp.PublishDiagnosticsParams )
5155 err := json .Unmarshal (* raw , params )
5256 return params , err
5357 }
@@ -57,35 +61,37 @@ func readParams(method string, raw *json.RawMessage) (interface{}, error) {
5761func sendRequest (ctx context.Context , conn * jsonrpc2.Conn , method string , params interface {}) (interface {}, error ) {
5862 switch method {
5963 case "initialize" :
60- result := & lsp.InitializeResult {}
64+ result := new ( lsp.InitializeResult )
6165 err := conn .Call (ctx , method , params , result )
6266 return result , err
6367 case "textDocument/completion" :
64- result := & lsp.CompletionList {}
68+ result := new ( lsp.CompletionList )
6569 err := conn .Call (ctx , method , params , result )
6670 return result , err
6771 case "completionItem/resolve" :
68- result := & lsp.CompletionItem {}
72+ result := new ( lsp.CompletionItem )
6973 err := conn .Call (ctx , method , params , result )
7074 return result , err
7175 case "textDocument/hover" :
72- result := & Hover {}
76+ result := new ( Hover )
7377 err := conn .Call (ctx , method , params , result )
7478 return result , err
7579 case "textDocument/definition" :
7680 fallthrough
7781 case "textDocument/typeDefinition" :
7882 fallthrough
7983 case "textDocument/implementation" :
80- result := & []lsp.Location {}
84+ fallthrough
85+ case "textDocument/references" :
86+ result := new ([]lsp.Location )
8187 err := conn .Call (ctx , method , params , result )
8288 return result , err
8389 case "textDocument/documentHighlight" :
84- result := & []lsp.DocumentHighlight {}
90+ result := new ( []lsp.DocumentHighlight )
8591 err := conn .Call (ctx , method , params , result )
8692 return result , err
8793 case "window/showMessageRequest" :
88- result := & lsp.MessageActionItem {}
94+ result := new ( lsp.MessageActionItem )
8995 err := conn .Call (ctx , method , params , result )
9096 return result , err
9197 }
0 commit comments