bashsupport-pro
bashsupport-pro copied to clipboard
Bash shell parameter expansion ${PARAMETER^} seen as an error.
${PARAMETER^} is a legitimate, documented Bash shell expansion that up-cases the first letter of the value of PARAMETER. This shows as an error under version 3.3.0.232 of BashSupport Pro under PyCharm 2023.2.1 (Professional Edition) running on Ubuntu Linux 22.04 LTS (amd64 on Dell laptop).
When I use this expansion, the error presented under the 'Problems' tab is:
PARAM_EXP_EXCL expected, got '}'
I note that when I closed the project and reopened it, this error was no longer reported. Anecdotally, it seems to me that a number of different "weird errors" that I have seen disappear when I do this. Something gets in a strange state and that state is cleared on exit?
${PARAMETER^} is supported by the parser. A script like this is parsing without errors:
#!/usr/bin/env bash
echo "${USER^}"
foo() {
echo "${USER^}"
}
It's possible that the context of your ${PARAMETER^} is breaking the parser at that particular location. That would also explain the other errors you were seeing.
There's incremental parsing, e.g. when you're editing inside a function body, then only the body is reparsed. If that part contains a bug, then error markers would go away when you force a full reparse by reopening a project.
When you see such errors again, could you please post either the script itself of (if that's not possible) a screenshot of the context around the error markers? Thanks!