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

Function createWatcher

internal/execute/watcher.go:83–112  ·  view source on GitHub ↗
(
	sys tsc.System,
	configParseResult *tsoptions.ParsedCommandLine,
	compilerOptionsFromCommandLine *core.CompilerOptions,
	commandLineRaw *collections.OrderedMap[string, any],
	reportDiagnostic tsc.DiagnosticReporter,
	reportErrorSummary tsc.DiagnosticsReporter,
	testing tsc.CommandLineTesting,
)

Source from the content-addressed store, hash-verified

81var _ tsc.Watcher = (*Watcher)(nil)
82
83func createWatcher(
84 sys tsc.System,
85 configParseResult *tsoptions.ParsedCommandLine,
86 compilerOptionsFromCommandLine *core.CompilerOptions,
87 commandLineRaw *collections.OrderedMap[string, any],
88 reportDiagnostic tsc.DiagnosticReporter,
89 reportErrorSummary tsc.DiagnosticsReporter,
90 testing tsc.CommandLineTesting,
91) *Watcher {
92 wm := watchmanager.NewWatchManager(sys.Writer(), sys.FS().DirectoryExists)
93 if t, ok := testing.(watchmanager.CommandLineTestingWithWatchBackend); ok {
94 wm.SetBackend(t.WatchBackend())
95 }
96 w := &Watcher{
97 sys: sys,
98 config: configParseResult,
99 compilerOptionsFromCommandLine: compilerOptionsFromCommandLine,
100 commandLineRaw: commandLineRaw,
101 reportDiagnostic: reportDiagnostic,
102 reportErrorSummary: reportErrorSummary,
103 reportWatchStatus: tsc.CreateWatchStatusReporter(sys, configParseResult.Locale(), configParseResult.CompilerOptions(), testing),
104 testing: testing,
105 sourceFileCache: &collections.SyncMap[tspath.Path, *cachedSourceFile]{},
106 wm: wm,
107 }
108 if configParseResult.ConfigFile != nil {
109 w.configFileName = configParseResult.ConfigFile.SourceFile.FileName()
110 }
111 return w
112}
113
114func (w *Watcher) start(ctx context.Context) {
115 w.wm.Lock()

Callers 1

tscCompilationFunction · 0.85

Calls 9

SetBackendMethod · 0.95
NewWatchManagerFunction · 0.92
WriterMethod · 0.65
FSMethod · 0.65
WatchBackendMethod · 0.65
CompilerOptionsMethod · 0.65
FileNameMethod · 0.65
LocaleMethod · 0.45

Tested by

no test coverage detected