@@ -62,6 +62,10 @@ func readParams(method string, raw *json.RawMessage) (interface{}, error) {
62
62
params := new (lsp.DocumentOnTypeFormattingParams )
63
63
err := json .Unmarshal (* raw , params )
64
64
return params , err
65
+ case "textDocument/documentSymbol" :
66
+ params := new (lsp.DocumentSymbolParams )
67
+ err := json .Unmarshal (* raw , params )
68
+ return params , err
65
69
case "textDocument/publishDiagnostics" :
66
70
params := new (lsp.PublishDiagnosticsParams )
67
71
err := json .Unmarshal (* raw , params )
@@ -114,6 +118,10 @@ func sendRequest(ctx context.Context, conn *jsonrpc2.Conn, method string, params
114
118
result := new ([]lsp.TextEdit )
115
119
err := conn .Call (ctx , method , params , result )
116
120
return result , err
121
+ case "textDocument/documentSymbol" :
122
+ result := new ([]DocumentSymbol )
123
+ err := conn .Call (ctx , method , params , result )
124
+ return result , err
117
125
case "window/showMessageRequest" :
118
126
result := new (lsp.MessageActionItem )
119
127
err := conn .Call (ctx , method , params , result )
@@ -144,3 +152,14 @@ type MarkupContent struct {
144
152
Kind string `json:"kind"`
145
153
Value string `json:"value"`
146
154
}
155
+
156
+ // DocumentSymbol structure according to LSP
157
+ type DocumentSymbol struct {
158
+ Name string `json:"name"`
159
+ Detail string `json:"detail,omitempty"`
160
+ Kind lsp.SymbolKind `json:"kind"`
161
+ Deprecated bool `json:"deprecated,omitempty"`
162
+ Range lsp.Range `json:"range"`
163
+ SelectionRange lsp.Range `json:"selectionRange"`
164
+ Children []DocumentSymbol `json:"children,omitempty"`
165
+ }
0 commit comments