Skip to content
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

Allow comments in options file? #2945

Closed
JoshMcCullough opened this issue Apr 28, 2015 · 6 comments
Closed

Allow comments in options file? #2945

JoshMcCullough opened this issue Apr 28, 2015 · 6 comments
Labels
Fixed A PR has been merged for this issue Suggestion An idea for TypeScript

Comments

@JoshMcCullough
Copy link

E.g. when running tsc @TSCOptions.txt, it would be cool if there was a way to include comments in the options file since they can become very long. For instance:

--sourcemap
-t ES5                 # ECMAscript 5
-d                     # Generate declarations.
--out Output\MyModule.js

# First set of files.
FileA1.ts
FileA2.ts
...

# Second set of files.
FileB1.ts
FileB2.ts
...

Comments in this example are preceded with a # and can be inline or on their own line. Antything after a # would be stripped prior to compilation.

@mhegazy
Copy link
Contributor

mhegazy commented Apr 28, 2015

what about using tsconfig.json instead?
though that does not allow comments, it is more self describing.

@JoshMcCullough
Copy link
Author

I haven't heard of that - will do some research.

@mhegazy
Copy link
Contributor

mhegazy commented Apr 28, 2015

@JoshMcCullough
Copy link
Author

Yes. It doesn't solve the problem, but it is nice to know. 👍

@ghost
Copy link

ghost commented Apr 29, 2015

JSON specification does not allow having comments (Note: Newtonsoft JSON.NET provides non-standard aux feature to allow comments). It was removed at some point from specification as an "improvement", to which many people objected.

Nonetheless, it would be really handy to have .tsrc file, in conformity to .jshintrc, .jscsrc, and many other resource configuration files (wikipedia). The format of such file can be JSON with single-line comments, e.g. https://gist.githubusercontent.com/haschek/2595796/raw/500806cafd239ace8dc94c998a8d4f7270947b12/.jshintrc. For a Unix person, this will be a treat!

@madskristensen has also managed to validate and provide intellisense for .jshintrc, .jscsrc etc. in VS2013 and VS2015 via editor extensions, which signifies that it is a very viable option! (only Windows team needs to allow creating a . file in File Explorer and when saving from notepad's save as dialog, so we don't have to rename the file using cmd or powershell..)

@mhegazy mhegazy added the Suggestion An idea for TypeScript label May 28, 2015
@mhegazy
Copy link
Contributor

mhegazy commented Dec 9, 2015

tsconfig now supports comments, see #4987

@mhegazy mhegazy closed this as completed Dec 9, 2015
@mhegazy mhegazy added the Fixed A PR has been merged for this issue label Dec 9, 2015
@mhegazy mhegazy added this to the TypeScript 1.8 milestone Dec 9, 2015
@microsoft microsoft locked and limited conversation to collaborators Jun 18, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Fixed A PR has been merged for this issue Suggestion An idea for TypeScript
Projects
None yet
Development

No branches or pull requests

2 participants