-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Resolve a problem of 1024 bytes limited help message in some terminals. #10980
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
Conversation
|
Hi @Dafrok, I'm your friendly neighborhood Microsoft Pull Request Bot (You can call me MSBOT). Thanks for your contribution! TTYL, MSBOT; |
src/compiler/tsc.ts
Outdated
|
|
||
| function printHelp() { | ||
| let output = ""; | ||
| const output: any = []; |
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.
string[] and not any
src/compiler/tsc.ts
Outdated
| } | ||
|
|
||
| sys.write(output); | ||
| output.forEach(function (val: any) { |
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.
no need for the type annotation. it is inferd from the type of output.
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.
use for (const line of output) instead. forEach does not exist on ES3 engines.
mhegazy
left a comment
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.
a few changes.
mhegazy
left a comment
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.
👍
Description
Some terminals cannot excute a single line out of 1024 bytes. When users want to check the help message by typing tsc or tsc --help, They may get a 1024 bytes length broken message.
I have no idea about if using console.log here is better or not, so I fixed the output rule to echo the help message line by line.
Enviroment
TypeScript Version: 1.8.10
Node.js Version: 6.2.0
System Version: OS X El Capitan 10.11.6
Reproduction
** or get in the main menuPackages -> platformio-ide-terminal -> Toggle` to open the terminal in ATOM.Input
Expected output
Version 1.8.10 Syntax: tsc [options] [file ...] Examples: tsc hello.ts tsc --out file.js file.ts tsc @args.txt Options: --allowJs Allow javascript files to be compiled. --allowSyntheticDefaultImports Allow default imports from modules with no default export. This does not affect code emit, just typechecking. --allowUnreachableCode Do not report errors on unreachable code. --allowUnusedLabels Do not report errors on unused labels. --baseUrl Base directory to resolve non-absolute module names. -d, --declaration Generates corresponding '.d.ts' file. --experimentalDecorators Enables experimental support for ES7 decorators. --forceConsistentCasingInFileNames Disallow inconsistently-cased references to the same file. -h, --help Print this message. --init Initializes a TypeScript project and creates a tsconfig.json file. --jsx KIND Specify JSX code generation: 'preserve' or 'react' --lib Specify library files to be included in the compilation: 'es5' 'es6' 'es2015' 'es7' 'es2016' 'es2017' 'dom' 'webworker' 'scripthost' 'es2015.core' 'es2 015.collection' 'es2015.generator' 'es2015.iterable' 'es2015.promise' 'es2015.proxy' 'es2015.reflect' 'es2015.symbol' 'es2015.symbol. wellknown' 'es2016.array.include' 'es2017.object' 'es2017.sharedmemory' --mapRoot LOCATION Specify the location where debugger should locate map files instead of generated locations. --maxNodeModuleJsDepth The maximum dependency depth to search under node_modules and load JavaScript files -m KIND, --module KIND Specify module code generation: 'commonjs', 'amd', 'system', 'umd' or 'es2015' --moduleResolution Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). --newLine NEWLINE Specify the end of line sequence to be used when emitting files: 'CRLF' (dos) or 'LF' (unix). --noEmit Do not emit outputs. --noEmitOnError Do not emit outputs if any errors were reported. --noFallthroughCasesInSwitch Report errors for fallthrough cases in switch statement. --noImplicitAny Raise error on expressions and declarations with an implied 'any' type. --noImplicitReturns Report error when not all code paths in function return a value. --noImplicitThis Raise error on 'this' expressions with an implied 'any' type. --noImplicitUseStrict Do not emit 'use strict' directives in module output. --noUnusedLocals Report Errors on Unused Locals. --noUnusedParameters Report Errors on Unused Parameters. --outDir DIRECTORY Redirect output structure to the directory. --outFile FILE Concatenate and emit output to single file. --preserveConstEnums Do not erase const enum declarations in generated code. --pretty Stylize errors and messages using color and context. (experimental) -p DIRECTORY, --project DIRECTORY Compile the project in the given directory. --reactNamespace Specify the object invoked for createElement and __spread when targeting 'react' JSX emit --removeComments Do not emit comments to output. --rootDir LOCATION Specify the root directory of input files. Use to control the output directory structure with -- outDir. --skipLibCheck Skip type checking of declaration files. --sourceMap Generates corresponding '.map' file. --sourceRoot LOCATION Specify the location where debugger should locate TypeScript files instead of source locations. --strictNullChecks Enable strict null checks. --suppressImplicitAnyIndexErrors Suppress noImplicitAny errors for indexing objects lacking index signatures. -t VERSION, --target VERSION Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES2015' --traceResolution Enable tracing of the name resolution process. --types Type declaration files to be included in compilation. -v, --version Print the compiler's version. -w, --watch Watch input files. @<file> Insert command line options and files from a file.Actual output
Version 1.8.10 Syntax: tsc [options] [file ...] Examples: tsc hello.ts tsc --out file.js file.ts tsc @args.txt Options: --allowJs Allow javascript files to be compiled. --allowSyntheticDefaultImports Allow default imports from modules with no default export. This does not affect code emit, just typechecking. --allowUnreachableCode Do not report errors on unreachable code. --allowUnusedLabels Do not report errors on unused labels. -d, --declaration Generates corresponding '.d.ts' file. --experimentalDecorators Enables experimental support for ES7 decorators. --forceConsistentCasingInFileNames Disallow inconsistently-cased references to the same file. -h, --help Print this message. --init Initializes a TypeScript project and creates a tsconfig.json file. --jsx KIND Specify JSX code generation: 'preserve' or 'reRemark
Not only my terminal, I googled the 1024 bytes limit is appeared in such a lot of cases.