Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Suggestion: Go to implementation #10806

Closed
RoarkeRandall opened this issue Aug 22, 2016 · 15 comments · Fixed by #18346
Closed

Feature Suggestion: Go to implementation #10806

RoarkeRandall opened this issue Aug 22, 2016 · 15 comments · Fixed by #18346
Assignees
Labels
api feature-request Request for new features or functionality

Comments

@RoarkeRandall
Copy link

  • VSCode Version: 1.4.0
  • OS Version: OS X 10.11.6

Steps to Reproduce:

  1. Press f12 on a function that is an interface type.
  2. Editor will go to declaration of the function on the interface, rather than the implementation (as expected).

In Visual Studio (with resharper) this is a nice feature.

@sandy081 sandy081 added the feature-request Request for new features or functionality label Aug 23, 2016
@jrieken jrieken added the api label Aug 23, 2016
@dvlsg
Copy link

dvlsg commented Aug 24, 2016

This is actually available in Visual Studio 2015 Update 1 without resharper. I believe a default shortcut of Ctrl+F12 was added in Update 2.

@Tyriar
Copy link
Member

Tyriar commented Oct 17, 2016

This would be really handy to navigate vscode's source faster, currently I have to use view references and navigate to the implementation in the peek view.

@kkovalevskiy
Copy link

As I can see, tsserver has added support of this feature on their side (microsoft/TypeScript#10482), so why we still don't have it in vs code?

@Tyriar Tyriar added typescript Typescript support issues and removed api labels Dec 15, 2016
@Tyriar Tyriar assigned mjbvz and unassigned jrieken Dec 15, 2016
@Tyriar
Copy link
Member

Tyriar commented Dec 15, 2016

Thanks for pointing this out @kkovalevskiy! I've reassigned this and am very excited about the possibility of being able to use it soon 😉

mjbvz added a commit to mjbvz/vscode that referenced this issue Dec 16, 2016
For microsoft#10806

Initial prototype of using the TypeScript Go To Implementation Feature. Adds a go to implementation command for js and ts documents.

This has a few issues at the moment:
* We likely would want to expose `go to implementation` functionality for other languages. Therefore, it would make sense to standardize an api for this base on the existing DefinitionProvider api.
* The location values that typescript returns are not correct some of the time. I'll double check that this is not a bug on our side, but the feature may need some more polish before we can ship it.
@jrieken jrieken assigned jrieken and unassigned mjbvz Dec 20, 2016
@jrieken jrieken added api and removed typescript Typescript support issues labels Dec 20, 2016
@jrieken
Copy link
Member

jrieken commented Dec 20, 2016

@Tyriar Taking this back because it shouldn't be a TypeScript only solution but implemented in the spirit of other language features, like go to definition, find referenced etc

mjbvz added a commit to mjbvz/vscode that referenced this issue Jan 10, 2017
For microsoft#10806

Adds a new API for supporting  `go to implementation` command for languages. Implements an example for TS
mjbvz added a commit that referenced this issue Jan 12, 2017
* Add Go To Implementation Api

For #10806

Adds a new API for supporting  `go to implementation` command for languages. Implements an example for TS

* Rename

* Cleanup
@Tyriar
Copy link
Member

Tyriar commented Jan 12, 2017

🎆

@jrieken
Copy link
Member

jrieken commented Jan 13, 2017

screen shot 2017-01-13 at 10 35 41

@mjbvz I have reopened this because it takes aways the Find References keyboard shortcut

@jrieken jrieken closed this as completed Jan 13, 2017
@jrieken
Copy link
Member

jrieken commented Jan 13, 2017

Sorry, actually none-sense. I was confused with another extension I have

@unional
Copy link

unional commented Mar 24, 2017

Just tested and it is not working. It still routed to the declaration file.

UPDATE: didn't have time to create a repro yet. I'm trying to [Ctrl+F12] from an import statement of another package and landed on the declaration file.

@FredrikFolkesson
Copy link

I also have problems here, going to declaration on another package works and I get to the d.ts file, but going to implementation I only get "No implementation found"

@mjbvz
Copy link
Collaborator

mjbvz commented Apr 12, 2017

@FredrikFolkesson Please open new issues for any problems related to go to implementation. Include a small project and a list of repo steps so that we can investigate

Thanks

@Wenzil
Copy link

Wenzil commented May 9, 2017

Has a new issue been opened yet? The issue is still occurring.

Edit: I opened #26325

@3x1010
Copy link

3x1010 commented Aug 25, 2017

Sorry if I post here but I'm getting mad about this topic.
I can't stand the fact that visual studio code is not able to jump to the definition in a case like this:

foo = funtion(){
this.init();
}

foo.prototype.init = function(){
// code
}

if I press F12, Alt F12, Ctrl F12, Shift F12, Ctrl F12 or whatever on "this.init()" Visual Studio Code is not able to jump to the foo.prototype.init method.

Where am I wrong? In Visual Studio 2015 this works, also it works on sublime.
Thanks in advance

@Tyriar
Copy link
Member

Tyriar commented Aug 30, 2017

@mjbvz is this just a limitation of tsserver that it doesn't check the prototype? Does VS2015 use some other system?

// this.init() go to def doesn't works
var foo = function() {
	this.init();
};
foo.prototype.init = function() {
	// code
};

// this.init() go to def works
class Foo {
	constructor() {
		this.init();
	}

	init() {
	}
}

@mjbvz
Copy link
Collaborator

mjbvz commented Aug 30, 2017

VS2015 used a different JavaScript analysis engine, not one the from typescript that we use and that VS2017 uses. That engine could handle some cases better than we can, but also had some performance issue and to my knowledge was not being actively maintained.

However the case that @3x1010 provided looks like bug in TS. For the code:

function foo() {
	this.init();
}

foo.prototype.init = function () { /*...*/}

const a = new foo();
a.init()

Go to definition does work on a.init but not on this.init. I've opened microsoft/TypeScript#18171 to track this

@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 17, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
api feature-request Request for new features or functionality
Projects
None yet
Development

Successfully merging a pull request may close this issue.