is there any way how to enable Eclipse to show hints for parameters of C/C++ functions.
When I press Ctrl + Shift + Space it shows only types of parameters but not the names.
And is there also any way Eclipse can show parameter hints automatically when ( is pressed?
Thanks for any advice.
Are you using the CDT plugin? If so which version? The following applies to Eclipse 3.5 (Galileo) with the CDT plugin. If your setup is different then the rest of this answer may not be accurate.
Ctrl + Space brings up the type and names of parameters for me.
Looking through the preferences (Window -> Preferences -> C/C++ -> Editor -> Content Assist ) there's an Auto-Activation panel. There's 3 triggers available, ., :: and ->
Typing this-> and waiting 200ms brings up a list of auto-complete options. This list contains the methods and shows both the type and name of the parameters (if the name is available)
The same applies to foo. where foo is an object and bar-> where bar is a pointer.
If you're talking about when you're implementing a method, then the same applies. Foo:: + Ctrl + Space brings up the list of available items, including methods and shows parameter types and names.
Related
Im having a problem with the code completion drop down suggestion menu when you are writing code in Xcode. It used to be you could type something like:
button.frame = CGRect(
and once your at this point instead of filling in all the arguments manually, the code completion suggestions drop down menu should appear and provide suggestions of auto completion then you simply just click on the one that suits your needs and you end up with something like: (from the example above)
button.frame = CGRect(x: CGFloat, y: CGFloat, width: CGFloat, height: CGFloat)
then all you have to do is simply fill in the parameters. After I updated from Xcode 7.3.1 to the latest version (Xcode 8) for some reason I lost this amazing feature; however, Xcode still shows the code completion suggestions drop down menu but it is not the same, it just contains variables that I have written and attributes that don't even pertain to the object that I am editing.
Further more, Xcode 8.0 for me at least no longer highlights: Attributes, Project Class Names, Project Function and Method Names, Project Constants, Project Type Names, Project Instant Variables and Globals, and a few other types in the source editor. However keywords, strings, and numerical types remain highlighted as before the update.
I have tried monkeying around in the Preferences tab but I can not find options that will fix these frustrating issues. Please help!
It should be just temporary issue:
Clean your build / build folder, reopen Xcode. It ensures your code will be indexed again and this is used to result in quick syntax highlighting and smart suggestion features.
It is because of Indexing....
just go to your project name at the top of navigation and Clean (cmd+shift+k) then come again to the file where you wanna work type any word you will see suggestion popUp. that it..
I have some long C & C++ header files with a lot of nested #if statements in them.
#if FOO
...
#elif BLAR
#ifndef WIDGET
#endif
#else
...
#end
Is there a way to jump between matching statements in Eclipse? I have found a similar question that says it is possible in Visual Studio which suggests that the CTRL + ] key combination should do it, but that seems to only work for matching braces.
No, there is not a way. However, this bug report submitted in 2007 requests this feature: https://bugs.eclipse.org/bugs/show_bug.cgi?id=182579.
If you want this feature, go there and vote on it to raise this request's importance and give it more priority. You might also leave a comment.
Until this feature is added, a super lousy sort of work-around, as you suggested, is to use the "Find/Replace" dialog and "Find Next"/"Find Previous" shortcut keys, searching for the # character.
Steps:
Ctrl + F then enter # in the "Find" box. Press the "Find" button. This will jump to the next # character it finds. With the # character now cached in the Find/Replace dialog, you may close the "Find/Replace" dialog box and use the shortcut keys if you like:
Ctrl + K = "Find Next"
Ctrl + Shift + K = "Find Previous"
You may optionally change these keys via the settings under Window --> Preferences --> General --> Keys (source).
You may use CTRL+Shift+L to see the "Show Key Assist" List of shortcuts (depending on the context), as explained by this answer here. Continue pressing CTRL+Shift+L a couple more times to automatically open up the Window --> Preferences --> General --> Keys settings window.
Tested in Eclipse IDE for C/C++ Developers v4.7.3a in Ubuntu 14.04.
Please vote on the Eclipse feature request "bug" above to get the developers to add in a proper solution.
It seem that with the cursor on a #statment Ctrl+k will move down the file to a matching statement while Ctrl+K will move in reverse.
While writing this up I came across a Visual Studio 2010 question: How to jump to matching #if/#elif/#endif statements? This question states that Ctrl K / Ctrl J will do what I want in Visual C++ 6.0.
As shown above, the Eclipse specific key command also uses k.
I also found that Ctrl+L brings up a a list of keyboard shortcuts and lists the Ctrl+k as Find Next and the Ctrl+K as Find Previous. Pressing Ctrl+L a second time takes you to the Preferences > Keys menu where it is possible to add new combinations.
My preferred tabbing structure for classes in C++ doesn't match Visual Studio's (2013), and I always have to manually correct it. For example, my structure is as follows:
class CExample
{
public:
CExample();
~CExample();
};
When I type this in, Visual Studio auto-corrects it to this:
class CExample
{
public:
CExample();
~CExample();
};
Note that it pulls back "public" and everything else by a full tab. I don't like this, so I have to go and manually re-indent everything. Then, if I copy and paste this class somewhere else, it re-introduces the default tabbing and I have to manually fix it again.
I don't want to turn off all auto-correction or auto-formatting - it's just this specific case (tab formatting of classes) that I want to change (and ideally "fix," rather than just disable).
Is there a template or something I can adjust, so that Visual Studio uses my "style" in this case, rather than its own?
Thanks.
One alternative I suggest is to simply highlight everything and hit tab.
This will indent the whole chunk of code instead of replacing it with a tab.
You can use the same method to "unindent" a chunk of code with shift tab
You can change the indentations of the access specifiers, but there doesn't seem to be an option for the lines after them.
Tools -> Options -> Text Editor -> C/C++ -> Formatting -> Indentation -> Indent access specifiers
So when I used to program in java I did it in Eclipse. Whenever my code had all the same margin I just had to select everything and press Ctrl+i.
Now I use Visual Studio Professional for programming in C++
The question is simple enough: How to properly set a margin to the lines of code so that it all looks well and I can easily tell what code belongs inside what brackets.
Thank you beforehand, and I hope this question is not closed. I tried searching for an answer, but found none.
Select what needs formatting and CTRL+K followed by CTRL+F.
Found in the C++ Visual Studio 2010 Keybinding Poster:
Select the code you want to format then:
CTRL + K, F or
CTRL + E, F
Formats the current selection
according to the indentation and
code formatting settings specified on
the Formatting pane under Tools |
Options | Text Editor | C/C++.
You can always find out what the actual shortcut is and use it or customize it:
go to Tools -> Options.
expand Environment, select Keyboard
type 'Format' in the textbox labeled 'Show command containing:'
find the row that reads 'Edit.FormatDocument'
read the value in the 'Shortcuts for selected command:' dropdown
If you want to change it, use a new shortcut key in the 'Press shortcut keys' box, then click 'Assign'.
Is there a way to align the written C++ code in VS 2010? I want after selecting a block of code to apply a combination of button press and the code to be aligned as in Eclipse or Netbeans with Java.
Look at Edit -> Advanced -> Format Selection
The keyboard shortcut depends on your settings. It's Ctrl+K+F for me. (Under Options -> Environment -> Keyboard enter Edit.FormatSelection into the field labeled Show commands containing to add your own shortcut.)
for code block : ctrl +E,F (Edit -> Advanced -> Format Selections)
for document : ctrl +E,D (Edit -> Advanced -> Format Document)
Try using Ctrl+K+F on the selected text.
Is Ctrl + E, D what you're after?