Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Oct 9, 2025

Fixes the issue where tsgo --all and tsgo --help --all produced no output, while the TypeScript compiler tsc --all displays comprehensive help information showing all compiler options.

Problem

The --all flag is meant to show an expanded version of the help information with all possible compiler options grouped by category. However, the implementation was incomplete:

func PrintHelp(sys System, commandLine *tsoptions.ParsedCommandLine) {
    if commandLine.CompilerOptions().All.IsFalseOrUnknown() {
        printEasyHelp(sys, getOptionsForHelp(commandLine))
    } else {
        // !!! printAllHelp(sys, getOptionsForHelp(commandLine))  // Not implemented
    }
}

Solution

Implemented the printAllHelp function to match the TypeScript source of truth in _submodules/TypeScript/src/compiler/executeCommandLine.ts. The function now:

  • Displays the header with version information
  • Shows three distinct sections matching TypeScript's implementation:
    1. ALL COMPILER OPTIONS - Lists all 100+ compiler options grouped by their categories (Command-line Options, Modules, JavaScript Support, Type Checking, etc.) with a footer linking to https://aka.ms/tsc
    2. WATCH OPTIONS - Shows watch-related configuration options with an explanatory header about watch mode
    3. BUILD OPTIONS - Displays build-specific options (verbose, dry, force, clean, stopBuildOnErrors) with an explanatory header about build mode
  • For each option, displays its name, description, type, and default value

Also fixed a bug in generateSectionOptionsOutput where categories were being output in random order due to Go map iteration. Now maintains category order based on first occurrence in the sorted options list, ensuring consistent output.

Additionally exported OptionsForWatch and OptionsForBuild to match the TypeScript naming convention and make these option lists available for the help display.

Result

Both tsgo --all and tsgo --help --all now produce 646 lines of comprehensive help output showing all TypeScript compiler options, watch options, and build options, matching the behavior of the official TypeScript compiler.

$ tsgo --all
tsc: The TypeScript Compiler - Version 7.0.0-dev

ALL COMPILER OPTIONS

### Command-line Options

--all
Show all compiler options.

--build, -b
Build one or more projects and their dependencies, if out of date
...

WATCH OPTIONS

Including --watch, -w will start watching the current project for the file changes. Once set, you can config watch mode with:

--watchFile
Specify how the TypeScript watch mode works.
...

BUILD OPTIONS

Using --build, -b will make tsc behave more like a build orchestrator than a compiler. This is used to trigger building composite projects which you can learn more about at https://aka.ms/tsc-composite-builds

--verbose, -v
Enable verbose logging.
...

Fixes #1798

Original prompt

This section details on the original issue you should resolve

<issue_title>noop cli: tsgo --all</issue_title>
<issue_description>## Steps to reproduce

tsc --all > tsc.txt
tsgo --all > tsgo.txt

Behavior with typescript@5.8 (Version 5.8.3)

tsc.txt

Behavior with tsgo (Version 7.0.0-dev.20251003.1)

tsgo.txt (no output)</issue_description>

Comments on the Issue (you are @copilot in this section)

Fixes #1798


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: jakebailey <5341706+jakebailey@users.noreply.github.com>
@Copilot Copilot AI changed the title [WIP] Fix noop cli behavior for tsgo --all command Implement printAllHelp to fix tsgo --all producing no output Oct 9, 2025
Copilot finished work on behalf of jakebailey October 9, 2025 11:30
@Copilot Copilot AI requested a review from jakebailey October 9, 2025 11:30
@jakebailey
Copy link
Member

@copilot double check that this PR matches the implementation in _submodule/TypeScript, which is the source of truth for our behavior.

…sections to --all help

Co-authored-by: jakebailey <5341706+jakebailey@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Oct 9, 2025

@copilot double check that this PR matches the implementation in _submodule/TypeScript, which is the source of truth for our behavior.

Verified! The implementation now matches _submodules/TypeScript/src/compiler/executeCommandLine.ts. The printAllHelp function now includes all three sections like TypeScript does:

  1. ALL COMPILER OPTIONS - with after-text linking to https://aka.ms/tsc
  2. WATCH OPTIONS - with before-text explaining watch mode
  3. BUILD OPTIONS - with before-text explaining build mode

Also exported OptionsForWatch and OptionsForBuild to match the TypeScript variables optionsForWatch and optionsForBuild.

Changes in commit 0e6e9e2.

Copilot finished work on behalf of jakebailey October 9, 2025 11:52
@jakebailey jakebailey marked this pull request as ready for review October 9, 2025 12:15
@Copilot Copilot AI review requested due to automatic review settings October 9, 2025 12:15
Copy link
Contributor

@Copilot Copilot AI left a 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 implements the missing printAllHelp function to fix the issue where tsgo --all and tsgo --help --all produced no output instead of showing comprehensive help information like the TypeScript compiler.

  • Implemented the complete printAllHelp function with three sections: ALL COMPILER OPTIONS, WATCH OPTIONS, and BUILD OPTIONS
  • Fixed category ordering in generateSectionOptionsOutput to maintain consistent output instead of random map iteration order
  • Exported OptionsForWatch and OptionsForBuild variables to match TypeScript naming conventions and make them accessible for help display

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
testdata/baselines/reference/tsc/commandLine/help-all.js Added comprehensive baseline output showing all 646 lines of help content with proper formatting and sections
internal/tsoptions/namemap.go Updated reference from optionsForWatch to exported OptionsForWatch
internal/tsoptions/diagnostics.go Updated reference from optionsForWatch to exported OptionsForWatch
internal/tsoptions/declswatch.go Exported optionsForWatch as OptionsForWatch for external access
internal/tsoptions/declsbuild.go Exported optionsForBuild as OptionsForBuild and moved BuildOpts definition after the exported variable
internal/execute/tsc/help.go Implemented printAllHelp function and fixed category ordering bug in generateSectionOptionsOutput

Copy link
Member

@jakebailey jakebailey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I diffed this against the submodule's tsc --all and they are nearly identical outside removed options and some unrelated option ordering differences that need to be fixed in another PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

noop cli: tsgo --all

3 participants