dotnet / vscode-csharp

Official C# support for Visual Studio Code
MIT License
2.87k stars 676 forks source link

Go to Implementation should show a list of methods when multiple ones implementing it, so I can select which one to go to #1331

Closed cateyes99 closed 7 years ago

cateyes99 commented 7 years ago

Environment data

dotnet --info output:

.NET Command Line Tools (1.0.1)

Product Information:
 Version:            1.0.1
 Commit SHA-1 hash:  005db40cd1

Runtime Environment:
 OS Name:     Mac OS X
 OS Version:  10.11
 OS Platform: Darwin
 RID:         osx.10.11-x64
 Base Path:   /usr/local/share/dotnet/sdk/1.0.1

VS Code version: 1.10.2 C# Extension version: 1.8.0

Steps to reproduce

  1. Create an interface IA
  2. Create more than one classes which implement interface IA, for example CA and CB
  3. Place cursor on one of the IA's method, use Go to Implementation command to go to the implementations of it.

Expected behavior

Should show a list of those concrete methods of CA & CB which implement IA, let me to select one of them to go to.

Actual behavior

It just jumps directly to one of those implementations of the interface, without giving me a list of the different implementations to select which one to go to.

I actually observed that the first time it just jumped directly to CA, and afterward times it always jumped directly to CB (I don't know why the first time it jumped to CA though)

cateyes99 commented 7 years ago

No one think the feature to give list of the implementations is essential?

DustinCampbell commented 7 years ago

Sorry, I'd meant to mark this for our backlog. This also applies to Go to Definition, which should a list of options for partial types.

cateyes99 commented 7 years ago

@DustinCampbell With version 1.11.0, when i press the shortcut of Go to Implementation F12, now it will pop up a window and open one implementation of the interface and shows a list of the implementations in the right hand side. So it gives the feature, nice!

But if I open the Command Palette by pressing P or F1, then type and select the Go to Implementation command, it just takes me to one of its implementations without popping up that window so no option to select a implementation. why the shortcut works but selecting the same command doesn't? They behaviour differently though they r the same command eh?

DustinCampbell commented 7 years ago

@cateyes99: We haven't made any changes here. Any changes to this feature have likely come from VS Code itself.

cateyes99 commented 7 years ago

@DustinCampbell right, i did downgrade C# extension to 1.10.0 in VS Code 1.13.1, and it works the same way. This is interesting to me, VS Code now can at least recognise these implementations. Does this mean VS Code has some communication with the C# extension in terms of this info?

DustinCampbell commented 7 years ago

C# for VS Code always returns a list of implementations. If VS Code now has a better experience in the case that multiple implementations are provided, excellent!

cateyes99 commented 7 years ago

ic, thanks.

So but somehow VS Code doesn't have consistent behaviuor for the two approaches ( through shortcut and through Command Pallete) i mentioned above.

DustinCampbell commented 7 years ago

I'll take a look when I have a moment, but that'd likely be a VS Code issue.

cateyes99 commented 7 years ago

@DustinCampbell thx

rchande commented 7 years ago

I think this is a bug in the implementation of the command palette. It is sending "enter" to the vs code editor after you use "enter" to invoke the command. Filed https://github.com/Microsoft/vscode/issues/35759. @DustinCampbell I think we can close this.

DustinCampbell commented 7 years ago

Thanks for the investigation @rchande. That sounds right. Closing this one.