Add Apex language support

Include support for Salesforce's Java-like "Apex" language
This commit is contained in:
Jon Crenshaw 2016-02-17 21:54:08 -08:00
parent 1cb84db4f9
commit 718184554a
6 changed files with 58 additions and 3 deletions

View File

@ -125,7 +125,31 @@ Supported options for each language.
---
#### [Arduino - Config Path](#arduino---config-path)
#### [Apex - Config Path](#apex---config-path)
**Namespace**: `apex`
**Key**: `configPath`
**Type**: `string`
**Supported Beautifiers**: [`Uncrustify`](#uncrustify)
**Description**:
Path to uncrustify config file. i.e. uncrustify.cfg (Supported by Uncrustify)
**Example `.jsbeautifyrc` Configuration**
```json
{
"apex": {
"configPath": ""
}
}
```
#### [Arduino - Config Path](#arduino---config-path)
**Namespace**: `arduino`

View File

@ -149,6 +149,7 @@
"c#",
"uncrustify",
"java",
"apex",
"pawn",
"vala",
"d",

View File

@ -21,7 +21,7 @@ describe "BeautifyLanguages", ->
# Activate all of the languages
allLanguages = [
"c", "coffee-script", "css", "html",
"apex", "c", "coffee-script", "css", "html",
"java", "javascript", "json", "less",
"mustache", "objective-c", "perl", "php",
"python", "ruby", "sass", "sql", "svg",
@ -61,7 +61,7 @@ describe "BeautifyLanguages", ->
# Set Uncrustify config path
# uncrustifyConfigPath = path.resolve(__dirname, "../examples/nested-jsbeautifyrc/uncrustify.cfg")
# uncrustifyLangs = ["c", "cpp", "objectivec", "cs", "d", "java", "pawn", "vala"]
# uncrustifyLangs = ["apex", "c", "cpp", "objectivec", "cs", "d", "java", "pawn", "vala"]
# for lang in uncrustifyLangs
# do (lang) ->
# atom.config.set("atom-beautify.#{lang}_configPath", uncrustifyConfigPath)

View File

@ -11,6 +11,7 @@ _ = require('lodash')
module.exports = class Uncrustify extends Beautifier
name: "Uncrustify"
options: {
Apex: true
C: true
"C++": true
"C#": true
@ -50,6 +51,8 @@ module.exports = class Uncrustify extends Beautifier
# Select Uncrustify language
lang = "C" # Default is C
switch language
when "Apex"
lang = "Apex"
when "C"
lang = "C"
when "C++"

26
src/languages/apex.coffee Normal file
View File

@ -0,0 +1,26 @@
module.exports = {
name: "Apex"
namespace: "apex"
###
Supported Grammars
###
grammars: [
"Apex"
]
###
Supported extensions
###
extensions: [
"cls"
]
options:
configPath:
type: 'string'
default: ""
description: "Path to uncrustify config file. i.e. uncrustify.cfg"
}

View File

@ -12,6 +12,7 @@ module.exports = class Languages
# Supported unique configuration keys
# Used for detecting nested configurations in .jsbeautifyrc
languageNames: [
"apex"
"arduino"
"c-sharp"
"c"