-
Notifications
You must be signed in to change notification settings - Fork 594
Implement tsgo functionality in tsc, promote tsc to main entrypoint #857
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR promotes the tsc
entrypoint by integrating missing flags previously available on the tsgo
entrypoint. Key changes include adding new compiler options (‑‑quiet, ‑‑singleThreaded, ‑‑pprofDir), reworking diagnostic reporting and configuration display, and refactoring multi‑threading support by replacing bool with tristate for single‑threaded mode.
Reviewed Changes
Copilot reviewed 29 out of 29 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
internal/tsoptions/parsinghelpers.go | Added new cases to parse compiler options for pprofDir, singleThreaded, and quiet. |
internal/tsoptions/declscompiler.go | Introduced new command-line option declarations for quiet, singleThreaded, and pprofDir. |
internal/execute/tsc.go | Updated diagnostic reporting, integrated pprof profiling, reworked showConfig handling, and refactored compileAndEmit to report timing stats. |
internal/execute/outputs.go | Modified createDiagnosticReporter to use the full compiler options and introduced new functions for formatting output statistics. |
internal/diagnostics/generate.go | Updated diagnostic generation to include extra messages from a new extraDiagnosticMessages.json file. |
internal/core/compileroptions.go | Added new compiler option fields (pprofDir, singleThreaded, quiet). |
internal/compiler/program.go | Refactored singleThreaded support by changing the field type from bool to core.Tristate and using a helper method for resolution. |
cmd/tsgo/* | Removed deprecated flags and legacy functions; updated the main entrypoint argument parsing to delegate command execution to the new execute package. |
_packages/api/src/client.ts & _extension/src/extension.ts | Updated flag values from “api”/“lsp” to “--api”/“--lsp”. |
README.md | Updated documentation to reflect the new behavior of the tsgo entrypoint. |
@@ -35,6 +39,12 @@ func executeCommandLineWorker(sys System, cb cbType, commandLine *tsoptions.Pars | |||
return ExitStatusDiagnosticsPresent_OutputsSkipped, nil | |||
} | |||
|
|||
if pprofDir := commandLine.CompilerOptions().PprofDir; pprofDir != "" { | |||
// !!! stderr? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The inline comment "!!! stderr?" appears to be a temporary note. Consider clarifying or removing it once the profiling output destination is finalized.
// !!! stderr? | |
// Begin profiling and write output to the specified directory |
Copilot uses AI. Check for mistakes.
@@ -96,6 +95,7 @@ func NewProgram(options ProgramOptions) *Program { | |||
|
|||
p.configFileName = options.ConfigFileName | |||
if p.configFileName != "" { | |||
// !!! delete this code, require options |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The comment suggesting deletion of legacy code indicates an incomplete cleanup. Once the new options handling is verified, remove this commented‐out block to reduce clutter.
Copilot uses AI. Check for mistakes.
This moves
tsgo tsc
to the top, implementing the features that are missing fromtsc
but present in the oldtsgo
entrypoint (so, adding--quiet
,--singleThreaded
,--pprofDir
,--showConfig
,--diagnostics
). LSP and API subcommands are now flags, e.g.tsgo --lsp ...
. I also removed--printTypes
, which I don't think is needed now that we have full testing.The only thing that is a downgrade is
--version
, which now goes back to the hardcoded version number, undoing #834. I'm not entirely certain how to handle this since we technically don't want to include this info by default in the command. Maybe we need--extendedVersion
or something. But, the commit info can also be extracted bygo version -m path/to/tsgo
on themod
line: