MCPcopy Create free account
hub / github.com/microsoft/typescript-go / DidOpenFile

Method DidOpenFile

internal/project/session.go:295–318  ·  view source on GitHub ↗
(ctx context.Context, uri lsproto.DocumentUri, version int32, content string, languageKind lsproto.LanguageKind)

Source from the content-addressed store, hash-verified

293}
294
295func (s *Session) DidOpenFile(ctx context.Context, uri lsproto.DocumentUri, version int32, content string, languageKind lsproto.LanguageKind) {
296 s.cancelWarmAutoImportCache()
297 s.scheduleIdleCacheClean()
298 s.cancelScheduledSnapshotUpdate()
299 s.snapshotUpdateMu.Lock()
300 defer s.snapshotUpdateMu.Unlock()
301 s.pendingFileChangesMu.Lock()
302 s.pendingFileChanges = append(s.pendingFileChanges, FileChange{
303 Kind: FileChangeKindOpen,
304 URI: uri,
305 Version: version,
306 Content: content,
307 LanguageKind: languageKind,
308 })
309 changes, overlays := s.flushChangesLocked(ctx)
310 s.pendingFileChangesMu.Unlock()
311 s.UpdateSnapshot(ctx, overlays, SnapshotChange{
312 reason: UpdateReasonDidOpenFile,
313 fileChanges: changes,
314 ResourceRequest: ResourceRequest{
315 Documents: []lsproto.DocumentUri{uri},
316 },
317 })
318}
319
320func (s *Session) DidCloseFile(ctx context.Context, uri lsproto.DocumentUri) {
321 s.cancelWarmAutoImportCache()

Calls 8

flushChangesLockedMethod · 0.95
UpdateSnapshotMethod · 0.95
appendFunction · 0.50
LockMethod · 0.45
UnlockMethod · 0.45