Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion internal/compiler/program.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,13 @@ func (p *Program) initCheckerPool() {
if p.opts.CreateCheckerPool != nil {
p.checkerPool = p.opts.CreateCheckerPool(p)
} else {
p.checkerPool = newCheckerPool(core.IfElse(p.SingleThreaded(), 1, 4), p)
checkers := 4
if p.SingleThreaded() {
checkers = 1
} else if p.Options().Checkers != nil {
checkers = min(max(*p.Options().Checkers, 1), 256)
}
p.checkerPool = newCheckerPool(checkers, p)
}
}

Expand Down
1 change: 1 addition & 0 deletions internal/core/compileroptions.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ type CompilerOptions struct {
PprofDir string `json:"pprofDir,omitzero"`
SingleThreaded Tristate `json:"singleThreaded,omitzero"`
Quiet Tristate `json:"quiet,omitzero"`
Checkers *int `json:"checkers,omitzero"`

sourceFileAffectingCompilerOptionsOnce sync.Once
sourceFileAffectingCompilerOptions SourceFileAffectingCompilerOptions
Expand Down
4 changes: 4 additions & 0 deletions internal/diagnostics/diagnostics_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions internal/diagnostics/extraDiagnosticMessages.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@
"category": "Message",
"code": 100002
},
"Set the number of checkers per program.": {
"category": "Message",
"code": 100003
},
"4, unless --singleThreaded is passed.": {
"category": "Message",
"code": 100004
},
"Non-relative paths are not allowed. Did you forget a leading './'?": {
"category": "Error",
"code": 5090
Expand Down
7 changes: 7 additions & 0 deletions internal/tsoptions/declscompiler.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,13 @@ var commonOptionsWithBuild = []*CommandLineOption{
Category: diagnostics.Command_line_Options,
Description: diagnostics.Generate_pprof_CPU_Slashmemory_profiles_to_the_given_directory,
},
{
Name: "checkers",
Kind: CommandLineOptionTypeNumber,
Category: diagnostics.Command_line_Options,
Description: diagnostics.Set_the_number_of_checkers_per_program,
DefaultValueDescription: diagnostics.X_4_unless_singleThreaded_is_passed,
},
}

var optionsForCompiler = []*CommandLineOption{
Expand Down
2 changes: 2 additions & 0 deletions internal/tsoptions/parsinghelpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,8 @@ func parseCompilerOptions(key string, value any, allOptions *core.CompilerOption
allOptions.SingleThreaded = ParseTristate(value)
case "quiet":
allOptions.Quiet = ParseTristate(value)
case "checkers":
allOptions.Checkers = parseNumber(value)
default:
// different than any key above
return false
Expand Down
3 changes: 3 additions & 0 deletions testdata/baselines/reference/tsbuild/commandLine/help.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@ Run in single threaded mode.
--pprofDir
Generate pprof CPU/memory profiles to the given directory.

--checkers
Set the number of checkers per program.

--verbose, -v
Enable verbose logging.

Expand Down
3 changes: 3 additions & 0 deletions testdata/baselines/reference/tsc/commandLine/help-all.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ Show all compiler options.
--build, -b
Build one or more projects and their dependencies, if out of date

--checkers
Set the number of checkers per program.

--help, -h
Print this message.

Expand Down