getCommandLineWithTypingsFiles returns the command line augmented with typing files if ATA is enabled.
()
| 285 | |
| 286 | // getCommandLineWithTypingsFiles returns the command line augmented with typing files if ATA is enabled. |
| 287 | func (p *Project) getCommandLineWithTypingsFiles() *tsoptions.ParsedCommandLine { |
| 288 | if len(p.typingsFiles) == 0 { |
| 289 | return p.CommandLine |
| 290 | } |
| 291 | |
| 292 | // Check if ATA is enabled for this project |
| 293 | typeAcquisition := p.GetTypeAcquisition() |
| 294 | if typeAcquisition == nil || !typeAcquisition.Enable.IsTrue() { |
| 295 | return p.CommandLine |
| 296 | } |
| 297 | |
| 298 | p.commandLineWithTypingsFilesOnce.Do(func() { |
| 299 | if p.commandLineWithTypingsFiles == nil { |
| 300 | // Create an augmented command line that includes typing files |
| 301 | originalRootNames := p.CommandLine.FileNames() |
| 302 | newRootNames := make([]string, 0, len(originalRootNames)+len(p.typingsFiles)) |
| 303 | newRootNames = append(newRootNames, originalRootNames...) |
| 304 | newRootNames = append(newRootNames, p.typingsFiles...) |
| 305 | |
| 306 | // Create a new ParsedCommandLine with the augmented root file names |
| 307 | p.commandLineWithTypingsFiles = tsoptions.NewParsedCommandLine( |
| 308 | p.CommandLine.CompilerOptions(), |
| 309 | newRootNames, |
| 310 | tspath.ComparePathsOptions{ |
| 311 | UseCaseSensitiveFileNames: p.host.FS().UseCaseSensitiveFileNames(), |
| 312 | CurrentDirectory: p.currentDirectory, |
| 313 | }, |
| 314 | ) |
| 315 | } |
| 316 | }) |
| 317 | return p.commandLineWithTypingsFiles |
| 318 | } |
| 319 | |
| 320 | func (p *Project) setPotentialProjectReference(configFilePath tspath.Path) { |
| 321 | if p.potentialProjectReferences == nil { |
no test coverage detected