MCPcopy Create free account
hub / github.com/ajitpratap0/GoSQLX / handleCodeAction

Method handleCodeAction

pkg/lsp/handler.go:1611–1626  ·  view source on GitHub ↗

handleCodeAction provides code actions (quick fixes) for diagnostics. This handler suggests automatic fixes for common SQL syntax errors and style issues. Code actions appear in the editor as lightbulb suggestions that users can apply with a single click. Supported Quick Fixes: - Add missing semic

(params json.RawMessage)

Source from the content-addressed store, hash-verified

1609// - Empty array if no fixes available
1610// - Error if params invalid
1611func (h *Handler) handleCodeAction(params json.RawMessage) ([]CodeAction, error) {
1612 var p CodeActionParams
1613 if err := json.Unmarshal(params, &p); err != nil {
1614 return nil, err
1615 }
1616
1617 actions := []CodeAction{}
1618
1619 // Generate quick fixes based on diagnostics
1620 for _, diag := range p.Context.Diagnostics {
1621 codeActions := h.getCodeActionsForDiagnostic(p.TextDocument.URI, diag)
1622 actions = append(actions, codeActions...)
1623 }
1624
1625 return actions, nil
1626}
1627
1628// getCodeActionsForDiagnostic generates code actions for a specific diagnostic
1629func (h *Handler) getCodeActionsForDiagnostic(uri string, diag Diagnostic) []CodeAction {

Callers 1

HandleRequestMethod · 0.95

Calls 1

Tested by

no test coverage detected