atom-beautify icon indicating copy to clipboard operation
atom-beautify copied to clipboard

Atom-beautify cannot detect installed Uncrustify

Open shira952 opened this issue 3 years ago • 5 comments

Description

Atom-beautify return error when I run Beautify on Java file. Running which uncrustify return absolute path /usr/bin/uncrustify. Running uncrustify on terminal also return the command usage. Atom is v1.40, on Fedora 32.

Input Before Beautification

NA

Expected Output

NA

Actual Output

NA

Steps to Reproduce

  1. Install uncrustify using dnf install uncrustify
  2. Restart Atom
  3. Add code to Atom editor
  4. Run command Beautify
  5. atom-beautify return error "Could not find 'Uncrustify'. The program may not be installed."
  6. Add absolute path to Settings - Executables - Uncrustify
  7. Repeat step 2-4
  8. atom-beautify still return error "Could not find 'Uncrustify'. The program may not be installed."

Debug

2020-10-14T04:16:27.843Z - error: [beautifiers/index.coffee]  message=Could not find 'Uncrustify'. The program may not be installed., stack=Error: Could not find 'Uncrustify'. The program may not be installed.
    at Function.Executable.commandNotFoundError (/home/shira/.atom/packages/atom-beautify/src/beautifiers/executable.coffee:277:10)
    at HybridExecutable.Executable.commandNotFoundError (/home/shira/.atom/packages/atom-beautify/src/beautifiers/executable.coffee:269:18)
    at /home/shira/.atom/packages/atom-beautify/src/beautifiers/executable.coffee:115:25
    at tryCatcher (/home/shira/.atom/packages/atom-beautify/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/home/shira/.atom/packages/atom-beautify/node_modules/bluebird/js/release/promise.js:547:31)
    at Promise._settlePromise (/home/shira/.atom/packages/atom-beautify/node_modules/bluebird/js/release/promise.js:604:18)
    at Promise._settlePromise0 (/home/shira/.atom/packages/atom-beautify/node_modules/bluebird/js/release/promise.js:649:10)
    at Promise._settlePromises (/home/shira/.atom/packages/atom-beautify/node_modules/bluebird/js/release/promise.js:725:18)
    at _drainQueueStep (/home/shira/.atom/packages/atom-beautify/node_modules/bluebird/js/release/async.js:93:12)
    at _drainQueue (/home/shira/.atom/packages/atom-beautify/node_modules/bluebird/js/release/async.js:86:9)
    at Async._drainQueues (/home/shira/.atom/packages/atom-beautify/node_modules/bluebird/js/release/async.js:102:5)
    at Async.drainQueues (/home/shira/.atom/packages/atom-beautify/node_modules/bluebird/js/release/async.js:15:14)
    at process._tickCallback (internal/process/next_tick.js:68:7), code=CommandNotFound, errno=CommandNotFound, syscall=beautifier::run, file=Uncrustify, description=See Uncrustify installation instructions at https://github.com/Glavin001/atom-beautify#beautifiers or go to https://github.com/uncrustify/uncrustify
You can configure Atom Beautify with the absolute path to 'uncrustify' by setting 'Executable - Uncrustify - Path' in the Atom Beautify package settings.
Your program is properly installed if running 'which Uncrustify' in your Terminal returns an absolute path to the executable.

Checklist

I have:

  • [ ] Tried uninstalling and reinstalling Atom Beautify to ensure it installed properly
  • [x] Reloaded (or restarted) Atom to ensure it is not a caching issue
  • [x] Searched through existing Atom Beautify Issues at https://github.com/Glavin001/atom-beautify/issues so I know this is not a duplicate issue
  • [ ] Filled out the Input, Expected, and Actual sections above or have edited/removed them in a way that fully describes the issue.
  • [ ] Generated debugging information by executing Atom Beautify: Help Debug Editor command in Atom and added link for debug.md Gist to this issue

shira952 avatar Oct 14 '20 04:10 shira952

I am having a similar issue with Ubuntu 18.04 and uncrustify installed from source. Uncrustify is on my PATH and I've also tried setting the absolute path in settings -> Executables -> Uncrustify -> Binary/Script Path to /usr/local/bin/uncrustify, which is the absolute location of the binary.

russelldj avatar Oct 15 '20 16:10 russelldj

I'm facing the same issue on Manjaro, installing with sudo pacman -S uncrustify gives the same error when running beutify, even if the path is added manually.

jpmvferreira avatar Nov 04 '20 22:11 jpmvferreira

Same, Manjaro for me as well. I managed to install it with docker, and that version does run, but that gives another error:

Parsing: input2021020-2657-8fogbq.c995t.ino as language CPP do_source_file: Unable to create output2021020-2657-14p6ysa.fbh7.ino: Permission denied (13)

Parsing: input2021020-2657-8fogbq.c995t.ino as language CPP
do_source_file: Unable to create output2021020-2657-14p6ysa.fbh7.ino: Permission denied (13)
Hide Stack Trace
Error: Parsing: input2021020-2657-8fogbq.c995t.ino as language CPP
do_source_file: Unable to create output2021020-2657-14p6ysa.fbh7.ino: Permission denied (13)
    at /home/boba/.atom/packages/atom-beautify/src/beautifiers/executable.coffee:183:23
    at tryCatcher (/home/boba/.atom/packages/arduino-upload/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/home/boba/.atom/packages/arduino-upload/node_modules/bluebird/js/release/promise.js:547:31)
    at Promise._settlePromise (/home/boba/.atom/packages/arduino-upload/node_modules/bluebird/js/release/promise.js:604:18)
    at Promise._settlePromise0 (/home/boba/.atom/packages/arduino-upload/node_modules/bluebird/js/release/promise.js:649:10)
    at Promise._settlePromises (/home/boba/.atom/packages/arduino-upload/node_modules/bluebird/js/release/promise.js:729:18)
    at _drainQueueStep (/home/boba/.atom/packages/arduino-upload/node_modules/bluebird/js/release/async.js:93:12)
    at _drainQueue (/home/boba/.atom/packages/arduino-upload/node_modules/bluebird/js/release/async.js:86:9)
    at Async._drainQueues (/home/boba/.atom/packages/arduino-upload/node_modules/bluebird/js/release/async.js:102:5)
    at Async.drainQueues (/home/boba/.atom/packages/arduino-upload/node_modules/bluebird/js/release/async.js:15:14)
    at processTicksAndRejections (internal/process/task_queues.js:89:5)

Boba0514 avatar Jan 20 '21 12:01 Boba0514

Same for me ("Could not find 'Uncrustify'". setting the executable does not help). I wonder whether the fact that it is not being printed in lowercase ('uncrustify') is not causing any trouble (especially the suggestion 'which Uncrustify' which will indeed fail). Also, I noticed that the version of the system-wide uncrustify differs from the one that is mentioned in the package's config files.

Tomaqa avatar Sep 01 '21 18:09 Tomaqa

the error is on /atom-beautify/blob/master/src/beautifiers/uncrustify/index.coffee line 21 that can't read uncrustify version, current version uncrustify on manjaro is: uncrustify --version: Uncrustify_d-0.74.0_f

so i can fix it on my pc by rewrite that line with parse: (text) -> text.match(/(U|u)ncrustify.{1,3}(\d+\.\d+\.\d)/)[2] but i am not sure it was working on other os or not.

hamar030 avatar Jun 04 '22 21:06 hamar030

If you still need this and are looking for something to fill the spot that Atom left, I am using Pulsar the successor to Atom... This package is working except for one deprecated error listed in #2605

If you don't need this anymore, can you please close this out so it's not just sitting there? Thanksv

SilentGlasses avatar Feb 01 '23 02:02 SilentGlasses

Okay I'll close this as I no longer require the beautifier.

Personal advice, for those still using Atom-beautify and facing this issue better use external beautifier and copy paste the result into Atom to avoid headache.

shira952 avatar Feb 01 '23 02:02 shira952