Goto bash function in another .sh file in same directory

Answered

Using the latest version of the bundled Shell Script plugin in the latest IntelliJ 2020.1 EAP, I cannot navigate from a bash function call in one file to the function definition in another .sh file in the same directory.

The project uses Gradle Wrapper 5.5.1, and is available at https://github.com/sdkman/sdkman-cli.

Is there any way I can navigate from the call to the definition using the Shell Script plugin?  If not, can any other plugin, like BashSupport, do this?  If so, will it work out of the box, or must I configure the other plugin?

Thanks.

0
10 comments

"Go to function definition" shortcut has started worked for bash scripts since 2020.1 EAP in the scope of this bug: 

https://youtrack.jetbrains.com/issue/IDEA-222159

You can also use BashSupport which supports this type of navigation. 

0

@Konstantin Annikov

Thanks for the info.  I assume that fix hasn't been released yet.  Is that correct?

If not yet released, will it be released in the next EAP?

If already released, it isn't working for me.

I can goto the definition of a function in the same file, but I cannot goto the definition of a function defined in another file.

0

Seems that fix only affects navigation within one file. I created a new bug request for the case with several files: 

https://youtrack.jetbrains.com/issue/IDEA-234818

Feel free to watch it in order to be notified once it has updates. See this article if you are not familiar with YouTrack.

0

Watching & voted for issue.  Thanks again.

0

If you can, please fix this issue🙏🙏🙏I think Jetbrains IDEs all miss this feature till now. For shell scripts, I still can just navigate between functions in one file but can't navigate between multiple files. It's just very inconvenient. So Please🙏...thanks! 

0

Olivb Sh
This issue was fixed from IntelliJ version 2022.1.
I just tested it quickly in the latest release 2023.1.2, and it is working as expected:

 

Which version are you using? 
If not already, you can download the latest one from: https://www.jetbrains.com/idea/download 

1

Ivan Pajic

Hey, I'm using PyCharm 2023.1 (Professional Edition), so in IDEA does this function rely on some plugins? Please tell me, thanks~

0

Olivb Sh
Yes, it relies on the Shell Script plugin. This plugin is bundled, so it should be installed and enabled by default. You can check it in Settings (`⌘ + ,` or `Ctrl + Alt + S`) > Plugins > Installed > type 'shell' in search field.

As a general troubleshooting step, you can try File > Invalidate Caches.. > enable Clear file system cache and Local History option > Invalidate and Restart. Additionally, you can try to temporarily disable all third-party plugins, as sometimes third-party plugins can conflict with native IDE functionality.

If the issue still persists, it is best to open a new issue at: https://youtrack.jetbrains.com/newIssue?project=IDEA, and provide additional diagnostic information like screenshots/screencast showing the problem and your IDE logs (Help > Collect Logs and Diagnostic Data).

0

Hi, as of 2026, this still seems to be incomplete / not fully resoved.

With Shell Script enabled, navigation to functions is unreliable. Some functions can be resolved, others cannot. Invalidating caches etc, does not change anything. The behaviour is consistent though, meaning it is always the same functions that work / do not work.

The only workaround I've found so far is deleting and re-adding entire functions, which seems to trigger some undocumented indexing in intelliJ.
If anyone else has more insight on this, I'd appreciate.

0

Hi Maximilian Schiedermeier
Thanks for your feedback.

Could you please create a new issue (using this link) with a detailed description of your scenario and the steps to reproduce this problem?
Also, please provide IDE logs collected via Help | Collect Logs and Diagnostic Data and screenshots demonstrating the described behavior.

We will investigate it in more detail personally.
Thank you!

1

Please sign in to leave a comment.