MCPcopy
hub / github.com/MadAppGang/dingo / handleRequest

Method handleRequest

pkg/lsp/server.go:256–317  ·  view source on GitHub ↗

handleRequest routes LSP requests to appropriate handlers

(ctx context.Context, reply jsonrpc2.Replier, req jsonrpc2.Request)

Source from the content-addressed store, hash-verified

254
255// handleRequest routes LSP requests to appropriate handlers
256func (s *Server) handleRequest(ctx context.Context, reply jsonrpc2.Replier, req jsonrpc2.Request) error {
257 s.config.Logger.Debugf("Received request: %s", req.Method())
258
259 switch req.Method() {
260 case "initialize":
261 return s.handleInitialize(ctx, reply, req)
262 case "initialized":
263 return s.handleInitialized(ctx, reply, req)
264 case "shutdown":
265 return s.handleShutdown(ctx, reply, req)
266 case "exit":
267 return s.handleExit(ctx, reply, req)
268 case "textDocument/didOpen":
269 return s.handleDidOpen(ctx, reply, req)
270 case "textDocument/didChange":
271 return s.handleDidChange(ctx, reply, req)
272 case "textDocument/didSave":
273 return s.handleDidSave(ctx, reply, req)
274 case "textDocument/didClose":
275 return s.handleDidClose(ctx, reply, req)
276 case "textDocument/completion":
277 return s.handleCompletion(ctx, reply, req)
278 case "textDocument/definition":
279 return s.handleDefinition(ctx, reply, req)
280 case "textDocument/typeDefinition":
281 return s.handleTypeDefinition(ctx, reply, req)
282 case "textDocument/hover":
283 return s.handleHover(ctx, reply, req)
284 case "textDocument/codeAction":
285 return s.handleCodeAction(ctx, reply, req)
286 case "textDocument/formatting":
287 return s.handleFormatting(ctx, reply, req)
288 // Code navigation methods
289 case "textDocument/references":
290 return s.handleReferences(ctx, reply, req)
291 case "textDocument/implementation":
292 return s.handleImplementation(ctx, reply, req)
293 case "textDocument/documentSymbol":
294 return s.handleDocumentSymbol(ctx, reply, req)
295 case "workspace/symbol":
296 return s.handleWorkspaceSymbol(ctx, reply, req)
297 case "callHierarchy/prepare":
298 return s.handlePrepareCallHierarchy(ctx, reply, req)
299 case "callHierarchy/incomingCalls":
300 return s.handleIncomingCalls(ctx, reply, req)
301 case "callHierarchy/outgoingCalls":
302 return s.handleOutgoingCalls(ctx, reply, req)
303 // Standard LSP notifications that should be silently acknowledged
304 case "$/cancelRequest", "$/setTrace", "$/logTrace", "workspace/didChangeWatchedFiles":
305 // These are client-to-server notifications that we don't need to process
306 // but shouldn't return an error for.
307 // - $/cancelRequest: request cancellation
308 // - $/setTrace, $/logTrace: trace configuration
309 // - workspace/didChangeWatchedFiles: file change notifications (we use our own watcher)
310 s.config.Logger.Debugf("Acknowledged notification: %s", req.Method())
311 return reply(ctx, nil, nil)
312 default:
313 // Unknown method - try forwarding to gopls

Callers

nothing calls this directly

Calls 15

handleInitializeMethod · 0.95
handleInitializedMethod · 0.95
handleShutdownMethod · 0.95
handleExitMethod · 0.95
handleDidOpenMethod · 0.95
handleDidChangeMethod · 0.95
handleDidSaveMethod · 0.95
handleDidCloseMethod · 0.95
handleCompletionMethod · 0.95
handleDefinitionMethod · 0.95
handleTypeDefinitionMethod · 0.95
handleHoverMethod · 0.95

Tested by

no test coverage detected