bashsupport-pro icon indicating copy to clipboard operation
bashsupport-pro copied to clipboard

variable braces

Open jobace78 opened this issue 1 year ago • 9 comments

Hi,

We're using the variable expansion recommendation from Google (https://google.github.io/styleguide/shellguide.html#variable-expansion, e.g. prefer "${var}" over "$var") and BashSupport Pro does not automatically closes braces, neither manual (after you write the variable name entirely) or automatically (you pick one from list).

Is this intended?

Thanks.

jobace78 avatar May 08 '24 13:05 jobace78

@jobace78 What exactly are you typing? That would help me understand if it's intentional.

Typing ${ is supposed to add the closing } to make it ${} with the caret in between {}. That's controlled by Settings > Editor > General > Smart keys.

Or would you expect that ${myVar} is inserted if you pick $myVar from the completion popup if Google Code style is enabled?

jansorg avatar May 08 '24 13:05 jansorg

Hi,

I'm unable to reproduce within an empty file but within a complex one.

I'm trying something like this:

VAR1="value1"
echo "VAR1 = ${"

When I enter the first brace should insert the paired bracket, but it's not working. I switched to the bundled Shell Script plugin and it works as intended.

Can I post a clip? A picture is worth a thousand words...

jobace78 avatar May 08 '24 14:05 jobace78

Typing ${ should always expand to${} where ${var} is valid. Sure, you can post a clip. This sounds like there may be a parsing error before the location where you're typing, but I should see that in the clip.

jansorg avatar May 08 '24 14:05 jansorg

https://github.com/BashSupport-Pro/bashsupport-pro/assets/1135365/029509b9-a013-459a-a449-80b5edf4c9ad

jobace78 avatar May 08 '24 14:05 jobace78

@jobace78 Thanks! This is supposed to work in both complex and simple, so it seems like a bug.

Is complex showing any syntax errors after enabling Settings > Languages & Framework > BashSupport Pro > Highlight errors in shell scripts? If it does, could you post a screenshot of the error and its context? How many lines does file complex have? Are complex and simple in the same project?

jansorg avatar May 08 '24 14:05 jansorg

Hi,

complex file does not have any errors, only a few warnings ("Missing function comment" to be precise). It's about 1k lines. Both scripts are in the same project.

Hope it helps.

Thanks.

jobace78 avatar May 08 '24 15:05 jobace78

That's a bit weird, because it's all pretty much standard. But I'll try to reproduce and fix this...

jansorg avatar May 08 '24 15:05 jansorg

Okay, I'm able to reproduce this. It's a bug to be fixed for the next update.

jansorg avatar May 08 '24 20:05 jansorg

Okay, I've fixed this for the next update.

jansorg avatar May 11 '24 17:05 jansorg

Version 4.1.1 with a fix is now available.

jansorg avatar May 15 '24 19:05 jansorg