Merge pull request #383 from janmolnar/master

Add Fortran language support
This commit is contained in:
Glavin Wiechert 2015-06-01 18:30:03 -03:00
commit a88f8a17d6
10 changed files with 331 additions and 166 deletions

View File

@ -57,6 +57,8 @@ Or Settings/Preferences ➔ Packages ➔ Search for `atom-beautify`
- Requires [Uncrustify](http://sourceforge.net/projects/uncrustify/) - Requires [Uncrustify](http://sourceforge.net/projects/uncrustify/)
- [x] [D](https://github.com/Glavin001/atom-beautify/issues/57) - [x] [D](https://github.com/Glavin001/atom-beautify/issues/57)
- Requires [Uncrustify](http://sourceforge.net/projects/uncrustify/) - Requires [Uncrustify](http://sourceforge.net/projects/uncrustify/)
- [x] [Fortran](https://github.com/Glavin001/atom-beautify/issues/300)
- Requires [GNU Emacs](http://www.gnu.org/software/emacs/)
- [x] [Pawn](https://github.com/Glavin001/atom-beautify/issues/57) - [x] [Pawn](https://github.com/Glavin001/atom-beautify/issues/57)
- Requires [Uncrustify](http://sourceforge.net/projects/uncrustify/) - Requires [Uncrustify](http://sourceforge.net/projects/uncrustify/)
- [x] [Vala](https://github.com/Glavin001/atom-beautify/issues/57) - [x] [Vala](https://github.com/Glavin001/atom-beautify/issues/57)

View File

@ -162,6 +162,24 @@ Retain empty lines. Consecutive empty lines will be converted to a single empty
**Description**: **Description**:
Path to uncrustify config file. i.e. uncrustify.cfg (Supported by Uncrustify) Path to uncrustify config file. i.e. uncrustify.cfg (Supported by Uncrustify)
### Fortran - Emacs path
**Key**: `fortran_emacs_path`
**Type**: `string`
**Description**:
Path to the `emacs` executable (Supported by Fortran Beautifier)
### Fortran - Emacs script path
**Key**: `fortran_emacs_script_path`
**Type**: `string`
**Description**:
Path to the emacs script (Supported by Fortran Beautifier)
### HTML - Indent inner html ### HTML - Indent inner html
**Key**: `html_indent_inner_html` **Key**: `html_indent_inner_html`
@ -924,6 +942,37 @@ Default Beautifier to be used for Go
**Description**: **Description**:
Automatically beautify Go files on save Automatically beautify Go files on save
### Language Config - Fortran - Disable Beautifying Language
**Key**: `language_fortran_disabled`
**Type**: `boolean`
**Description**:
Disable Fortran Beautification
### Language Config - Fortran - Default Beautifier
**Key**: `language_fortran_default_beautifier`
**Default**: `Fortran Beautifier`
**Type**: `string`
**Enum**: `Fortran Beautifier`
**Description**:
Default Beautifier to be used for Fortran
### Language Config - Fortran - Beautify On Save
**Key**: `language_fortran_beautify_on_save`
**Type**: `boolean`
**Description**:
Automatically beautify Fortran files on save
### Language Config - Handlebars - Disable Beautifying Language ### Language Config - Handlebars - Disable Beautifying Language
**Key**: `language_handlebars_disabled` **Key**: `language_handlebars_disabled`

View File

@ -0,0 +1,3 @@
PROGRAM hello
PRINT *, "Hello World!"
END PROGRAM hello

View File

@ -0,0 +1,3 @@
program hello
print *, "Hello World!"
end program hello

View File

@ -1,173 +1,152 @@
{ {
"name": "atom-beautify", "name": "atom-beautify",
"main": "./src/beautify", "main": "./src/beautify",
"version": "0.27.9", "version": "0.27.9",
"private": true, "private": true,
"description": "Beautify HTML, CSS, JavaScript, PHP, Python, Ruby, Java, C, C++, C#, Objective-C, CoffeeScript, TypeScript, 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": { "repository": {
"type": "git", "type": "git",
"url": "https://github.com/Glavin001/atom-beautify" "url": "https://github.com/Glavin001/atom-beautify"
},
"bugs": {
"url": "https://github.com/Glavin001/atom-beautify/issues"
},
"license": "MIT",
"author": {
"name": "Glavin Wiechert",
"email": "glavin.wiechert@gmail.com",
"url": "https://github.com/Glavin001"
},
"contributors": [
{
"name": "Donald Pipowitch",
"email": "pipo@senaeh.de",
"url": "https://github.com/donaldpipowitch"
}, },
"bugs": { {
"url": "https://github.com/Glavin001/atom-beautify/issues" "name": "László Károlyi",
"url": "https://github.com/karolyi"
}, },
"license": "MIT", {
"author": { "name": "Marco Tanzi",
"name": "Glavin Wiechert", "url": "https://github.com/mtanzi"
"email": "glavin.wiechert@gmail.com",
"url": "https://github.com/Glavin001"
}, },
"contributors": [{ {
"name": "Donald Pipowitch", "name": "gvn lazar suntop",
"email": "pipo@senaeh.de", "url": "https://github.com/gvn"
"url": "https://github.com/donaldpipowitch"
}, {
"name": "László Károlyi",
"url": "https://github.com/karolyi"
}, {
"name": "Marco Tanzi",
"url": "https://github.com/mtanzi"
}, {
"name": "gvn lazar suntop",
"url": "https://github.com/gvn"
}, {
"name": "Vadim K.",
"url": "https://github.com/vadirn"
}, {
"name": "Filipe Silva",
"url": "https://github.com/filipesilva"
}, {
"name": "Ramón Cahenzli",
"url": "https://github.com/psy-q"
}],
"engines": {
"atom": ">=0.174.0 <2.0.0"
}, },
"dependencies": { {
"analytics-node": "^1.2.2", "name": "Vadim K.",
"async": "^1.0.0", "url": "https://github.com/vadirn"
"atom-message-panel": "^1.2.4",
"atom-space-pen-views": "^2.0.5",
"bluebird": "^2.9.26",
"coffee-fmt": "0.10.2",
"coffee-formatter": "^0.1.2",
"csscomb": "^3.1.5",
"diff": "^1.4.0",
"editorconfig": "^0.12.2",
"emissary": "^1.3.3",
"event-kit": "^1.2.0",
"expand-home-dir": "0.0.2",
"extend": "^2.0.1",
"js-beautify": "^1.5.6",
"lodash": "3.9.3",
"loophole": "^1.0.0",
"node-dir": "^0.1.8",
"node-uuid": "^1.4.3",
"prettydiff": "^1.11.21",
"space-pen": "^5.1.1",
"strip-json-comments": "^1.0.2",
"temp": "^0.8.1",
"tidy-markdown": "^0.3.2",
"typescript-formatter": "~0.3.2",
"underscore-plus": "^1.6.6",
"winston": "^1.0.0",
"yaml-front-matter": "^3.2.3"
}, },
"activationCommands": { {
"atom-workspace": [ "name": "Filipe Silva",
"atom-beautify:help-debug-editor", "url": "https://github.com/filipesilva"
"atom-beautify:beautify-editor",
"core:save",
"core:save-as"
],
".tree-view .file .name": [
"atom-beautify:beautify-file"
],
".tree-view .directory .name": [
"atom-beautify:beautify-directory"
]
}, },
"keywords": [ {
"atom", "name": "Ramón Cahenzli",
"beautify", "url": "https://github.com/psy-q"
"beautifier",
"js-beautify",
"format",
"pretty",
"html",
"handlebars",
"mustache",
"xml",
"css",
"javascript",
"json",
"css",
"sass",
"scss",
"less",
"sql",
"markdown",
"php",
"python",
"ruby",
"coffeescript",
"typescript",
"c",
"c++",
"cpp",
"objective-c",
"c-sharp",
"c#",
"uncrustify",
"java",
"pawn",
"vala",
"d",
"erb",
"editorconfig",
"yaml",
"front matter",
"jekyll",
"marko",
"go",
"golang"
],
"dependencies": {
"analytics-node": "^1.2.2",
"async": "^1.0.0",
"atom-message-panel": "^1.2.4",
"atom-space-pen-views": "^2.0.5",
"bluebird": "^2.9.26",
"coffee-fmt": "0.10.2",
"coffee-formatter": "^0.1.2",
"csscomb": "^3.1.5",
"diff": "^1.4.0",
"editorconfig": "^0.12.2",
"emissary": "^1.3.3",
"event-kit": "^1.2.0",
"expand-home-dir": "0.0.2",
"extend": "^2.0.1",
"js-beautify": "^1.5.6",
"lodash": "3.9.3",
"loophole": "^1.0.0",
"node-dir": "^0.1.8",
"node-uuid": "^1.4.3",
"prettydiff": "^1.11.21",
"space-pen": "^5.1.1",
"strip-json-comments": "^1.0.2",
"temp": "^0.8.1",
"tidy-markdown": "^0.3.2",
"typescript-formatter": "~0.3.2",
"underscore-plus": "^1.6.6",
"winston": "^1.0.0",
"yaml-front-matter": "^3.2.3"
},
"devDependencies": {
"coffee-script": "^1.9.3",
"handlebars": "^3.0.3"
},
"scripts": {
"prepublish": "npm run docs",
"docs": "coffee docs/"
} }
],
"engines": {
"atom": ">=0.174.0 <2.0.0"
},
"dependencies": {
"analytics-node": "^1.2.2",
"async": "^1.1.0",
"atom-message-panel": "^1.2.4",
"atom-space-pen-views": "^2.0.5",
"bluebird": "^2.9.26",
"coffee-fmt": "0.10.2",
"coffee-formatter": "^0.1.2",
"csscomb": "^3.1.5",
"diff": "^1.4.0",
"editorconfig": "^0.12.2",
"emissary": "^1.3.3",
"event-kit": "^1.2.0",
"expand-home-dir": "0.0.2",
"extend": "^2.0.1",
"handlebars": "^3.0.3",
"js-beautify": "^1.5.6",
"lodash": "3.9.3",
"loophole": "^1.0.0",
"node-dir": "^0.1.8",
"node-uuid": "^1.4.3",
"prettydiff": "^1.11.21",
"space-pen": "^5.1.1",
"strip-json-comments": "^1.0.2",
"temp": "^0.8.1",
"tidy-markdown": "^0.3.2",
"typescript-formatter": "~0.3.2",
"underscore-plus": "^1.6.6",
"winston": "^1.0.0",
"yaml-front-matter": "^3.2.3"
},
"activationCommands": {
"atom-workspace": [
"atom-beautify:help-debug-editor",
"atom-beautify:beautify-editor",
"core:save",
"core:save-as"
],
".tree-view .file .name": [
"atom-beautify:beautify-file"
],
".tree-view .directory .name": [
"atom-beautify:beautify-directory"
]
},
"keywords": [
"atom",
"beautify",
"beautifier",
"js-beautify",
"format",
"pretty",
"html",
"handlebars",
"mustache",
"xml",
"css",
"javascript",
"json",
"css",
"sass",
"scss",
"less",
"sql",
"markdown",
"php",
"python",
"ruby",
"coffeescript",
"typescript",
"c",
"c++",
"cpp",
"objective-c",
"c-sharp",
"c#",
"uncrustify",
"java",
"pawn",
"vala",
"d",
"erb",
"editorconfig",
"yaml",
"front matter",
"jekyll",
"marko",
"go",
"golang"
],
"devDependencies": {
"coffee-script": "^1.9.3",
"handlebars": "^3.0.3"
},
"scripts": {
"prepublish": "npm run docs",
"docs": "coffee docs/"
}
} }

View File

@ -0,0 +1,46 @@
(defun f90-batch-indent-region ()
"Run `f90-batch-beatify-region' on the specified filename.
Use this from the command line, with `-batch';
it won't work in an interactive Emacs.
For example, invoke \"emacs -batch -l ~/.emacs-batch-f90-indent -f f90-batch-indent-region file.f\""
(if (not noninteractive)
(error "`f90-batch-indent-region' is to be used only with -batch"))
(let ((make-backup-files nil)
(version-control nil)
(auto-save-default nil)
(find-file-run-dired nil)
(kept-old-versions 259259)
(kept-new-versions 259259))
(let ((error 0)
file
(files ()))
(while command-line-args-left
(setq file (expand-file-name (car command-line-args-left)))
(cond ((not (file-exists-p file))
(message ">> %s does not exist!" file)
(setq error 1
command-line-args-left (cdr command-line-args-left)))
((file-directory-p file)
(setq command-line-args-left
(nconc (directory-files file)
(cdr command-line-args-left))))
(t
(setq files (cons file files)
command-line-args-left (cdr command-line-args-left)))))
(while files
(setq file (car files)
files (cdr files))
(condition-case err
(progn
(if buffer-file-name (kill-buffer (current-buffer)))
(find-file file)
(buffer-disable-undo (current-buffer))
(set-buffer-modified-p nil)
(f90-mode)
(message (file-name-nondirectory buffer-file-name))
; compute indentation of first
; line
(f90-indent-subprogram)
(f90-upcase-keywords)
(save-buffer)
))))))

View File

@ -0,0 +1,47 @@
###
Requires https://www.gnu.org/software/emacs/
###
"use strict"
Beautifier = require('../beautifier')
path = require("path")
module.exports = class FortranBeautifier extends Beautifier
name: "Fortran Beautifier"
options: {
Fortran: true
}
beautify: (text, language, options) ->
@debug('fortran-beautifier', options)
emacs_path = options.emacs_path
emacs_script_path = options.emacs_script_path
if not emacs_script_path
emacs_script_path = path.resolve(__dirname, "emacs-fortran-formating-script.lisp")
@debug('fortran-beautifier', 'emacs script path: ' + emacs_script_path)
args = [
'--batch'
'-l'
emacs_script_path
'-f'
'f90-batch-indent-region'
tempFile = @tempFile("temp", text)
]
if emacs_path
args.unshift("#{emacs_path}")
@run("python", args, {ignoreReturnCode: true})
.then(=>
@readFile(tempFile)
)
else
@run("emacs", args, {ignoreReturnCode: true})
.then(=>
@readFile(tempFile)
)

View File

@ -39,6 +39,7 @@ module.exports = class Beautifiers
'htmlbeautifier' 'htmlbeautifier'
'csscomb' 'csscomb'
'gofmt' 'gofmt'
'fortran-beautifier'
'js-beautify' 'js-beautify'
'perltidy' 'perltidy'
'php-cs-fixer' 'php-cs-fixer'

View File

@ -0,0 +1,34 @@
module.exports = {
name: "Fortran"
namespace: "fortran"
###
Supported Grammars
###
grammars: [
"Fortran - Modern"
]
###
Supported extensions
###
extensions: [
"f90"
]
###
###
options:
# JavaScript
emacs_path:
type: 'string'
default: ""
description: "Path to the `emacs` executable"
emacs_script_path:
type: 'string'
default: ""
description: "Path to the emacs script"
}

View File

@ -22,6 +22,7 @@ module.exports = class Languages
"ejs" "ejs"
"erb" "erb"
"go" "go"
"fortran"
"handlebars" "handlebars"
"html" "html"
"java" "java"