handleHover provides hover information for SQL keywords. When the user hovers over a SQL keyword in their editor, this handler returns markdown-formatted documentation with syntax examples. The handler supports 60+ SQL keywords across all major categories: - Core DML: SELECT, INSERT, UPDATE, DELET
(params json.RawMessage)
| 605 | // - Empty Hover if position is not on a keyword |
| 606 | // - Error if document not found or params invalid |
| 607 | func (h *Handler) handleHover(params json.RawMessage) (*Hover, error) { |
| 608 | var p TextDocumentPositionParams |
| 609 | if err := json.Unmarshal(params, &p); err != nil { |
| 610 | return nil, err |
| 611 | } |
| 612 | |
| 613 | doc, ok := h.server.Documents().Get(p.TextDocument.URI) |
| 614 | if !ok { |
| 615 | // Return empty hover response instead of nil for proper LSP compliance |
| 616 | return &Hover{}, nil |
| 617 | } |
| 618 | |
| 619 | // Get word at position |
| 620 | word := doc.GetWordAtPosition(p.Position) |
| 621 | if word == "" { |
| 622 | return &Hover{}, nil |
| 623 | } |
| 624 | |
| 625 | // Look up keyword documentation |
| 626 | doc_text := getKeywordDocumentation(strings.ToUpper(word)) |
| 627 | if doc_text == "" { |
| 628 | return &Hover{}, nil |
| 629 | } |
| 630 | |
| 631 | return &Hover{ |
| 632 | Contents: MarkupContent{ |
| 633 | Kind: Markdown, |
| 634 | Value: doc_text, |
| 635 | }, |
| 636 | }, nil |
| 637 | } |
| 638 | |
| 639 | // handleCompletion provides completion suggestions for SQL keywords and snippets. |
| 640 | // |
no test coverage detected