User forums > Using Code::Blocks

how to change shortcut key of code completion plugin?

(1/2) > >>

hongxing:
how to change shortcut key of code completion plugin?
e.x. to change to F12 or other
thanks!

Urxae:
This is currently not easily done.

I just checked, and the shortcut is hard-coded into the plugin :?. That means the only way to change it is to compile from source after editing the line that says
--- Code: ---m_EditMenu->Append(idMenuCodeComplete, _("Complete code\tCtrl-Space"));
--- End code ---
in codeblocks/src/plugins/codecompletion/codecompletion.cpp (it's in CodeCompletion::BuildMenu) to use your new shortcut setting, in your case changing it to
--- Code: ---m_EditMenu->Append(idMenuCodeComplete, _("Complete code\tF12"));
--- End code ---
should work.

It might have been easier if the codecompletion plugin loaded its menu from an resource file, then you'd just have to edit a .xrc file in ${CODEBLOCKS_DIR}/share/CodeBlocks/codecompletion.zip, which could be done without getting the source and compiling.

IIRC keyboard shortcut editing is planned to be added, but only after version 1.0 is done.

But until someone changes the codecompletion plugin to load the menu from a resource file (Devs: this is a hint ;)) or the keyboard shortcut settings are implemented post-1.0, the above is the only way to do it, I'm afraid.

thomas:
Was going to say the same, Urxae beat me by a few minutes. :)
But I acually tried if it works ;)

Edit: plugins/codecompletion/codecompletion.cpp line 137
Replace the Ctrl-Space part with whatever you think suits you (F12 is indeed a bad choice because that is already taken for collapse/uncollapse, and the event never reaches the menu bar).

Sidenote:
Strangely, that plugin seems to have dependencies with every target, is that deliberate or by accident? Seems unusual that you have to recompile the whole application if you change one line in a plugin.

mandrav:

--- Quote ---Sidenote:
Strangely, that plugin seems to have dependencies with every target, is that deliberate or by accident? Seems unusual that you have to recompile the whole application if you change one line in a plugin.
--- End quote ---

No it doesn't. Something must be wrong with your setup... (I 'm developing this and I edit it a lot; trust me: I would have noticed ;) )

thomas:
Hmm... must be me then.
But since I finally worked out how to do pluggable precompilation with gcc yesterday (i.e. without changing sources), it is not that bad anyway. Have to think of a way to automate that yet...

Navigation

[0] Message Index

[#] Next page

Go to full version