Merge pull request #383 from janmolnar/master
Add Fortran language support
This commit is contained in:
commit
a88f8a17d6
|
@ -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)
|
||||||
|
|
|
@ -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`
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
PROGRAM hello
|
||||||
|
PRINT *, "Hello World!"
|
||||||
|
END PROGRAM hello
|
|
@ -0,0 +1,3 @@
|
||||||
|
program hello
|
||||||
|
print *, "Hello World!"
|
||||||
|
end program hello
|
57
package.json
57
package.json
|
@ -17,35 +17,43 @@
|
||||||
"email": "glavin.wiechert@gmail.com",
|
"email": "glavin.wiechert@gmail.com",
|
||||||
"url": "https://github.com/Glavin001"
|
"url": "https://github.com/Glavin001"
|
||||||
},
|
},
|
||||||
"contributors": [{
|
"contributors": [
|
||||||
|
{
|
||||||
"name": "Donald Pipowitch",
|
"name": "Donald Pipowitch",
|
||||||
"email": "pipo@senaeh.de",
|
"email": "pipo@senaeh.de",
|
||||||
"url": "https://github.com/donaldpipowitch"
|
"url": "https://github.com/donaldpipowitch"
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
"name": "László Károlyi",
|
"name": "László Károlyi",
|
||||||
"url": "https://github.com/karolyi"
|
"url": "https://github.com/karolyi"
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
"name": "Marco Tanzi",
|
"name": "Marco Tanzi",
|
||||||
"url": "https://github.com/mtanzi"
|
"url": "https://github.com/mtanzi"
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
"name": "gvn lazar suntop",
|
"name": "gvn lazar suntop",
|
||||||
"url": "https://github.com/gvn"
|
"url": "https://github.com/gvn"
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
"name": "Vadim K.",
|
"name": "Vadim K.",
|
||||||
"url": "https://github.com/vadirn"
|
"url": "https://github.com/vadirn"
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
"name": "Filipe Silva",
|
"name": "Filipe Silva",
|
||||||
"url": "https://github.com/filipesilva"
|
"url": "https://github.com/filipesilva"
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
"name": "Ramón Cahenzli",
|
"name": "Ramón Cahenzli",
|
||||||
"url": "https://github.com/psy-q"
|
"url": "https://github.com/psy-q"
|
||||||
}],
|
}
|
||||||
|
],
|
||||||
"engines": {
|
"engines": {
|
||||||
"atom": ">=0.174.0 <2.0.0"
|
"atom": ">=0.174.0 <2.0.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"analytics-node": "^1.2.2",
|
"analytics-node": "^1.2.2",
|
||||||
"async": "^1.0.0",
|
"async": "^1.1.0",
|
||||||
"atom-message-panel": "^1.2.4",
|
"atom-message-panel": "^1.2.4",
|
||||||
"atom-space-pen-views": "^2.0.5",
|
"atom-space-pen-views": "^2.0.5",
|
||||||
"bluebird": "^2.9.26",
|
"bluebird": "^2.9.26",
|
||||||
|
@ -58,6 +66,7 @@
|
||||||
"event-kit": "^1.2.0",
|
"event-kit": "^1.2.0",
|
||||||
"expand-home-dir": "0.0.2",
|
"expand-home-dir": "0.0.2",
|
||||||
"extend": "^2.0.1",
|
"extend": "^2.0.1",
|
||||||
|
"handlebars": "^3.0.3",
|
||||||
"js-beautify": "^1.5.6",
|
"js-beautify": "^1.5.6",
|
||||||
"lodash": "3.9.3",
|
"lodash": "3.9.3",
|
||||||
"loophole": "^1.0.0",
|
"loophole": "^1.0.0",
|
||||||
|
@ -132,36 +141,6 @@
|
||||||
"go",
|
"go",
|
||||||
"golang"
|
"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": {
|
"devDependencies": {
|
||||||
"coffee-script": "^1.9.3",
|
"coffee-script": "^1.9.3",
|
||||||
"handlebars": "^3.0.3"
|
"handlebars": "^3.0.3"
|
||||||
|
|
|
@ -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)
|
||||||
|
))))))
|
|
@ -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)
|
||||||
|
)
|
|
@ -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'
|
||||||
|
|
|
@ -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"
|
||||||
|
|
||||||
|
}
|
|
@ -22,6 +22,7 @@ module.exports = class Languages
|
||||||
"ejs"
|
"ejs"
|
||||||
"erb"
|
"erb"
|
||||||
"go"
|
"go"
|
||||||
|
"fortran"
|
||||||
"handlebars"
|
"handlebars"
|
||||||
"html"
|
"html"
|
||||||
"java"
|
"java"
|
||||||
|
|
Loading…
Reference in New Issue