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

Method handleDidOpen

pkg/lsp/handler.go:256–292  ·  view source on GitHub ↗

handleDidOpen handles document open notifications

(params json.RawMessage)

Source from the content-addressed store, hash-verified

254
255// handleDidOpen handles document open notifications
256func (h *Handler) handleDidOpen(params json.RawMessage) {
257 var p DidOpenTextDocumentParams
258 if err := json.Unmarshal(params, &p); err != nil {
259 h.server.Logger().Printf("textDocument/didOpen: failed to parse params: %v (raw: %s)", err, truncateForLog(params))
260 h.sendParseError("didOpen", err)
261 return
262 }
263
264 h.server.Logger().Printf("Document opened: %s", p.TextDocument.URI)
265
266 // Check document size limit
267 if len(p.TextDocument.Text) > h.server.MaxDocumentSizeBytes() {
268 h.server.Logger().Printf("Document too large: %d bytes (max: %d)", len(p.TextDocument.Text), h.server.MaxDocumentSizeBytes())
269 h.server.SendNotification("window/showMessage", ShowMessageParams{
270 Type: MessageWarning,
271 Message: fmt.Sprintf("Document is too large for full analysis (%d bytes, max %d bytes)", len(p.TextDocument.Text), h.server.MaxDocumentSizeBytes()),
272 })
273 // Still open the document but skip validation
274 h.server.Documents().Open(
275 p.TextDocument.URI,
276 p.TextDocument.LanguageID,
277 p.TextDocument.Version,
278 p.TextDocument.Text,
279 )
280 return
281 }
282
283 h.server.Documents().Open(
284 p.TextDocument.URI,
285 p.TextDocument.LanguageID,
286 p.TextDocument.Version,
287 p.TextDocument.Text,
288 )
289
290 // Validate and publish diagnostics
291 h.validateDocument(p.TextDocument.URI, p.TextDocument.Text, p.TextDocument.Version)
292}
293
294// handleDidChange handles document change notifications
295func (h *Handler) handleDidChange(params json.RawMessage) {

Callers 1

HandleNotificationMethod · 0.95

Calls 8

sendParseErrorMethod · 0.95
validateDocumentMethod · 0.95
truncateForLogFunction · 0.85
LoggerMethod · 0.80
MaxDocumentSizeBytesMethod · 0.80
SendNotificationMethod · 0.80
OpenMethod · 0.80
DocumentsMethod · 0.80

Tested by

no test coverage detected