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

Method handleSignatureHelp

pkg/lsp/handler.go:1331–1360  ·  view source on GitHub ↗

handleSignatureHelp provides signature help for SQL functions. This handler displays function parameter information when the user types an opening parenthesis or comma. It helps users understand function signatures without leaving their editor. Supported Functions (20+): - Aggregates: COUNT, SUM,

(params json.RawMessage)

Source from the content-addressed store, hash-verified

1329// - Empty SignatureHelp if cursor not in function call
1330// - Error if document not found or params invalid
1331func (h *Handler) handleSignatureHelp(params json.RawMessage) (*SignatureHelp, error) {
1332 var p TextDocumentPositionParams
1333 if err := json.Unmarshal(params, &p); err != nil {
1334 return nil, err
1335 }
1336
1337 doc, ok := h.server.Documents().Get(p.TextDocument.URI)
1338 if !ok {
1339 return &SignatureHelp{}, nil
1340 }
1341
1342 // Get the function name at position
1343 content := doc.Content
1344 funcName, paramIndex := h.getFunctionAtPosition(content, p.Position)
1345 if funcName == "" {
1346 return &SignatureHelp{}, nil
1347 }
1348
1349 // Look up function signature
1350 sig := getSQLFunctionSignature(strings.ToUpper(funcName))
1351 if sig == nil {
1352 return &SignatureHelp{}, nil
1353 }
1354
1355 return &SignatureHelp{
1356 Signatures: []SignatureInformation{*sig},
1357 ActiveSignature: 0,
1358 ActiveParameter: paramIndex,
1359 }, nil
1360}
1361
1362// getFunctionAtPosition finds the function name and parameter index at a position
1363func (h *Handler) getFunctionAtPosition(content string, pos Position) (string, int) {

Callers 1

HandleRequestMethod · 0.95

Calls 4

getFunctionAtPositionMethod · 0.95
getSQLFunctionSignatureFunction · 0.85
DocumentsMethod · 0.80
GetMethod · 0.45

Tested by

no test coverage detected