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

Method closeGoFileWithGopls

pkg/lsp/server.go:816–836  ·  view source on GitHub ↗

closeGoFileWithGopls closes the corresponding .go file with gopls CRITICAL FIX D1: Clean up when .dingo file is closed

(ctx context.Context, dingoPath string)

Source from the content-addressed store, hash-verified

814// closeGoFileWithGopls closes the corresponding .go file with gopls
815// CRITICAL FIX D1: Clean up when .dingo file is closed
816func (s *Server) closeGoFileWithGopls(ctx context.Context, dingoPath string) error {
817 // Convert .dingo path to .go path using config-aware calculation
818 goPath := s.dingoToGoPath(dingoPath)
819
820 s.config.Logger.Debugf("[Diagnostic Fix] Closing .go file with gopls: %s", goPath)
821
822 // Create didClose params for gopls
823 params := protocol.DidCloseTextDocumentParams{
824 TextDocument: protocol.TextDocumentIdentifier{
825 URI: protocol.DocumentURI(lspuri.File(goPath)),
826 },
827 }
828
829 // Close with gopls
830 if err := s.gopls.DidClose(ctx, params); err != nil {
831 return fmt.Errorf("gopls didClose failed: %w", err)
832 }
833
834 s.config.Logger.Debugf("[Diagnostic Fix] Successfully closed .go file with gopls: %s", goPath)
835 return nil
836}
837
838// publishDingoDiagnostics publishes Dingo-specific diagnostics (e.g., transpilation errors)
839// This is separate from gopls diagnostics (which are translated and forwarded)

Callers 1

handleDidCloseMethod · 0.95

Calls 5

dingoToGoPathMethod · 0.95
FileMethod · 0.80
DidCloseMethod · 0.80
DebugfMethod · 0.65
ErrorfMethod · 0.65

Tested by

no test coverage detected