When the configuration for the uncrustify config file path has no path

atom-beautify had the annoying habit of prepending the path to the
file open in the editor pane. This meant that in order to use a
project specific configuration every directory would need to contain
a config file -- unnacceptable. This changes the scheme to prepend
the path to the project when no path is specified making it possible
to have a single configuration file for an entire project and also
being able to maintain the configuration under source control.
This commit is contained in:
StevenIsaacs 2016-08-14 09:00:29 -07:00
parent 06773e35df
commit 9ff43dafcc
1 changed files with 5 additions and 4 deletions

View File

@ -10,7 +10,6 @@ _ = require('lodash')
module.exports = class Uncrustify extends Beautifier
name: "Uncrustify"
link: "https://github.com/uncrustify/uncrustify"
options: {
Apex: true
C: true
@ -38,16 +37,18 @@ module.exports = class Uncrustify extends Beautifier
editor = atom.workspace.getActiveTextEditor()
if editor?
basePath = path.dirname(editor.getPath())
# Expand Home Directory in Config Path
configPath = expandHomeDir(configPath)
projectPath = atom.workspace.project.getPaths()[0]
# console.log(basePath);
configPath = path.resolve(basePath, configPath)
# Expand Home Directory in Config Path
expandedConfigPath = expandHomeDir(configPath)
configPath = path.resolve(projectPath, expandedConfigPath)
resolve configPath
else
reject(new Error("No Uncrustify Config Path set! Please configure Uncrustify with Atom Beautify."))
)
.then((configPath) =>
# Select Uncrustify language
lang = "C" # Default is C
switch language