Source: Scenario 1 at https://developercommunity.visualstudio.com/content/problem/465732/vs-2019-preview-3-intellisense-auto-selecting-para.html
Writing code to call a function using identifiers that don鈥檛 exist yet.
class Program
{
static void Main ( string[] args )
{
var mySvc = new MyService(10, otherSvc, $$);
}
}
class MyService
{
public MyService (int id, OtherService otherService, string name)
{
}
}
class OtherService
{
}
In this scenario I鈥檝e just put the comma in the call to new MyService in Main. I now enter a variable name name that doesn鈥檛 exist yet. As soon as you hit space or a dot (because this is an object) then IS autocompletes to the name: parameter name. This isn鈥檛 what I wanted so I have to stop my typing, go back and correct to the variable (I haven鈥檛 defined yet) and then continue typing. In VS 2017 it doesn鈥檛 autocomplete to the parameter name. It does recognize that the parameter name is the best choice, it just doesn鈥檛 auto complete it.
Expected by user
var mySvc = new MyService(10, otherSvc, name);
Actual
var mySvc = new MyService(10, otherSvc, name:);
The behavior is the same with the old completion and the new completion. It seems it is caused by https://github.com/dotnet/roslyn/pull/26764
I actually do not think that the previous behavior was better than the new one. @CyrusNajmabadi , what do you think?
Sorry, i'm confused by your repro. Can you clarify things like: I now enter a variable name name
Do you mean you're entering the characters name? or something else?
Please udpate the OP and let me know when it's done. I want to experiment with the correct repro steps myself once that is done.
Sorry, @CyrusNajmabadi !
Please type "na" and space in $$. The user expects "name" and this happens in VS 15.9. Currently both completions (old and new) add a colon "name:".
"Please type "na" and space in $$. The user expects "name" and this happens in VS 15.9. Currently both completions (old and new) add a colon "name:"."
if the user wanted "name" why did they write na<space> instead of 'name'? Since they're typing the name of something that doesn't exist, i woudl expect them to have to write out the entire name.
Note: i believe this has been the behavior ever since we added named param completion. Could you explain what behavior you woudl want, including for the customer that wants to type na<space> and get name:?
for example, i do this all the time:
canc<space>
I know that this will select and insert cancellationToken: so that i can then continue from there. If you change this behavior you will badly break my muscle memory here.
"Please type "na" and space in $$. The user expects "name" and this happens in VS 15.9. Currently both completions (old and new) add a colon "name:"."
if the user wanted "name" why did they write
na<space>instead of 'name'? Since they're typing the name of something that doesn't exist, i woudl expect them to have to write out the entire name.
Thank you, @CyrusNajmabadi !
name:name with typing na<space>. This is the complain.: was intentional. If so, we will just resolve the issue.3\. I just would like to confirm with you that adding `:` was intentional. If so, we will just resolve the issue.
I believe so. But we should check. IIRC, we've had this behavior since forever. However, if we haven't we should try to preserve whatever we've been doing since like VS2010 onwards.
@CyrusNajmabadi , sorry! I'm not sure I understand you. There is a change between 15.9 and 16.0.
Here is 15.9:

Here is 16.0:

I typed name<space> in both cases. Sorry - not na<space> and I got different results.
I think this change is intentional and correct.
Do you agree?
@ivanbasov The colon should not be completed for these entries unless the commit character is :.
@ivanbasov The colon should not be completed for these entries unless the commit character is
:.
@sharwell , why? VS does not know about the variable you may going to add in the future. However, it knows that there is a parameter with the corresponding name. Why should not it suggest the whole name: by typing space or Tab? I would not consider it as a regression but as an improvement. Not?
I have been hitting this frequently while trying to work in 16.0, where it inserts a : but the item I wanted was the name without the :. It worked great in 15.x.
See #32204
Yeah sorry for any previous confusion. My overall position is: don't change behavior here. We're already taking on a huge change just having a new completion infrastructure. let's try to keep behavior as consistent as possible. In the future, if we strongly feel like it's worthwhile, we can take targetted behavior changes if appropriate. But that should happen once all of completion has stabilized again.
I still hit this all the time.
Design review conclusion: To avoid muscle memory regressions, async completion in 16.x should be following the same behavior that 15.9 and earlier did for this scenario.
reported at DC
Most helpful comment
I still hit this all the time.