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:
parent
06773e35df
commit
9ff43dafcc
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue