Repository navigation
feat(cli): support --showConfig - #1041
Conversation
Merging this PR will not alter performance1 warning
Comparing Footnotes
|
Performance change vs mainWorkflow run · main Clef gate: Running benchmarks because the decision was unavailable (crates/tsrs_tsoptions/src/showconfig.rs: patch exceeds the Clef context limit (23711 bytes)). Release builds in fast mode (TSRS_FAST=1) with Hyperfine 2 hardware counters. After warming each binary, alternating main/PR pairs measure wall time at both the fast preset's default checker count and with --singleThreaded, with ten pairs per configuration by default. Instructions come from the single-threaded runs; peak RSS comes from the default-count runs.
Negative means the PR used less; positive means it used more. Deltas are medians of paired PR/main ratios for wall time and instructions. Single-threaded runs reduce scheduling noise; shared CI machines can still add noise to wall time. Measured medians (main â PR)
tsrs-lintRelease
Negative means the PR used less. Wall and CPU time deltas are medians of paired PR/main ratios; peak RSS compares medians. Measured lint medians (main â PR)
|
38aa2c6 to
34301f4
Compare
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.
Codex Review Summary: â CompletedThis comment shows the latest Codex review activity on this pull request.
âđïļ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with ð while any review is running, comments if it has suggestions, and reacts with ð once all reviews finish with no findings. |
Go's tsc, LSP and API servers get the working directory from os.Getwd, which on Unix returns $PWD when it names the current directory. tsrs used std::env::current_dir, which resolves symlinks, so in a directory reached through a symlink (such as /tmp on macOS) absolute paths in the output, for example the `exclude` entries printed by --showConfig, differed from tsgo. osvfs::getwd ports os.Getwd, and the tsc system, `--lsp`, `--api` and the filepath.Abs port use it.
TsConfig::to_json writes compileOnSave whenever it is set, including false; the comment said a false value was omitted too. Go's *bool field with omitzero likewise omits only nil.
âĶler_options Go's generator also leaves out options marked showConfig: false (generate-options.ts:346), which is why listFiles and listEmittedFiles are not serialized.
relative_path_from_path and relative_path_from_file_to_path port Go's relative_path.go, so they get the matching file (docs/PORTING.md: one Rust file per Go file). relativePathFromNormalizedPaths stays in rooted_path.rs, where Go defines it.
Go's RelativePathFromPath and RelativePathFromFileToPath take RootedDirectoryPath, RootedFilePath and RootedPath values, which are normalized by construction. The Rust ports take &str, and an unnormalized input such as /project/src/.. gives a wrong result, so the comments state the requirement.
The only dynamic-name case had different roots and returned early, so removing the root separator trim or the case-sensitive comparison in relative_path_from_normalized_paths left every test passing. The expected values come from Go's tspath on the pinned commit.
âĶselines The test counted its own scenarios, so a scenario added upstream would go untested in CI; only the Go-dump oracle, which CI does not run, would see it. It now compares the ported baselines with the files of tsc/showConfig plus extends/configDir-template-showConfig.js.
34301f4 to
cd8ac04
Compare
tsrs --showConfigexited witherror: --showConfig is not supported by tsrs.(status 5). It now prints the resolved config as tsgo does: the options from the config and the command line, the options they imply ("module": "nodenext"addsmoduleResolutionandmoduleDetection), andfiles,include,exclude,referencesandcompileOnSave, with paths relative to the config file.This ports Go
ConvertToTSConfigwith its implied options, the generatedserializeCompilerOptionsandserializeCompilerOptionEnum, andshowConfig, called at the same point oftscCompilation. The paths go through newtspathports ofRelativePathFromPathandRelativePathFromFileToPath.The working directory now follows Go's
os.Getwd(newSystem): on Unix it is$PWDwhen that names the current directory. tsrs usedstd::env::current_dir, which resolves symlinks, so in a directory reached through a symlink the absolute paths that--showConfigprints differed:The change applies to
tsc,--lspand the--api--cwddefault, which all useos.Getwdin Go. Watch mode is unaffected: the macOS watch tests pass, and a watch run from a symlinked$PWDreports edits.Tests:
tsctests/showconfig_test.rsruns the 21tsc/showConfigscenarios andconfigDir-template-showConfigand compares their baselines byte for byte. It fails when upstream adds a scenario it does not port, and it needs no Go dump, so it runs in CI.showconfig_test.rsintsrs_tsoptionsports Go'sshowconfig_test.go, which checks the serializer option by option against a reflection-based one.show_config.rsintsrs_cliruns the binary: implied options, an unknown option, and a symlinked$PWD(which fails without the working-directory change). Expected output is from tsgo at the pinned commit.typed_paths_test.rscovers the newtspathhelpers, including encoded dynamic roots, with expected values from Go.docs/COMPATIBILITY.mdlists--showConfigas supported and cites the current oracle counts: 228/250tsc, 190/193tsbuildand 40/42tscWatchscenario baselines.fixes #1032