Skip to content

Commit

Permalink
Closes #172, #146. Update to new Atom Config API.
Browse files Browse the repository at this point in the history
What's new:
- Add settings descriptions
- Update options for js-beautify (JS, CSS, HTML)
- Update Spec to support new changes
  • Loading branch information
Glavin001 committed Jan 3, 2015
1 parent a229220 commit eb1471d
Show file tree
Hide file tree
Showing 32 changed files with 371 additions and 89 deletions.
9 changes: 4 additions & 5 deletions examples/nested-jsbeautifyrc/cpp/expected/test.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
class Example
{

Example()
: member(0)
{
}
Example()
: member(0)
{}

int member;
int member;

};
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@

{{#items}}
{{#first}}
<li><strong>{{name}}</strong>
<li>
<strong>{{name}}</strong>
</li>
{{/first}}
{{#link}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ title: "This is a title!"
stuff

more stuff

38 changes: 31 additions & 7 deletions lib/beautify.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -222,13 +222,37 @@ handleSaveEvent = =>

{Subscriber} = require path.join(atom.packages.resourcePath, 'node_modules', 'emissary')
Subscriber.extend plugin
plugin.configDefaults = _.merge(
analytics: true
beautifyOnSave: false
beautifyEntireFileOnSave: true
muteUnsupportedLanguageErrors: false
muteAllErrors: false
disabledLanguages: []
plugin.config = _.merge(
analytics:
type: 'boolean'
default: true
description: "Automatically send usage information (NEVER CODE) to Google Analytics"
_analyticsUserId:
type: 'string'
default: ""
description: "Unique identifier for this user for tracking usage analytics"
beautifyOnSave:
type: 'boolean'
default: false
description: "Beautify active editor on save"
beautifyEntireFileOnSave:
type: 'boolean'
default: true
description: "When beautifying on save, use the entire file, even if there is selected text in the editor"
muteUnsupportedLanguageErrors:
type: 'boolean'
default: false
description: "Do not show \"Unsupported Language\" errors when they occur"
muteAllErrors:
type: 'boolean'
default: false
description: "Do not show any/all errors when they occur"
disabledLanguages:
type: 'array'
default: []
items:
type: 'string'
description: "An array of languages/grammars to disable Beautification for"
, defaultLanguageOptions)
plugin.activate = ->
handleSaveEvent()
Expand Down
11 changes: 7 additions & 4 deletions lib/langs/uncrustify/index.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,12 @@ getCmd = (inputPath, outputPath, options, cb) ->
else
# Has custom config path
editor = atom.workspace.getActiveEditor()
basePath = path.dirname(editor.getPath())
# console.log(basePath);
configPath = path.resolve(basePath, configPath)
done configPath
if editor?
basePath = path.dirname(editor.getPath())
# console.log(basePath);
configPath = path.resolve(basePath, configPath)
done configPath
else
cb(new Error("No Uncrustify Config Path set! Please configure Uncrustify with Atom Beautify."))
return
module.exports = cliBeautify(getCmd)
Loading

0 comments on commit eb1471d

Please sign in to comment.