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

Method Get

pkg/lsp/documents.go:249–266  ·  view source on GitHub ↗

Get retrieves a copy of a document to avoid race conditions The returned document is a snapshot and modifications won't affect the original

(uri string)

Source from the content-addressed store, hash-verified

247// Get retrieves a copy of a document to avoid race conditions
248// The returned document is a snapshot and modifications won't affect the original
249func (dm *DocumentManager) Get(uri string) (*Document, bool) {
250 dm.mu.RLock()
251 defer dm.mu.RUnlock()
252 doc, ok := dm.documents[uri]
253 if !ok {
254 return nil, false
255 }
256 // Return a copy to prevent race conditions when accessing fields after lock release
257 docCopy := &Document{
258 URI: doc.URI,
259 LanguageID: doc.LanguageID,
260 Version: doc.Version,
261 Content: doc.Content,
262 Lines: make([]string, len(doc.Lines)),
263 }
264 copy(docCopy.Lines, doc.Lines)
265 return docCopy, true
266}
267
268// GetContent retrieves a document's content
269func (dm *DocumentManager) GetContent(uri string) (string, bool) {

Callers 14

TestDocumentManagerFunction · 0.95
handleHoverMethod · 0.45
handleCompletionMethod · 0.45
handleSignatureHelpMethod · 0.45
TestHandler_DidCloseFunction · 0.45
extractBearerTokenFunction · 0.45
TestRateLimitResponseFunction · 0.45

Calls 1

copyFunction · 0.85