Variable Code Completion in Netbeans without Ctrl+Space - c++

Is it possible to enable auto code completion for variables in Netbeans?
I see a similar question here, but it doesn't work on variables (correct me if I'm wrong).
This is my current code completion setting:

This worked for me:
In NetBeans select Tools -> Options -> Editor -> Code Completion tab -> Language: C/C++
As given in this SO answer, set the content of the Auto Popup Triggers... field to contain the following string:
.;->;.;->;::;new ; ;a;b;c;d;e;f;g;h;i;j;k;l;m;n;o;p;q;r;s;t;u;v;w;x;y;z;
Click the Apply button, then click OK.
Here's a screenshot:
The change should be immediately effective. After doing that you can type the first letter of any variable in your C++ source code and eligible variables should be listed in the prompt which automatically appears.
The screen shot below is a contrived example where there are several variables starting with 's'. All I did was type the letter 's' and the prompt appeared instantly, listing all of the local and global variables starting with 's':

Related

Intellisense autocompletion of expressions to watch in watch window or debug console

Is it possible while debugging, and a breakpoint has been hit, to autocomplete variables in the current scope in the Debug Console or the Watch Window?
An example gif is attached of where I would hope to get some auto-completion suggestions.
Essentially, on typing just long, I would like to autocomplete to work here so that it suggests longish_variable_name that I can then possibly tab complete.
VSCode has, by default, CtrlSpace mapped to triggering autocompletion suggestions, but this only seems to work in the editor window.
Use the variable once in the debug window, and auto-complete will do the rest of the work for you ever after (given the variable name shouldn't be changed, or you need to use it in the debugger console again to get auto-completion suggestion.)
I have a test variable named very_very_long_var — but the debug window didn't suggest anything on the first go. It was presented once I used it the first time in that window.

How to fix "The parser is still parsing files" popup in codeblocks

So I have not changed any settings in my code blocks editor and yet this appears I am new to the code blocks editor and if anyone could explain how this could popup so I can fix it and I have heard people will disable code completion to fix this but I never had the problem with it on so
I have tried disabling code completion this did fix the problem but it normally wouldn't do this with code completion on and I don't want it off
Open Code Blocks settings screen
Click "Editor..."
On the left, choose "Code compliation"
Choose "C/C++ Parser"
Make sure the checkmark on "Use one parser for the whole workspace" is checked
Then after saving the changes restart your Code Blocks IDE and make project save it. After that your issue is resolved.
None of the solutions mentioned above helped me!
I found myself solution, try whether it works for you not!
settings -> Editor -> scroll down (left options) -> Code Completion -> C/C++ parser -> Use one parser per project Check this option -> Maximum allowed parsers keep it less mine worked when i keep it to 2
It seems that rebooting the program has fixed this problem... Also I uninstalled the Library finder which I had opened once by accident then closed the program not saving and changes to anything which then restored library finder and apparently fixed the issue...
This worked for me:
Create two C/C++ files. Build and run them. Go to the C/C++ file you've built first and try to write something. Now, your issue should be fixed.
There's a youtube video explaining this trick. You can watch this if you face any difficulty: https://www.youtube.com/watch?v=sduqmX_VXB8
It's very simple. Save the file declaring which type it is. If C++, save it as whatever.cpp and it's gonna work.
Your file name should start with lower case alphabet.
We have to simply do one thing i.e. stop the code completion.
Goto "Settings" menu --> "Editor" --> "General Settings" (Left Pallet) --> "Editor settings" tab --> uncheck the "Code completion" checkbox..
Save the setting and you are good to go.. now u will never get that pop-up again..

Seeing only local variables debugging C++ in VSCode

I am using Visual Studio Code and when I debug (I am debugging C++ code compiled with Clang) I see only local variables.
I do not see any global variables list.
How can I see all variables?
In this case I am inside a loop and I see only all the variables defined inside the loop, not the one defined outside.
You will need to manually add global variables to a watch window.
Set a breakpoint
Start debugging (Debug -> Start Debugging or
F5)
Open a Watch window (Debug -> Windows -> Watch -> Watch 1)
Type in the name of the variable manually
In Visual Studio Code you can just go to the Watch pannel int the debug menu and click on + , then type the name of the variable you want to watch.
Hope it helps !
After you follow the stepes in Andrew L's answer you can modify the variable's value by the help of either:
1. Debug Console
2. Address-Of Operator
By prefixing the variable we want to watch with (&) we can now expand it and then right click on the dereferenced variable to set a value.

How do I view variables values in nsight eclipse edition

I'm using nsight eclipse edition, and I cant figure out how to view variables values in debug mode for now (meaning usual variables in host memory, debugging usual c++ code so far).
"Variables" tab does not contain anything useful for me (nothing I can use now at least), and Memory tab, which should be able to display variables by their addresses and also monitor expressions does not work for me either.
Any suggestions?
The following steps seemed to work for me:
open nsight
create a new project, select CUDA C/C++ project, and select CUDA Runtime project
the project will be populated with a simple "bitreverse" code. The initial configuration will be the debug configuration. Select Project...Build Project to build the sample code (debug version).
Now on the right hand side of the toolbar, press the "Debug" button, to switch to the Debug perspective.
on the left of the first CUDA_CHECK_RETURN(...) line of code, right click and select "Toggle Breakpoint" to set a breakpoint at that line of code.
select Run...Debug The program will then be started in debug mode, stopped at the first line of code, and the host variables will be filled in in the upper right hand corner "Variables" pane.
To the left of the idata variable, select the triangle to expand the sub-menu. The submenu is populated with the values of idata at each index. The data will be garbage, as it has not been initialized yet.
Select Run...Resume to continue program execution. Program execution will halted at the breakpoint previously set.
If we inspect the idata variable in the "Variables" pane, we see that the values have been changed (initialized) to 0, 1, 2, ... etc.
If you attempt to debug a project for which you have built the "Release" configuration instead of "Debug" configuration, you will have a variety of issues, and will get a message "no source available" and there will be no variables displayed in the "Variables" pane.
I was using gcc 4.8, which caused problems.
Now I downgraded to gcc 4.6 and it solved problem.
Robert Crovella, thanks for your effort.

How to view contents of an array while debugging in Code Blocks?

This is probably a silly question and i am posting this Post-Googling,
The question is,
How do i view the contents of an array while debugging, Provided the Breakpoint is in function not Main?
I am using code::blocks 13.12 version and i set a break point in my sample simple c++ code,
and i want to observe how the contents of the array change with the code but all i see is the the address of the array under watch window,
It is however displaying the values of other integer variables correctly,
a is an array
I forgot to mention that i am tracking the array in a function and not in main,and i am aware that main passes the address of the array to the function being called(by reference i meant)
I am relatively new to codeblocks, Am i missing some setting or something?
Right click on the cell, then select "Properties", there you can tell it to "watch as array", and tell it the index range to watch.
i am using 12.11. I select the array variable suppose a, choose "watch a" in the right button down menu, and I can see the values in the array a.
Another thing that I use is watching under cursor.
If you go Settings -> Debugger... -> GDB/CDB debugger -> Default and you enable selection "Evaluate expressions under cursor", every time you leave mouse pointer above a variable in the code, it will be watched.
It's not the same with having it in Watches toolbar, but strangely it will show array's fields.
Debug -> Debugging windows -> Watches
you may watch the variables in this way
in convenience, you can find button "Debugging Windows" near to the debug toolbar, choose "watch", hope you can find it!