Visual Studio 2015: C++ IntelliSense suggestion not committed when pressing space - c++

What I want from VS2015's autocomplete when coding C++ is that when I start typing the name of a variable, it automatically suggests that variable and when I press space, it commits it (which is the default behavior for C#).
I first had to find out how to make sure the suggestion was actually selected, which I found here: https://stackoverflow.com/a/20342224/2471262.
Sadly, this doesn't fully do what I want it to. When pressing enter, it now automatically commits the variable name. However, this doesn't work for space. When first pressing ctrl+space and then typing part of the variable name, space bar actually works to commit the variable name. So basically this is the result:
Suppose we have a var named abcd.
<ctrl+space>ab<enter> => abcd // First two works without changing Member
<ctrl+space>ab<space> => abcd // List Commit Aggressive from False to True
ab<enter> => abcd // Works with Member List Commit Aggressive set to True
ab<space> => ab // This somehow does not work :(
Does anyone know a solution to get the final option to work? Or is this just a bug in VS? It's really annoying not to have it working, since I'm used to it from C#.

Related

Member List / Auto Correct in Visual Studio 2019 C++ strange default behavior

The following 'Auto Correct' issue occurs when typing e.g. std::cout <<.
After typing std::cout and a space this automatically gets corrected to std::count, which is the best match in the list.
I cannot find any setting to disable this 'feature'.
Update: Researching further, I find
Text Editor->C/C++->Advanced->Intellisense->Member List Filter Mode is the relevant setting. Default is "Fuzzy" and this makes count a match for cout. Setting to "Smart" removes this match.
Still I wonder why pressing Space "commits the member list". There are settings for chars which commit, but Space is not mentioned. I would be fine with Tab, but if I just type things (with spaces) I don't want any messing about.
I like the "fuzzy" matching in principle to get an overview, but I hate the auto-commit.
The relevant setting is this one found in Tools->Options->Text Editor->C/C++->Advanced->Intellisense
very aptly named - as per usual! The funny part is that the 'Aggressive Member List' is way less aggressive wrt. auto-correcting
Setting this to True leads to the desired effect:
Only Tab 'commits', i.e. inserts the (possibly inadvertently) selected member. Typing is not affected otherwise!
link of interest: https://developercommunity.visualstudio.com/idea/415157/not-possible-to-disable-c-autocomplete.html

Why doesn't my if-then statement in Scratch ever trigger?

I have been using Scratch for a few months, but am suddenly completely and inexplicably stuck.
I can't get a simple if-then condition to trigger.
After stripping down to the bare essentials, I have this:
the variable d successfully changes when I press space, but never triggers the if-then, even when d=5, as confirmed by the display.
What am I missing?
You need to add the variable to the expression, like this (Notice the orange color of d, drag it from the section "Variables"):

How to filter out shortcut from translations

In QT I have an item named tr("&Output") (where the & indicates a short-cut).
Now I want to use the same text without the shortcut - i.e. just "Output" translated to what-ever language, and I could not find this in the documentation.
Added: The reason for doing this is to tell the user to select a menu entry in this case "Output". So if the translation gets out of sync we might have a menu entry "Ausgabe" and telling the user to press "Ausgang", which isn't good. It could be that there is a completely different way of resolving this.
Obviously I can do tr("Output") - but that creates the need for additional translation, and the risk that they are inconsistent.
I can also do tr("&Output").replace("&", "") - but it seems like a hack. (And would need additional code to handle actual "&" in the text.)
I assume Qt has some internal mechanism for this, but is there a standardized way of accessing it?

What is the best way to indicate that a substitution needs a confirmation dialogue?

I often invoke functions from my menu
Many have double entries:
- one for normal substitution
- one for subsitution with confirmation dialog (gc)
p.e.:
vnoreme 20.900 &Edit.Delete\ All\ but\ 1st\ Doubles\ :<C-U>call <SID>DeleteD("'<,'>","confirm-no")<CR>
vnoreme 20.901 &Edit.Delete\ All\ but\ 1st\ Doubles\ (gc)\ :<C-U>call <SID>DeleteD("'<,'>","confirm-yes")<CR>
Is there no better way then the one I use above to indicate a confirmation dialog?
(and to avoid all these double entries)
P.e. when a function invokes an inputdialog box, I would like to have a checkbox added where I can indicate (checking it) to add a dialog confirmation after every substitution, but unfortunately they don't exist and there is no way (as in autohotkey) to create an inputdialog GUI myself.
Well, you could change your Delete() function to ask you, whether you'd like to have each substitution being confirmed. Something like this:
fu! Delete(range)
let confirm = confirm("confirm each change?", "&yes\n&no", 1)
let cmd=printf("%ss/foobar/foobaz/g%s", a:range, confirm ? 'c' : '')
exe cmd
endfu
(this is just an example, you probably want to change at least the search and replace criteria)
Or, if you are using a simple substitution, learn to use the :ex command :promptrepl,
e.g. :promptrepl foobar will open a search/replace dialog where the search field will be set to 'foobar' and you only need to enter the replacement part and hit the buttons you like.

Powershell Get-WebVirtualDirectory : Specified cast is not valid

I've narrowed my code down to this-
Function Check-VirtualPhysicalPath{
Param([Parameter(Mandatory=$True)] [AllowEmptyString()][String]$Page)
#This creates an arraylist of items that are our virtual/physical paths
$WebVD= Get-WebVirtualDirectory
}
when I run this script in a function setting the results of 'Get-WebVirtualDirectory' returns a casting error. This has me baffled because when i try to run the line
$WebVD= Get-WebVirtualDirectory
in either a script or merely on the console there are no errors returned and i can access the variable and the data is correct. What am I doing wrong?
Now as a side-note this is merely the problematic code so i'm not including everything, but even when i comment everything else out i end up just running what you see here with problems just the same.
i'm calling the code with this in a separate script
$page = [string]$(gc "C:\page.txt")
. C:\VP.ps1
$(Check-VirtualPhysicalPath($page))
Powershell is reacting like i'm casting the $WebVD variable, I'm not sure if this is a bug or if i'm missing something entirely...
Edit:
it looks like i forgot to pull out that part of the code. I'm code crawling, the point of the hashtable is that i'm storing the number of times a resource is used in a hash table with the key being the file name and the value how many times it has been used so i use regular expressions to determine that. My question is unrelated to my other code because it's having problems even when my code only contains what you see above.