Closes #176. Add gofmt beautifier for Golang language
This commit is contained in:
parent
81fde0c9ea
commit
0a0ba673e8
|
@ -39,6 +39,8 @@ before_install:
|
||||||
- brew install pandoc
|
- brew install pandoc
|
||||||
# Java, C, C++, C#, Objective-C, D, Pawn, Vala
|
# Java, C, C++, C#, Objective-C, D, Pawn, Vala
|
||||||
- brew install uncrustify
|
- brew install uncrustify
|
||||||
|
# Golang
|
||||||
|
- brew install go
|
||||||
# PHP
|
# PHP
|
||||||
# - brew tap homebrew/homebrew-php
|
# - brew tap homebrew/homebrew-php
|
||||||
# - brew gist-logs php56
|
# - brew gist-logs php56
|
||||||
|
|
|
@ -44,6 +44,7 @@ Or Settings/Preferences ➔ Packages ➔ Search for `atom-beautify`
|
||||||
- [x] [Ruby](https://github.com/donaldpipowitch/atom-beautify/issues/25)
|
- [x] [Ruby](https://github.com/donaldpipowitch/atom-beautify/issues/25)
|
||||||
- Requires [Ruby Beautify](https://github.com/erniebrodeur/ruby-beautify)
|
- Requires [Ruby Beautify](https://github.com/erniebrodeur/ruby-beautify)
|
||||||
- [x] [CoffeeScript](https://github.com/donaldpipowitch/atom-beautify/issues/31)
|
- [x] [CoffeeScript](https://github.com/donaldpipowitch/atom-beautify/issues/31)
|
||||||
|
- [x] [Golang](https://github.com/Glavin001/atom-beautify/issues/176)
|
||||||
- [x] [Java](https://github.com/Glavin001/atom-beautify/issues/45)
|
- [x] [Java](https://github.com/Glavin001/atom-beautify/issues/45)
|
||||||
- Requires [Uncrustify](http://sourceforge.net/projects/uncrustify/)
|
- Requires [Uncrustify](http://sourceforge.net/projects/uncrustify/)
|
||||||
- [x] [C](https://github.com/Glavin001/atom-beautify/issues/57)
|
- [x] [C](https://github.com/Glavin001/atom-beautify/issues/57)
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import "fmt"
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
// Why so much white space?
|
||||||
|
|
||||||
|
fmt.Println("This is a poorly formatted file!")
|
||||||
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import "fmt"
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
// Why so much white space?
|
||||||
|
|
||||||
|
|
||||||
|
fmt.Println( "This is a poorly formatted file!" )
|
||||||
|
}
|
|
@ -129,6 +129,8 @@
|
||||||
"yaml",
|
"yaml",
|
||||||
"front matter",
|
"front matter",
|
||||||
"jekyll",
|
"jekyll",
|
||||||
"marko"
|
"marko",
|
||||||
|
"go",
|
||||||
|
"golang"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,8 @@ describe "BeautifyLanguages", ->
|
||||||
"java", "javascript", "json", "less",
|
"java", "javascript", "json", "less",
|
||||||
"mustache", "objective-c", "perl", "php",
|
"mustache", "objective-c", "perl", "php",
|
||||||
"python", "ruby", "sass", "sql",
|
"python", "ruby", "sass", "sql",
|
||||||
"typescript", "xml", "csharp", "gfm", "marko", "tss"
|
"typescript", "xml", "csharp", "gfm", "marko",
|
||||||
|
"tss", "go"
|
||||||
]
|
]
|
||||||
|
|
||||||
beforeEach ->
|
beforeEach ->
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
###
|
||||||
|
Requires http://golang.org/cmd/gofmt/
|
||||||
|
###
|
||||||
|
|
||||||
|
"use strict"
|
||||||
|
Beautifier = require('./beautifier')
|
||||||
|
|
||||||
|
module.exports = class gofmt extends Beautifier
|
||||||
|
name: "gofmt"
|
||||||
|
|
||||||
|
options: {
|
||||||
|
Go: true
|
||||||
|
}
|
||||||
|
|
||||||
|
beautify: (text, language, options) ->
|
||||||
|
@run("gofmt", [
|
||||||
|
@tempFile("input", text)
|
||||||
|
])
|
|
@ -36,6 +36,7 @@ module.exports = class Beautifiers
|
||||||
'coffee-formatter'
|
'coffee-formatter'
|
||||||
'htmlbeautifier'
|
'htmlbeautifier'
|
||||||
'csscomb'
|
'csscomb'
|
||||||
|
'gofmt'
|
||||||
'js-beautify'
|
'js-beautify'
|
||||||
'perltidy'
|
'perltidy'
|
||||||
'php-cs-fixer'
|
'php-cs-fixer'
|
||||||
|
@ -332,12 +333,12 @@ module.exports = class Beautifiers
|
||||||
userId: atom.config.get("atom-beautify._analyticsUserId")
|
userId: atom.config.get("atom-beautify._analyticsUserId")
|
||||||
event: "Beautify"
|
event: "Beautify"
|
||||||
properties:
|
properties:
|
||||||
language: language.name
|
language: language?.name
|
||||||
grammar: grammar
|
grammar: grammar
|
||||||
extension: fileExtension
|
extension: fileExtension
|
||||||
version: version
|
version: version
|
||||||
options: allOptions
|
options: allOptions
|
||||||
label: language.name
|
label: language?.name
|
||||||
category: version
|
category: version
|
||||||
#
|
#
|
||||||
if unsupportedGrammar
|
if unsupportedGrammar
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
module.exports = {
|
||||||
|
|
||||||
|
name: "Go"
|
||||||
|
description: "Golang"
|
||||||
|
namespace: "go"
|
||||||
|
|
||||||
|
###
|
||||||
|
Supported Grammars
|
||||||
|
###
|
||||||
|
grammars: [
|
||||||
|
"Go"
|
||||||
|
]
|
||||||
|
|
||||||
|
###
|
||||||
|
Supported extensions
|
||||||
|
###
|
||||||
|
extensions: [
|
||||||
|
"go"
|
||||||
|
]
|
||||||
|
|
||||||
|
options: []
|
||||||
|
|
||||||
|
}
|
|
@ -28,6 +28,7 @@ module.exports = class Languages
|
||||||
"d"
|
"d"
|
||||||
"ejs"
|
"ejs"
|
||||||
"erb"
|
"erb"
|
||||||
|
"go"
|
||||||
"handlebars"
|
"handlebars"
|
||||||
"html"
|
"html"
|
||||||
"java"
|
"java"
|
||||||
|
|
Loading…
Reference in New Issue