{"action":"created","comment":{"url":"https://api.github.com/repos/Microsoft/TypeScript/pulls/comments/75781605","id":75781605,"diff_hunk":"@@ -194,6 +194,14 @@ declare namespace ts.server.protocol {\n     }\r\n \r\n     /**\r\n+      * Go to implementation request; value of command field is\r\n+      * \"implementation\". Return response giving the file locations that\r\n+      * implement the symbol found in file at location line, col.\r\n+      */\r\n+    export interface ImplementationRequest extends FileLocationRequest {\r","path":"src/server/protocol.d.ts","position":8,"original_position":8,"commit_id":"111e50921c20c120bb123945f84949365e020eb3","original_commit_id":"111e50921c20c120bb123945f84949365e020eb3","user":{"login":"riknoll","id":13754588,"avatar_url":"https://avatars.githubusercontent.com/u/13754588?v=3","gravatar_id":"","url":"https://api.github.com/users/riknoll","html_url":"https://github.com/riknoll","followers_url":"https://api.github.com/users/riknoll/followers","following_url":"https://api.github.com/users/riknoll/following{/other_user}","gists_url":"https://api.github.com/users/riknoll/gists{/gist_id}","starred_url":"https://api.github.com/users/riknoll/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/riknoll/subscriptions","organizations_url":"https://api.github.com/users/riknoll/orgs","repos_url":"https://api.github.com/users/riknoll/repos","events_url":"https://api.github.com/users/riknoll/events{/privacy}","received_events_url":"https://api.github.com/users/riknoll/received_events","type":"User","site_admin":false},"body":"I was following what `TypeDefinitionRequest` and `DefinitionRequest` did (see above). ","created_at":"2016-08-22T23:57:57Z","updated_at":"2016-08-22T23:57:57Z","html_url":"https://github.com/Microsoft/TypeScript/pull/10482#discussion_r75781605","pull_request_url":"https://api.github.com/repos/Microsoft/TypeScript/pulls/10482","_links":{"self":{"href":"https://api.github.com/repos/Microsoft/TypeScript/pulls/comments/75781605"},"html":{"href":"https://github.com/Microsoft/TypeScript/pull/10482#discussion_r75781605"},"pull_request":{"href":"https://api.github.com/repos/Microsoft/TypeScript/pulls/10482"}}},"pull_request":{"url":"https://api.github.com/repos/Microsoft/TypeScript/pulls/10482","id":82263765,"html_url":"https://github.com/Microsoft/TypeScript/pull/10482","diff_url":"https://github.com/Microsoft/TypeScript/pull/10482.diff","patch_url":"https://github.com/Microsoft/TypeScript/pull/10482.patch","issue_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/10482","number":10482,"state":"open","locked":false,"title":"Go to Implementation","user":{"login":"riknoll","id":13754588,"avatar_url":"https://avatars.githubusercontent.com/u/13754588?v=3","gravatar_id":"","url":"https://api.github.com/users/riknoll","html_url":"https://github.com/riknoll","followers_url":"https://api.github.com/users/riknoll/followers","following_url":"https://api.github.com/users/riknoll/following{/other_user}","gists_url":"https://api.github.com/users/riknoll/gists{/gist_id}","starred_url":"https://api.github.com/users/riknoll/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/riknoll/subscriptions","organizations_url":"https://api.github.com/users/riknoll/orgs","repos_url":"https://api.github.com/users/riknoll/repos","events_url":"https://api.github.com/users/riknoll/events{/privacy}","received_events_url":"https://api.github.com/users/riknoll/received_events","type":"User","site_admin":false},"body":"Fixes #6209\r\n\r\nThis PR adds \"Go To Implementation\" functionality to the typescript language service.\r\n\r\nThe code works as follows:\r\n\r\nFirst, if a symbol's definition is the same as its implementation, then \"Go to Definition\" is invoked. This covers most symbols, but not classes, interfaces, or unions/intersections and their members.\r\n\r\nFor symbols where the implementation is not the same as the definition, it performs \"Find all References\" and then filters the results down to those that are implementations. If anything is not caught by \"Find all References\", it won't show up in the results.\r\n\r\nFor example:\r\n\r\n```typescript\r\ninterface Foo {\r\n    hello(): void;\r\n}\r\n\r\nclass Bar implements Foo {\r\n    hello () {}\r\n}\r\n\r\nclass Baz {\r\n    hello () {}\r\n}\r\n\r\n```\r\n\r\nBoth `Bar` and `Baz` implement `Foo`, but only `Bar` will show up in the results of \"Go to Implementation\" when invoked on `Foo`. You'll get the same results if you use \"Go to Implementation\" on `Foo.hello`.\r\n\r\n\"Find all References\" is based on a text search, so if something implements a given interface but does not do so *explicitly* (i.e. using the name of the thing being referenced), it won't show up in the results. In general, it's more useful to invoke \"Go to Implementation\" on a member of the interface instead of the interface itself, since the names of members always show up in the implementation.\r\n\r\nHere are some examples that illustrate that:\r\n\r\n```typescript\r\n\r\n// This implementation will show up if invoked on \"Foo\" or \"Foo.hello\" because \"Foo\" is in the type reference\r\nlet x: Foo = { hello: () => { console.log(\"Hello!\"); } };\r\n\r\n// This one will not show up if invoked on \"Foo\", because the string \"Foo\" isn't in it (but \"Foo.hello\" will work)\r\nx = { hello: () => { console.log(\"Hi!\"); } };\r\n\r\n// This one will also not work with \"Foo\", but will work with \"Foo.hello\"\r\nsomeFunctionThatTakesAFoo({ hello: () => { console.log(\"Aloha!\"); } })\r\n```\r\n\r\nStill, I tried to capture most the usual patterns for creating instances of an interface. All of the following will work if invoked on `Foo`:\r\n\r\n```typescript\r\n// Class declarations and expressions that implement the interface\r\nclass Bar implements Foo {\r\n    hello() {}\r\n}\r\n\r\n// Variable-like assignments with type references to the interface\r\nconst x: Foo = { hello: () => {} };\r\n\r\n// Object literals in return statements of functions with the correct return type\r\nfunction createFoo(): Foo {\r\n    return { hello: () => {} };\r\n}\r\n\r\n// Type assertion expressions\r\nconst y = <Foo> { hello: () => {} };\r\n```\r\n\r\nAnother point of interest is the members of classes. If \"Go to Implementation\" is invoked on the member of a class, the results will also contain implementations in sub-classes. For example, if \"Go to Implementation\" was invoked on the reference `x.hello` below:\r\n\r\n```typescript\r\nfunction someFunction(x: Bar) {\r\n    x.hello();\r\n}\r\n\r\nclass Bar extends BaseBar {}\r\n\r\n// This implementation would show up, because it is the one used by Bar at runtime\r\nclass BaseBar {\r\n    public hello() {}\r\n}\r\n\r\n// This implementation will also show up, because SubBar extends Bar\r\nclass SubBar extends Bar {\r\n    public hello() {}\r\n}\r\n```\r\n\r\n\r\n And there it is! I'm sure I missed some edge cases somewhere along the way, but they'll hopefully be caught once people start trying out the code. I tried the current implementation out on the TypeScript code base, and it seems to work pretty well. Implementations in JS files are not supported.","created_at":"2016-08-22T21:09:06Z","updated_at":"2016-08-22T23:57:57Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d1321251c2cf77a19a5735086cf8521d0e0b41ee","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/Microsoft/TypeScript/pulls/10482/commits","review_comments_url":"https://api.github.com/repos/Microsoft/TypeScript/pulls/10482/comments","review_comment_url":"https://api.github.com/repos/Microsoft/TypeScript/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/10482/comments","statuses_url":"https://api.github.com/repos/Microsoft/TypeScript/statuses/111e50921c20c120bb123945f84949365e020eb3","head":{"label":"Microsoft:go_to_implementation_pr","ref":"go_to_implementation_pr","sha":"111e50921c20c120bb123945f84949365e020eb3","user":{"login":"Microsoft","id":6154722,"avatar_url":"https://avatars.githubusercontent.com/u/6154722?v=3","gravatar_id":"","url":"https://api.github.com/users/Microsoft","html_url":"https://github.com/Microsoft","followers_url":"https://api.github.com/users/Microsoft/followers","following_url":"https://api.github.com/users/Microsoft/following{/other_user}","gists_url":"https://api.github.com/users/Microsoft/gists{/gist_id}","starred_url":"https://api.github.com/users/Microsoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Microsoft/subscriptions","organizations_url":"https://api.github.com/users/Microsoft/orgs","repos_url":"https://api.github.com/users/Microsoft/repos","events_url":"https://api.github.com/users/Microsoft/events{/privacy}","received_events_url":"https://api.github.com/users/Microsoft/received_events","type":"Organization","site_admin":false},"repo":{"id":20929025,"name":"TypeScript","full_name":"Microsoft/TypeScript","owner":{"login":"Microsoft","id":6154722,"avatar_url":"https://avatars.githubusercontent.com/u/6154722?v=3","gravatar_id":"","url":"https://api.github.com/users/Microsoft","html_url":"https://github.com/Microsoft","followers_url":"https://api.github.com/users/Microsoft/followers","following_url":"https://api.github.com/users/Microsoft/following{/other_user}","gists_url":"https://api.github.com/users/Microsoft/gists{/gist_id}","starred_url":"https://api.github.com/users/Microsoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Microsoft/subscriptions","organizations_url":"https://api.github.com/users/Microsoft/orgs","repos_url":"https://api.github.com/users/Microsoft/repos","events_url":"https://api.github.com/users/Microsoft/events{/privacy}","received_events_url":"https://api.github.com/users/Microsoft/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Microsoft/TypeScript","description":"TypeScript is a superset of JavaScript that compiles to clean JavaScript output.","fork":false,"url":"https://api.github.com/repos/Microsoft/TypeScript","forks_url":"https://api.github.com/repos/Microsoft/TypeScript/forks","keys_url":"https://api.github.com/repos/Microsoft/TypeScript/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Microsoft/TypeScript/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Microsoft/TypeScript/teams","hooks_url":"https://api.github.com/repos/Microsoft/TypeScript/hooks","issue_events_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/events{/number}","events_url":"https://api.github.com/repos/Microsoft/TypeScript/events","assignees_url":"https://api.github.com/repos/Microsoft/TypeScript/assignees{/user}","branches_url":"https://api.github.com/repos/Microsoft/TypeScript/branches{/branch}","tags_url":"https://api.github.com/repos/Microsoft/TypeScript/tags","blobs_url":"https://api.github.com/repos/Microsoft/TypeScript/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Microsoft/TypeScript/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Microsoft/TypeScript/git/refs{/sha}","trees_url":"https://api.github.com/repos/Microsoft/TypeScript/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Microsoft/TypeScript/statuses/{sha}","languages_url":"https://api.github.com/repos/Microsoft/TypeScript/languages","stargazers_url":"https://api.github.com/repos/Microsoft/TypeScript/stargazers","contributors_url":"https://api.github.com/repos/Microsoft/TypeScript/contributors","subscribers_url":"https://api.github.com/repos/Microsoft/TypeScript/subscribers","subscription_url":"https://api.github.com/repos/Microsoft/TypeScript/subscription","commits_url":"https://api.github.com/repos/Microsoft/TypeScript/commits{/sha}","git_commits_url":"https://api.github.com/repos/Microsoft/TypeScript/git/commits{/sha}","comments_url":"https://api.github.com/repos/Microsoft/TypeScript/comments{/number}","issue_comment_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/comments{/number}","contents_url":"https://api.github.com/repos/Microsoft/TypeScript/contents/{+path}","compare_url":"https://api.github.com/repos/Microsoft/TypeScript/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Microsoft/TypeScript/merges","archive_url":"https://api.github.com/repos/Microsoft/TypeScript/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Microsoft/TypeScript/downloads","issues_url":"https://api.github.com/repos/Microsoft/TypeScript/issues{/number}","pulls_url":"https://api.github.com/repos/Microsoft/TypeScript/pulls{/number}","milestones_url":"https://api.github.com/repos/Microsoft/TypeScript/milestones{/number}","notifications_url":"https://api.github.com/repos/Microsoft/TypeScript/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Microsoft/TypeScript/labels{/name}","releases_url":"https://api.github.com/repos/Microsoft/TypeScript/releases{/id}","deployments_url":"https://api.github.com/repos/Microsoft/TypeScript/deployments","created_at":"2014-06-17T15:28:39Z","updated_at":"2016-08-22T23:57:12Z","pushed_at":"2016-08-22T23:50:58Z","git_url":"git://github.com/Microsoft/TypeScript.git","ssh_url":"git@github.com:Microsoft/TypeScript.git","clone_url":"https://github.com/Microsoft/TypeScript.git","svn_url":"https://github.com/Microsoft/TypeScript","homepage":"http://www.typescriptlang.org","size":553976,"stargazers_count":14227,"watchers_count":14227,"language":"TypeScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":1895,"mirror_url":null,"open_issues_count":1275,"forks":1895,"open_issues":1275,"watchers":14227,"default_branch":"master"}},"base":{"label":"Microsoft:master","ref":"master","sha":"a0137597f986637eb79f9be4a611b72f954e7760","user":{"login":"Microsoft","id":6154722,"avatar_url":"https://avatars.githubusercontent.com/u/6154722?v=3","gravatar_id":"","url":"https://api.github.com/users/Microsoft","html_url":"https://github.com/Microsoft","followers_url":"https://api.github.com/users/Microsoft/followers","following_url":"https://api.github.com/users/Microsoft/following{/other_user}","gists_url":"https://api.github.com/users/Microsoft/gists{/gist_id}","starred_url":"https://api.github.com/users/Microsoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Microsoft/subscriptions","organizations_url":"https://api.github.com/users/Microsoft/orgs","repos_url":"https://api.github.com/users/Microsoft/repos","events_url":"https://api.github.com/users/Microsoft/events{/privacy}","received_events_url":"https://api.github.com/users/Microsoft/received_events","type":"Organization","site_admin":false},"repo":{"id":20929025,"name":"TypeScript","full_name":"Microsoft/TypeScript","owner":{"login":"Microsoft","id":6154722,"avatar_url":"https://avatars.githubusercontent.com/u/6154722?v=3","gravatar_id":"","url":"https://api.github.com/users/Microsoft","html_url":"https://github.com/Microsoft","followers_url":"https://api.github.com/users/Microsoft/followers","following_url":"https://api.github.com/users/Microsoft/following{/other_user}","gists_url":"https://api.github.com/users/Microsoft/gists{/gist_id}","starred_url":"https://api.github.com/users/Microsoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Microsoft/subscriptions","organizations_url":"https://api.github.com/users/Microsoft/orgs","repos_url":"https://api.github.com/users/Microsoft/repos","events_url":"https://api.github.com/users/Microsoft/events{/privacy}","received_events_url":"https://api.github.com/users/Microsoft/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Microsoft/TypeScript","description":"TypeScript is a superset of JavaScript that compiles to clean JavaScript output.","fork":false,"url":"https://api.github.com/repos/Microsoft/TypeScript","forks_url":"https://api.github.com/repos/Microsoft/TypeScript/forks","keys_url":"https://api.github.com/repos/Microsoft/TypeScript/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Microsoft/TypeScript/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Microsoft/TypeScript/teams","hooks_url":"https://api.github.com/repos/Microsoft/TypeScript/hooks","issue_events_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/events{/number}","events_url":"https://api.github.com/repos/Microsoft/TypeScript/events","assignees_url":"https://api.github.com/repos/Microsoft/TypeScript/assignees{/user}","branches_url":"https://api.github.com/repos/Microsoft/TypeScript/branches{/branch}","tags_url":"https://api.github.com/repos/Microsoft/TypeScript/tags","blobs_url":"https://api.github.com/repos/Microsoft/TypeScript/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Microsoft/TypeScript/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Microsoft/TypeScript/git/refs{/sha}","trees_url":"https://api.github.com/repos/Microsoft/TypeScript/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Microsoft/TypeScript/statuses/{sha}","languages_url":"https://api.github.com/repos/Microsoft/TypeScript/languages","stargazers_url":"https://api.github.com/repos/Microsoft/TypeScript/stargazers","contributors_url":"https://api.github.com/repos/Microsoft/TypeScript/contributors","subscribers_url":"https://api.github.com/repos/Microsoft/TypeScript/subscribers","subscription_url":"https://api.github.com/repos/Microsoft/TypeScript/subscription","commits_url":"https://api.github.com/repos/Microsoft/TypeScript/commits{/sha}","git_commits_url":"https://api.github.com/repos/Microsoft/TypeScript/git/commits{/sha}","comments_url":"https://api.github.com/repos/Microsoft/TypeScript/comments{/number}","issue_comment_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/comments{/number}","contents_url":"https://api.github.com/repos/Microsoft/TypeScript/contents/{+path}","compare_url":"https://api.github.com/repos/Microsoft/TypeScript/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Microsoft/TypeScript/merges","archive_url":"https://api.github.com/repos/Microsoft/TypeScript/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Microsoft/TypeScript/downloads","issues_url":"https://api.github.com/repos/Microsoft/TypeScript/issues{/number}","pulls_url":"https://api.github.com/repos/Microsoft/TypeScript/pulls{/number}","milestones_url":"https://api.github.com/repos/Microsoft/TypeScript/milestones{/number}","notifications_url":"https://api.github.com/repos/Microsoft/TypeScript/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Microsoft/TypeScript/labels{/name}","releases_url":"https://api.github.com/repos/Microsoft/TypeScript/releases{/id}","deployments_url":"https://api.github.com/repos/Microsoft/TypeScript/deployments","created_at":"2014-06-17T15:28:39Z","updated_at":"2016-08-22T23:57:12Z","pushed_at":"2016-08-22T23:50:58Z","git_url":"git://github.com/Microsoft/TypeScript.git","ssh_url":"git@github.com:Microsoft/TypeScript.git","clone_url":"https://github.com/Microsoft/TypeScript.git","svn_url":"https://github.com/Microsoft/TypeScript","homepage":"http://www.typescriptlang.org","size":553976,"stargazers_count":14227,"watchers_count":14227,"language":"TypeScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":1895,"mirror_url":null,"open_issues_count":1275,"forks":1895,"open_issues":1275,"watchers":14227,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Microsoft/TypeScript/pulls/10482"},"html":{"href":"https://github.com/Microsoft/TypeScript/pull/10482"},"issue":{"href":"https://api.github.com/repos/Microsoft/TypeScript/issues/10482"},"comments":{"href":"https://api.github.com/repos/Microsoft/TypeScript/issues/10482/comments"},"review_comments":{"href":"https://api.github.com/repos/Microsoft/TypeScript/pulls/10482/comments"},"review_comment":{"href":"https://api.github.com/repos/Microsoft/TypeScript/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Microsoft/TypeScript/pulls/10482/commits"},"statuses":{"href":"https://api.github.com/repos/Microsoft/TypeScript/statuses/111e50921c20c120bb123945f84949365e020eb3"}}}}
{"actor":{"display_login":"riknoll"}}