Autocomplete suggestions in Visual Studio 2017 appear after typing only 1 character. For example if you type the letter 'i' a window instantly appears with the list of variables and keywords that start with that character. This becomes quite annoying if you have single letter variables like 'i', 'j', 'a', 'b', etc.
Is there a way to make the suggestions appear after not 1, but 3 (or any other number) of characters typed?
I have searched the options but with no luck and whatever I type in Google doesn't seem to give me what i need. For reference, Notepad++ has this option in "Preferences -> Auto-Completion -> Enable auto-completion on each input -> from n-th character"
No, there is no way to do that.
Perhaps this is a timely reminder that you should minimise your use of such non-descriptive variable names. Since you have auto-complete, it's not even a typing chore to use more letters.
Related
I use visual studio with C++. When typing a word, visual studio makes suggestions, as expected, but does not always highlight them. Here is what I mean:
I type "stri", and "string" gets highlighted, and this allows me to press enter and complete the word.
Then, if I erase only part of the statement, it no longer highlights string,
And finally, most importantly, if I want to use that string elsewhere, it does not highlight the name.
In the example you can see that pressing enter goes to a new line instead of completing the word. Pressing tab would work, however it still doesn't highlight the word, which I don't like, and also I am used to pressing enter, so I would prefer not to press tab.
Working solution:
Go to Tools > Options > Text Editor > C/C++ > Advanced. Then find Member List Commit Aggressive. Set this to true.
Then optionally find Member List Commit Characters and remove all the characters except the colon character.
This solution is almost perfect and it will work for anyone who wants to do the same thing as me.
Straight to the point. I've been using visual studio to run a game I've been making. So far while coding in C++ I've been using inputs like VK_BACK or 0x52 for single key inputs. But I currently need to be able to type a word while the game is running to trigger a function. Basically, I'm asking how you would go about making the program recognize an inputted word. Like pressing the keys in a sequence to trigger a function.
Thanks, Jack
You've left a lot up to us to guess:
What are you using to read keyboard input?
I assume you're polling rather than streaming?
I'm also assuming non-blocking input?
With so many unknowns it's difficult to give a useful answer to the question. But here are a handful of options that may be helpful to you:
Require a terminating character for all keyboard input. This is characteristic of blocking input. The input is only read when the terminating character is placed.
Require the holding of a mode key while inputting a string. For example if I press an 'a' the key's command is executed immediately, but if I'm currently holding down the left Ctrl key and I press an 'a', it is treated as being within a string until the Ctrl key is released.
Use delimiters. If the '\'' is pressed it denoted the beginning of a string input consisting of all characters till the next '\'' key is pressed.
Make string entry keys separate from instantaneous input keys. This may be the most convenient solution because it allows instantaneous input in the middle of string input. But it may also be frustrating to the user if the allowable string commands are not clearly defined.
How do I turn off the "spell-checker like" feature in CodeBlocks on windows?
I also just now realized that if I add a "\" (back-slash) to the end of my comment, the next line if code is also commented. Has this always been standard for c++?
Mine was underlining all my comments and strings, too. Turns out when I downloaded codeblocks, the language wasn't set to English. If you look in the bottom right corner of the codeblocks window, there is a little flag. You can right click it and select the correct language. Hope this helps!
Open Code::Blocks.
Go to plugins -> Manage Plugins
Select Spell Checker and disable it.
Has this always been standard for c++?
Well, rather for the C preprocessor (which C++ uses exhaustively). Yes, it's a documented feature: the backslash-newline sequence acts as a line continuation marker (i. e., the backslash "invalidates", escapes the newline, effectively making the preprocessor treat the consecutive lines separated by backslashes as one line).
The falsely underlined words, might be caused by not having a dictionary selected. This is how I fixed it.
Click Settings->Editor->Spell Checker(on left of dialog) then under Language select a dictionary in the drop down.
Is there a way to autoindent or a shortcut to insert a select number of spaces as a tab in the SAS Progam Editor on Unix?
I'm used to using the enhanced editor on PC and this is the only part of the switch that I can't find the answer to.
On the line numbers to the left of the code in the program editor, enter the >># command (replace # with a number) to indent '#' spaces to the right and <<# for shifting to the left. Enter these commands on the starting line and ending line. All rows inclusive between them will shift.
For a single line, ># or <#.
Without trying to start a flame-war... have you and your team considered NOT using the tab key in code? This way code always appears consistent regardless of editor/tab settings. Especially handy when you use a combination of vi/EG/SAS editor/notepad etc... I've worked at places that do this and it works great once you get everyone to agree to it.
When you open up existing code with tabs, just figure out how many spaces the tab is supposed to represent and do a search/replace.
It's still as fast to navigate quickly when you use, ctrl-left/ctrl-right in windows editors (and unix eds if setup that way), or 'w' and 'b' to jump to the next/previous word when using vi.
Cheers
Rob
What's the vi/gvim syntax to replace a pattern with a pattern that includes <ENTER>? I know this is possible but never felt like diving too deep in the documentation to know how to do it.
Something like this:
:s/\(word\)/\1<ENTER>/
But correctly :)
Thanks
Use the "escape" encoding:
:s/\(word\)/\1\r/
See the Vim documentation for pattern whitespace escapes.
:s/\(word\)/\1\r/
Alternatively, use Ctrl+V or Ctrl+Q to quote (escape) the Enter key:
:s/\(word\)\1^QENTER/
Where ^Q is Ctrl+Q and ENTER is the Enter key.
Clarification: Depending on your installation, either ^Q or ^V should work. The quoting character differs on some platforms.
(This has the helpful side-effect of inserting the appropriate end-of-line character for whichever platform you're using, eliminating the CR vs. LF vs. CRLF problem.)
Just for clarification purposes, now that we're talking about carriage return, it should be noted that RETURN and ENTER key are not the same, or it would be more correct to say, they should not be the same.
I haven't used a desktop keyboard for some time now, but the ENTER key is usually the one on the down right side, while the RETURN key is the big one in the middle.
RETURN key is the one that should be used for entering a carriage return, while ENTER key is the one that should be used for entering commands. I remember an old DOS editor EDT, in which RETURN key was for newline and ENTER key was for giving commands. You couldn't give a command with RETURN. I think ENTER also gave ^1 (line feed).
Today that difference is somewhat lost, although I still, now and then, run into an editor that respects it.
2 examples:
One, two and an even more obvious three