vscode-csharp icon indicating copy to clipboard operation
vscode-csharp copied to clipboard

Suggest correct types when using new keyword

Open icyh4mmer opened this issue 9 years ago • 6 comments

VS Code version: 1.18.1 C# Extension version: 1.13.1

Steps to reproduce

For example, write "int[] intArray = new" and then press control + space, there is no int[] suggested.

Expected behavior

I would expect for "int[]" to pop out first like it does in visual studio.

Actual behavior

Here is an image of current behaviour: image

icyh4mmer avatar Nov 29 '17 19:11 icyh4mmer

I believe int[] is in the list but it isn't selected. Is that correct? Otherwise, this is tracked with https://github.com/OmniSharp/omnisharp-vscode/issues/1765.

DustinCampbell avatar Nov 29 '17 20:11 DustinCampbell

int[] is not in the list. Even if I suggest an int it won't suggest array: image

icyh4mmer avatar Nov 30 '17 09:11 icyh4mmer

Actually, I was incorrect. Visual Studio (and thus VS Code) doesn't show int[] in the list. However, it should preselect int so that you can keep typing. That's the bit that is being tracked by #1765. Is that right @rchande?

DustinCampbell avatar Dec 01 '17 16:12 DustinCampbell

@DustinCampbell Correct. The trigger is wired up, but there's some more work to be done with preselection. Also, there's ongoing discussion with VSCode about whether they want to support a C#-style preselection experience. The only way to do something like preselection right now is to manipulate the sort text of your best item so it gets sorted to the top of the list. There's no support for what we do in VS where the list comes up scrolled to a particular item.

rchande avatar Dec 01 '17 17:12 rchande

@akshita31 The appropriate VS Code API has been implemented for us to support this (https://github.com/Microsoft/vscode/issues/35551#issuecomment-398100658). Let's chat about what we need to do to get this feature working.

rchande avatar Jun 19 '18 18:06 rchande

Cannot reproduce on current release.

JoeRobich avatar Nov 09 '24 00:11 JoeRobich