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

Method triggerATAForUpdatedProjects

internal/project/session.go:1708–1759  ·  view source on GitHub ↗
(newSnapshot *Snapshot)

Source from the content-addressed store, hash-verified

1706}
1707
1708func (s *Session) triggerATAForUpdatedProjects(newSnapshot *Snapshot) {
1709 for _, project := range newSnapshot.ProjectCollection.Projects() {
1710 if project.ShouldTriggerATA(newSnapshot.ID()) {
1711 s.backgroundQueue.Enqueue(s.backgroundCtx, func(ctx context.Context) {
1712 var logTree *logging.LogTree
1713 if s.options.LoggingEnabled {
1714 logTree = logging.NewLogTree("Triggering ATA for project " + project.Name())
1715 }
1716
1717 typingsInfo := project.ComputeTypingsInfo()
1718 request := &ata.TypingsInstallRequest{
1719 ProjectID: project.configFilePath,
1720 TypingsInfo: &typingsInfo,
1721 FileNames: core.Map(project.Program.GetSourceFiles(), func(file *ast.SourceFile) string { return file.FileName() }),
1722 ProjectRootPath: project.currentDirectory,
1723 CompilerOptions: project.CommandLine.CompilerOptions(),
1724 CurrentDirectory: s.options.CurrentDirectory,
1725 GetScriptKind: core.GetScriptKindFromFileName,
1726 FS: s.fs.fs,
1727 Logger: logTree,
1728 }
1729
1730 projectDisplayName := project.DisplayName(s.options.CurrentDirectory)
1731 if s.client != nil {
1732 s.client.ProgressStart(diagnostics.Installing_types_for_0, projectDisplayName)
1733 }
1734 result, err := s.typingsInstaller.InstallTypings(request)
1735 if s.client != nil {
1736 s.client.ProgressFinish(diagnostics.Installing_types_for_0, projectDisplayName)
1737 }
1738 if err != nil {
1739 if logTree != nil {
1740 s.logger.Log(fmt.Sprintf("ATA installation failed for project %s: %v", project.Name(), err))
1741 s.logger.Log(logTree.String())
1742 }
1743 } else {
1744 if !slices.Equal(result.TypingsFiles, project.typingsFiles) {
1745 s.pendingATAChangesMu.Lock()
1746 defer s.pendingATAChangesMu.Unlock()
1747 s.pendingATAChanges[project.configFilePath] = &ATAStateChange{
1748 TypingsInfo: &typingsInfo,
1749 TypingsFiles: result.TypingsFiles,
1750 TypingsFilesToWatch: result.FilesToWatch,
1751 Logs: logTree,
1752 }
1753 s.ScheduleDiagnosticsRefresh()
1754 }
1755 }
1756 })
1757 }
1758 }
1759}
1760
1761func (s *Session) warmAutoImportCache(ctx context.Context, change SnapshotChange, oldSnapshot, newSnapshot *Snapshot) {
1762 if change.fileChanges.Changed.Len() == 1 {

Callers 1

updateSnapshotMethod · 0.95

Calls 15

StringMethod · 0.95
NewLogTreeFunction · 0.92
MapFunction · 0.92
ShouldTriggerATAMethod · 0.80
EnqueueMethod · 0.80
ComputeTypingsInfoMethod · 0.80
DisplayNameMethod · 0.80
InstallTypingsMethod · 0.80
EqualMethod · 0.80
NameMethod · 0.65
GetSourceFilesMethod · 0.65

Tested by

no test coverage detected