Add TypeScript support
This commit is contained in:
parent
6013e7eddc
commit
dcc9e2d3b5
|
@ -57,12 +57,12 @@ Or Settings/Preferences ➔ Packages ➔ Search for `atom-beautify`
|
|||
- Requires [Uncrustify](http://sourceforge.net/projects/uncrustify/)
|
||||
- [x] [Vala](https://github.com/Glavin001/atom-beautify/issues/57)
|
||||
- Requires [Uncrustify](http://sourceforge.net/projects/uncrustify/)
|
||||
- [x] [TypeScript](https://github.com/Glavin001/atom-beautify/issues/49)
|
||||
|
||||
### Road Map
|
||||
|
||||
#### Language support
|
||||
|
||||
- [ ] [TypeScript](https://github.com/Glavin001/atom-beautify/issues/49)
|
||||
- [ ] [Perl](https://github.com/Glavin001/atom-beautify/issues/33)
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
module TestModule {
|
||||
export class A {
|
||||
constructor(private a: string) {
|
||||
}
|
||||
}
|
||||
export class B extends A {
|
||||
}
|
||||
};
|
|
@ -0,0 +1,12 @@
|
|||
"use strict"
|
||||
TF = require("typescript-formatter/typescript-toolbox/lib/formatter")
|
||||
|
||||
module.exports = (text, options, callback) ->
|
||||
opts = TF.createDefaultFormatCodeOptions()
|
||||
|
||||
opts.TabSize = options.tab_width
|
||||
opts.IndentSize = options.indent_size
|
||||
|
||||
result = TF.applyFormatterToContent(text, opts)
|
||||
callback result
|
||||
result
|
|
@ -18,6 +18,7 @@ beautifyCoffeeScript = null
|
|||
uncrustifyBeautifier = null
|
||||
beautifyHTMLERB = null
|
||||
beautifyMarkdown = null
|
||||
beautifyTypeScript = null
|
||||
Analytics = null
|
||||
|
||||
# Misc
|
||||
|
@ -50,6 +51,7 @@ module.exports =
|
|||
"d"
|
||||
"pawn"
|
||||
"vala"
|
||||
"typescript"
|
||||
]
|
||||
|
||||
# Default options per language
|
||||
|
@ -233,6 +235,9 @@ module.exports =
|
|||
options.languageOverride = "JAVA"
|
||||
uncrustifyBeautifier ?= require("./langs/uncrustify/")
|
||||
uncrustifyBeautifier text, options, beautifyCompleted
|
||||
when "TypeScript"
|
||||
beautifyTypeScript ?= require("./langs/typescript-beautify")
|
||||
beautifyTypeScript text, self.getOptions("js", allOptions), beautifyCompleted
|
||||
else
|
||||
unsupportedGrammar = true
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
"main": "./lib/beautify",
|
||||
"version": "0.13.4",
|
||||
"private": true,
|
||||
"description": "Beautify HTML, CSS, JavaScript, PHP, Python, Ruby, Java, C, C++, C#, Objective-C, CoffeeScript, and SQL in Atom",
|
||||
"description": "Beautify HTML, CSS, JavaScript, PHP, Python, Ruby, Java, C, C++, C#, Objective-C, CoffeeScript, TypeScript, and SQL in Atom",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/Glavin001/atom-beautify"
|
||||
|
@ -63,6 +63,7 @@
|
|||
"python",
|
||||
"ruby",
|
||||
"coffeescript",
|
||||
"typescript",
|
||||
"c",
|
||||
"c++",
|
||||
"cpp",
|
||||
|
@ -94,6 +95,7 @@
|
|||
"coffee-formatter": "git+https://github.com/Glavin001/Coffee-Formatter.git",
|
||||
"atom-message-panel": "^1.1.1",
|
||||
"editorconfig": "^0.11.4",
|
||||
"loophole": "^1.0.0"
|
||||
"loophole": "^1.0.0",
|
||||
"typescript-formatter": "~0.1.4"
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue