Error executing shfmt

Greetings, new user here.

I’m seeing this error when I attempt for format my shell script:

Error executing shfmt: BashSupport Pro
C:\Users…file.sh:39:27:
&& must be followed by a word

I don’t know what to do with the info or how to fix the problem that my code is not being formatted.
I’m guessing it’s a config issue because it did work when I first installed the plugin.

Any suggestions?

I’m using
IntelliJ 2020.1.3 (Ultimate Edition)
BashSupport Pro 1.4.9.201

Hi @forestplay, thanks for reporting!
The latest update added the display of shfmt error messages. Before it wasn’t clear why or when formatting failed.
But it seems like this is a bit confusing. I’ll take a look to show this less often or to add a setting to control this.

The message says, that line 27 of that file has a && somewhere, which isn’t followed by a command. Can you tell if that’s actually the case?
Did this happen after an action like rename or a quickfix or is this shown again when you call Code > Reformat file?

Thanks,
Joachim

Here’s the line in question:

[[ (! $MatchLine && (($InvertPrint && ! $line =~ $regex) || (! $InvertPrint && $line =~ $regex)))
|| ($MatchLine && (($InvertPrint && $line != “$regex”) || (! $InvertPrint && $line == “$regex”))) ]]

In the file it’s actually two lines for readability, split as shown.

Hi, thanks for the details, that helps to debug this.
The next update (out later this week) will fix this issue. I’m tracking this at https://github.com/BashSupport-Pro/bashsupport-pro/issues/29.

The shfmt formatter had a bug which prevented the formatting of test expressions. The update will ship with a fixed version of shfmt as the fix was already fixed upstream.

The update will have a new setting to control the notifications (no messages by default until I’m sure it’s not showing way too often).

I’ve published an update (Version 1.4.10) which ships the fixed shfmt formatter and adds the setting to control the notifications.
Please let me know in case this isn’t working for you as it should.

Regards,
Joachim

It appears to be working with the new plugin. Thanks!

Is this your preferred way for me to report issues? I have another, unrelated thing that may be an issue. Start another thread? Send you a direct message? Let me know.

Thanks for confirming!
If you’re sure that it’s a bug, then reporting at https://github.com/BashSupport-Pro/bashsupport-pro/issues is best. If you’re not sure what it is or would like to have a discussion, then just create a new topic here. But either way is fine.