angelozerr / typescript.java

TypeScript IDE for Eclipse with JSDT & tsserver
https://github.com/Microsoft/TypeScript
MIT License
92 stars 14 forks source link

Store TS formatting preferences in tslint.json #65

Open atsu85 opened 8 years ago

atsu85 commented 8 years ago

(copied from my comment in another issue)

Great place to store formatting preferences would be tslint.json. Tslint uses that file to lint typescript source files and in addition to checking for errors there are rules to check indent and other formatting rules related to whitespaces, linebreak style, no trailing whitespaces and many more.

Using this file would have multiple benefits: 1) formatting styles are defined in a format that is not related to any specific IDE 2) usage can be checked by build tools, IDEs (Atom, IntelliJ IDEA and probably many more) and command-line tools.

atsu85 commented 8 years ago

Actually there are other good options to consider for storing the TS formatting preferences: looks like vvakame/typescript-formatter can read formatting rules from tslint.json, tsfmt.json and .editorconfig.

@angelozerr, have You considered using some other formatter instead Your own custom solution? There are also other tools, such as gulp-typescript-formatter that rely on vvakame/typescript-formatter

angelozerr commented 8 years ago

@angelozerr, have You considered using some other formatter instead Your own custom solution?

At first it's not my own custom solution, it's the standard mean with Eclipse preferences.

Yes I have started to study how to manage any formatter with extension point, but no time to implement it today. For the moment I'm studying debugging, I will study your idea when I will hav e time.

Anyway, thank's a lot for your great information about typescript formatter.

atsu85 commented 8 years ago

@angelozerr, have You considered using some other formatter instead Your own custom solution?

At first it's not my own custom solution, it's the standard mean with Eclipse preferences.

I meant the formatter(code that formats TS), not the code/means where preferences are stored.

angelozerr commented 8 years ago

I meant the formatter(code that formats TS)

For that I call tsserver "format" command with the configuration comming from Eclipse Preferences by using JSON object https://github.com/angelozerr/typescript.java/blob/master/core/ts.core/src/ts/client/format/FormatOptions.java waited by TYpeScript. So it's not a custom solution. VSCode does like this too.

atsu85 commented 8 years ago

Oh, my bad then.