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

Method handleDidSave

pkg/lsp/server.go:610–642  ·  view source on GitHub ↗

handleDidSave processes didSave notifications

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

Source from the content-addressed store, hash-verified

608
609// handleDidSave processes didSave notifications
610func (s *Server) handleDidSave(ctx context.Context, reply jsonrpc2.Replier, req jsonrpc2.Request) error {
611 var params protocol.DidSaveTextDocumentParams
612 if err := json.Unmarshal(req.Params(), &params); err != nil {
613 return reply(ctx, nil, err)
614 }
615
616 // Handle .dingo file save
617 if isDingoFile(params.TextDocument.URI) {
618 dingoPath := params.TextDocument.URI.Filename()
619
620 // Run linter on save (always, regardless of auto-transpile setting)
621 go s.runLintOnSave(ctx, params.TextDocument.URI)
622
623 // Auto-transpile if enabled
624 // Note: The file watcher also triggers transpilation with 500ms debounce.
625 // We trigger here too for immediate feedback, but the transpiler has internal
626 // locking to prevent concurrent transpilations of the same file.
627 if s.config.AutoTranspile {
628 s.config.Logger.Debugf("Auto-transpile on save: %s", dingoPath)
629 go s.transpiler.OnFileChange(ctx, dingoPath)
630 }
631
632 // Don't forward to gopls - transpiler handles it after successful transpilation
633 return reply(ctx, nil, nil)
634 }
635
636 // Forward non-dingo files to gopls
637 if err := s.gopls.DidSave(ctx, params); err != nil {
638 s.config.Logger.Warnf("gopls didSave failed: %v", err)
639 }
640
641 return reply(ctx, nil, nil)
642}
643
644// handleDidClose processes didClose notifications
645func (s *Server) handleDidClose(ctx context.Context, reply jsonrpc2.Replier, req jsonrpc2.Request) error {

Callers 1

handleRequestMethod · 0.95

Calls 6

runLintOnSaveMethod · 0.95
isDingoFileFunction · 0.85
OnFileChangeMethod · 0.80
DebugfMethod · 0.65
WarnfMethod · 0.65
DidSaveMethod · 0.45

Tested by

no test coverage detected