Closes #945. Update TypeScript Formatter beautifier
This commit is contained in:
parent
ef8ca9798b
commit
513ebd807c
|
@ -2,7 +2,7 @@ module XYZ {
|
|||
interface I {
|
||||
x: number,
|
||||
y,
|
||||
z
|
||||
z
|
||||
}
|
||||
|
||||
var zZz = {
|
||||
|
@ -31,9 +31,9 @@ if (x === 3) {
|
|||
}
|
||||
console.log("x");
|
||||
x = y.hey
|
||||
.b
|
||||
.c
|
||||
.d;
|
||||
.b
|
||||
.c
|
||||
.d;
|
||||
|
||||
|
||||
export class X {
|
||||
|
|
|
@ -118,7 +118,8 @@
|
|||
"strip-json-comments": "^1.0.2",
|
||||
"temp": "^0.8.3",
|
||||
"tidy-markdown": "^2.0.1",
|
||||
"typescript-formatter": "~0.3.2",
|
||||
"typescript": "^1.8.10",
|
||||
"typescript-formatter": "^2.1.0",
|
||||
"underscore-plus": "^1.6.6",
|
||||
"which": "^1.1.1",
|
||||
"winston": "^1.0.0",
|
||||
|
|
|
@ -10,17 +10,18 @@ module.exports = class TypeScriptFormatter extends Beautifier
|
|||
beautify: (text, language, options) ->
|
||||
return new @Promise((resolve, reject) =>
|
||||
|
||||
format = require("typescript-formatter/lib/formatter")
|
||||
formatterUtils = require("typescript-formatter/lib/utils")
|
||||
|
||||
opts = formatterUtils.createDefaultFormatCodeOptions()
|
||||
opts.TabSize = options.tab_width or options.indent_size
|
||||
opts.IndentSize = options.indent_size
|
||||
opts.IndentStyle = 'space'
|
||||
opts.convertTabsToSpaces = true
|
||||
@verbose('typescript', text, opts)
|
||||
try
|
||||
result = format(text, opts)
|
||||
format = require("typescript-formatter/lib/formatter").default
|
||||
formatterUtils = require("typescript-formatter/lib/utils")
|
||||
# @verbose('format', format, formatterUtils)
|
||||
|
||||
opts = formatterUtils.createDefaultFormatCodeOptions()
|
||||
opts.TabSize = options.tab_width or options.indent_size
|
||||
opts.IndentSize = options.indent_size
|
||||
opts.IndentStyle = 'space'
|
||||
opts.convertTabsToSpaces = true
|
||||
@verbose('typescript', text, opts)
|
||||
result = format('', text, opts)
|
||||
@verbose(result)
|
||||
resolve result
|
||||
catch e
|
||||
|
|
Loading…
Reference in New Issue