Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't jump to the function call when ctrl click on a function definition in VSCode Bash IDE plugin #515

Closed
YevheniiPokhvalii opened this issue Sep 13, 2022 · 4 comments
Labels
question Further information is requested

Comments

@YevheniiPokhvalii
Copy link

YevheniiPokhvalii commented Sep 13, 2022

I can jump/go to a function Definition by clicking ctrl+left mouse or f12 on a function call, but it does not seem to work backwards - I can't jump from a function Definition to the function call, like it is implemented, for example, in the built-in plugin Shell Script for IntelliJ IDEA.
Is this a current VSCode Bash IDE plugin/bash-language-server limitation or am I doing something wrong?
I am using the latest version of https://marketplace.visualstudio.com/items?itemName=mads-hartmann.bash-ide-vscode

@YevheniiPokhvalii YevheniiPokhvalii changed the title Can't jump to the function call when ctrl click on a function declaration in VSCode Bash IDE plugin Can't jump to the function call when ctrl click on a function definition in VSCode Bash IDE plugin Sep 13, 2022
@skovhus
Copy link
Collaborator

skovhus commented Nov 28, 2022

I can't really reproduce this. If I check right click on add_a_user and select Go to references it correctly shows the 3 calls.

Let me know if you have a reproducible example.

#!/bin/sh

# Helper function to add a user
add_a_user()
{
  USER=$1
  PASSWORD=$2
  shift; shift;
  # Having shifted twice, the rest is now comments ...
  COMMENTS=$@
  echo "Adding user $USER ..."
  echo useradd -c "$COMMENTS" $USER
  echo passwd $USER $PASSWORD
  echo "Added user $USER ($COMMENTS) with pass $PASSWORD"
}

###
# Main body of script starts here
###
echo "Start of script..."
add_a_user bob letmein Bob Holness the presenter
add_a_user fred badpassword Fred Durst the singer
add_a_user bilko worsepassword Sgt. Bilko the role model
echo "End of script..."

@skovhus skovhus added the question Further information is requested label Nov 28, 2022
@YevheniiPokhvalii
Copy link
Author

YevheniiPokhvalii commented Nov 29, 2022

I can't really reproduce this. If I check right click on add_a_user and select Go to references it correctly shows the 3 calls.

Let me know if you have a reproducible example.

#!/bin/sh

# Helper function to add a user
add_a_user()
{
  USER=$1
  PASSWORD=$2
  shift; shift;
  # Having shifted twice, the rest is now comments ...
  COMMENTS=$@
  echo "Adding user $USER ..."
  echo useradd -c "$COMMENTS" $USER
  echo passwd $USER $PASSWORD
  echo "Added user $USER ($COMMENTS) with pass $PASSWORD"
}

###
# Main body of script starts here
###
echo "Start of script..."
add_a_user bob letmein Bob Holness the presenter
add_a_user fred badpassword Fred Durst the singer
add_a_user bilko worsepassword Sgt. Bilko the role model
echo "End of script..."

I mean click on add_a_user on the add_a_user bob letmein Bob Holness the presenter line. It won't send you back to the add_a_user() function.

P.S. I don't know what happened, but I tired to reinstall the plugin and it worked both ways.
But I found an example, where variable reference does not work (it is a small part of the script but still you can get the image - click between two delete_test_ns . One reference will work, and the other won't.):

#!/bin/sh

if_delete_ns() {
    read -r answer
    if [ "$answer" != "${answer#[Yy]}" ]; then
        delete_test_ns=true
    else
        echo "Skipped. Deleting custom resources only..."
    fi
}

if [ "${delete_test_ns}" = true ]; then
    delete_ns
fi

skovhus added a commit that referenced this issue Jan 2, 2023
skovhus added a commit that referenced this issue Jan 2, 2023
@skovhus
Copy link
Collaborator

skovhus commented Jan 2, 2023

A much better heuristic for symbol resolution has been released as [email protected] and for vscode in the latest extension 1.24.0. It opens up for implementing renaming of symbols, and I also believe this solves the issue here.

Please let me know if it works for you or if you have any feedback to the new version.

@skovhus skovhus closed this as completed Jan 2, 2023
@YevheniiPokhvalii
Copy link
Author

Thanks! Seems to be working now.

domnewkirk added a commit to domnewkirk/bash-language-server that referenced this issue Jul 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants