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

Method Update

pkg/lsp/documents.go:193–215  ·  view source on GitHub ↗

Update updates a document's content. This method is called when the client sends a textDocument/didChange notification. It applies content changes to an existing document and updates its version number. Parameters: - uri: Document URI to update - version: New version number (should be greater than

(uri string, version int, changes []TextDocumentContentChangeEvent)

Source from the content-addressed store, hash-verified

191// After applying changes, the Lines cache is automatically rebuilt for
192// efficient subsequent operations.
193func (dm *DocumentManager) Update(uri string, version int, changes []TextDocumentContentChangeEvent) {
194 dm.mu.Lock()
195 defer dm.mu.Unlock()
196
197 doc, ok := dm.documents[uri]
198 if !ok {
199 return
200 }
201
202 doc.Version = version
203
204 for _, change := range changes {
205 if change.Range == nil {
206 // Full document sync
207 doc.Content = change.Text
208 doc.Lines = splitLines(change.Text)
209 } else {
210 // Incremental sync
211 doc.Content = applyChange(doc.Content, doc.Lines, change)
212 doc.Lines = splitLines(doc.Content)
213 }
214 }
215}
216
217// Close removes a document from the manager.
218//

Callers 4

TestDocumentManagerFunction · 0.95
handleDidChangeMethod · 0.80
InitializeMethod · 0.80

Calls 2

applyChangeFunction · 0.85
splitLinesFunction · 0.70

Tested by 2

TestDocumentManagerFunction · 0.76