Author Topic: `Goto declaration` hotkey not working  (Read 4639 times)

Offline sgi05431

  • Single posting newcomer
  • *
  • Posts: 3
`Goto declaration` hotkey not working
« on: March 21, 2018, 01:58:48 pm »
The `Goto declaration` hotkey is not working on my system, specifically, nothing happens. Caliing the functionality via menu works.

As an example, I:

1. open the file https://github.com/mysql/mysql-server/blob/mysql-5.0.96/sql/sql_show.cc
2. go to line 1431 (`protocol->prepare_for_resend();`)
3. move the cursor to the `protocol` token
4. press "Ctrl+Shirt+." ()
5. nothing happens

In contrast, if I do 4. via menu (Search -> Goto declaration), it sends me to the declaration.

My system is a XUbuntu 16.04 x86-64. The CB build is from ppa:pasgui/ppa.

Thanks!

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: `Goto declaration` hotkey not working
« Reply #1 on: March 21, 2018, 04:55:05 pm »
You need a project for this to work. You can create one using cmake -G "Codeblocks - Ninja" or something similar.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline sgi05431

  • Single posting newcomer
  • *
  • Posts: 3
Re: `Goto declaration` hotkey not working
« Reply #2 on: March 21, 2018, 05:16:40 pm »
To clarify, with "for this work" you mean:

- for the hotkey to work
- or for the "go to declaration" functionality to work?

The "go to declaration" functionality does work - the problem is just the hotkey.

(I don't have the test machine right now).

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: `Goto declaration` hotkey not working
« Reply #3 on: March 21, 2018, 07:13:08 pm »
I doubt it is just the hot key.
Pressing the hotkey is the same as pressing the menu item in the main menu.
If this works then the hotkey should work.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline sgi05431

  • Single posting newcomer
  • *
  • Posts: 3
Re: `Goto declaration` hotkey not working
« Reply #4 on: March 21, 2018, 07:41:38 pm »
Have you actually tried? The hotkey not working, at least on my machine, is the whole point of this post.

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: `Goto declaration` hotkey not working
« Reply #5 on: March 21, 2018, 08:02:34 pm »
maybe an other manifestation of the F2 bug?

[Edit:] i have no default hotkey for this menu entry.
and if i add the short cut ctrl+shift+.  everything works
« Last Edit: March 21, 2018, 08:09:31 pm by BlueHazzard »

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2750
Re: `Goto declaration` hotkey not working
« Reply #6 on: March 21, 2018, 08:16:38 pm »
It might be because your file has an extension of .cc
Does anyone know if the parser even looks at file extension of ".cc" ?

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: `Goto declaration` hotkey not working
« Reply #7 on: March 21, 2018, 09:40:50 pm »
Have you actually tried? The hotkey not working, at least on my machine, is the whole point of this post.
Yes, I use them (Ctrl+. and Ctrl+Shift+.) all day long and they work perfectly fine.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline pmlonline

  • Single posting newcomer
  • *
  • Posts: 7
Re: `Goto declaration` hotkey not working
« Reply #8 on: November 30, 2018, 07:42:27 pm »
I have a fix for this bug on the Lubuntu, which I hope will also work on Ubuntu. Should I post here or create a new thread? BTW this is not a bug in Windows.

Edit the file codeblocks-17.12/src/plugins/codecompletion/codecompletion.cpp

Goto line 680 and change Ctrl-Shift-. to something else (e.g., Alt-Ctrl-Shift-.) because it's a key duplicate to "Goto declaration" I set it to Ctrl-. and then changed "Goto implementation" to F8.

For some reason on my OS, Lubuntu 18.10, nothing works that's assigned to Ctrl-Shift-. Perhaps OS related? I disabled all of the shortcut keys in Lubuntu that I'm aware of by going into Preferences -> LXQt settings -> Shortcut keys. So on line 677 change from Ctrl-Shift-.  to something else. I changed it a single key press F7 because I use it a lot.

On line 678 I change Ctrl-.  to F8 but you can change it to whatever you like or leave it as Ctrl-.

Next you need recompile the source code:

While in the directory codeblocks-17.12 type make

Then type sudo make install




For anyone who would like to compile the source code, here's everything I did. Please note there might be a few lines that do nothing. Sorry I haven't taken the time to strip out the lines that do nothing. I was just in hurry to install the required libraries and stuff, so I think there are a few times I typed the wrong name, but it's not a problem. Apt-get install will simply tell you there's no such thing. If you find out which steps do nothing, then please let me know.

How to make/compile CodeBlocks IDE 17.12:

Download codeblocks_17.12.tar.xz into your Downloads directory.
Type the following lines

tar xvf codeblocks_17.12.tar.xz codeblocks-17.12/
cd codeblocks-17.12/
sudo apt install autoconf
sudo apt-get install build-essential libtool
sudo apt-get install libwxgtk2.8-dev wx-common libgtk2.0-dev
sudo apt-get install apt.cache
sudo apt-get install wx2.8-headers libwxgtk2.8-0 libwxgtk2.8-dev
sudo apt-get install wxWidgets
sudo apt-get install libwxgtk2.8-dev
sudo apt install libwxbase3.0-dev
sudo apt install libwxgtk3.0-dev
sudo apt install libwxgtk3.0-gtk3-dev
wx-config --version
cd Downloads/codeblocks-17.12/
sudo apt-get install gtk2.0
autoreconf -fi
./configure
make
sudo make install
sudo ldconfig




To start codeblocks and have the ability to set breakpoints and debug I created a file called cb in my home directory ~. Here’s how to create the file in your home direction.

cd ~

nano cb

While inside the file cb type:
codeblocks admin:///root/

Make cb an executable:
chmod +x cb

Type the following in your home directory to start codeblocks:
./cb


I hope this helps someone.