-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
TypeScript oddly formatted with 1.5.3 #552
Comments
issue from victorporof/Sublime-HTMLPrettify#162 |
Because this is a javascript beautifier and you're passing it TypeScript. 😄 This a perfect example of how not fully parsing (#200) is a strength rather than a weakness. The reason this bug showed up is that in javascript the This will work fine if you do this: class Test {
foo(): number {
return 0;
}
blah: string[];
bar(): number {
return 0;
}
} But lets be honest, that sucks. I'll fix this shortly. |
Any other oddness you want to tell me about? While I'm fixing and testing this one, I might as well wrap up an others. |
Thanks for the prompt fix. The other oddifies I've seen introduce some unnecessary space into optional parameters: blah ? : number // is better withouth the space between ? and : e.g. blah ?: number and generics: foo < T > (); // simpler without some of the spaces as foo() or foo< T >() But they're not big problems. |
Yeah, saw those. Could you file these as a new issue. They won't be addressed anytime soon, but it would be good to have them tracked (and opened by someone other than me, so we know later on that it wasn't some whim of mine 😄 ). |
Created #555 |
With library 1.5.3 TypeScript appears as (formatting settings listed below):
With an older version (Sublime-HTMLPrettify was using 1.5.0) the same code would appear as:
Seems to be related to the presence of the : character, removing some of the type information will fix the formatting. Is there a different configuration that will work with TypeScript?
options (from Sublime-HTMLPrettify):
The text was updated successfully, but these errors were encountered: