Title: Cmd+click of JSX component shows type definition in VSCode, instead of linking to component definition · Issue #37816 · microsoft/TypeScript · GitHub
Open Graph Title: Cmd+click of JSX component shows type definition in VSCode, instead of linking to component definition · Issue #37816 · microsoft/TypeScript
X Title: Cmd+click of JSX component shows type definition in VSCode, instead of linking to component definition · Issue #37816 · microsoft/TypeScript
Description: As requested by Ryan Cavanaugh (@RyanCavanaugh) on issue #24809 - reopening the issue with an updated concrete way to reproduce. Tested with latest VSCode 1.43, latest typescript 3.8.3. Simply create a .tsx file in VSCode with the follow...
Open Graph Description: As requested by Ryan Cavanaugh (@RyanCavanaugh) on issue #24809 - reopening the issue with an updated concrete way to reproduce. Tested with latest VSCode 1.43, latest typescript 3.8.3. Simply crea...
X Description: As requested by Ryan Cavanaugh (@RyanCavanaugh) on issue #24809 - reopening the issue with an updated concrete way to reproduce. Tested with latest VSCode 1.43, latest typescript 3.8.3. Simply crea...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/37816
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Cmd+click of JSX component shows type definition in VSCode, instead of linking to component definition","articleBody":"As requested by @RyanCavanaugh on issue #24809 - reopening the issue with an updated concrete way to reproduce.\r\n\r\nTested with latest VSCode `1.43`, latest typescript `3.8.3`.\r\n\r\nSimply create a `.tsx` file in VSCode with the following content:\r\n\r\n```tsx\r\nimport React from 'react'\r\n\r\nconst Thing: React.FC\u003c{ text: string }> = (props) => \u003cdiv>{props.text}\u003c/div>\r\n\r\nconst HelloWorld = () => \u003cThing text=\"hello world\" />\r\n```\r\n\r\nAnd cmd+click on `\u003cThing` on line 5\r\n\r\n**Expected behavior:**\r\n\r\nCursor moves to definition of `const Thing` on line 3.\r\n\r\n**Actual behavior:**\r\n\r\n\r\n\r\nVSCode opens a definitions window with links to 2 definitions: \r\n\r\n1. The component definition on line 3 (that I expected to be linked to)\r\n2. The definition for the **type** of the component: `React.FC`, in `node_modules/@types/react`.\r\n\r\n---\r\n\r\nThis seems like a bug. In practice it means navigating is broken for JSX components, as cmd+clicking to link doesn't work - you have to cmd+click then click on the code definition again in the definitions window.\r\n\r\nI am pretty sure that in the vast, vast majority of cases, when people cmd+click *on the JSX* for a component, they want to link to the component's definition and not the type. \r\n\r\nEven supposing people *did* want to do that, in some cases: \r\n1. Just *seeing* what the type is would be solved in one click, because it is there in the definition \r\n2. Navigating to that type definition if you really wanted to would remain at 2 clicks - by just cmd+clicking it right there in the definition.\r\n\r\nSo, there seems no downside here. Improve (fix) the most common usecase, less common (if ever) usecase still works, still 2 clicks.","author":{"url":"https://github.com/davnicwil","@type":"Person","name":"davnicwil"},"datePublished":"2020-04-06T22:04:47Z","url":"https://github.com/microsoft/TypeScript/issues/37816"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:57688d96-731c-acb3-091a-86d61cc96a53 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E3C8:296654:26D7CAE:33D0FCE:6B01AB4F |
| html-safe-nonce | a5986cc3051036a4aed702fcbda4da1cab7fd4ee30e7596b66112996cd4baf75 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFM0M4OjI5NjY1NDoyNkQ3Q0FFOjMzRDBGQ0U6NkIwMUFCNEYiLCJ2aXNpdG9yX2lkIjoiMTg4NzkwMzAxMTkwNTMxNzcxMSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 130ce349c9c51c91dd24e785d18373cd22565919fe9a42cb09a220709d6eb91f |
| hovercard-subject-tag | issue:595457725 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/microsoft/TypeScript/37816/issue_layout |
| twitter:image | https://opengraph.githubassets.com/e54d22c33a7dc1f48ea68fb66eea637aebaf2b2c42a3bfd320ed7e72acb12917/microsoft/TypeScript/issues/37816 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/e54d22c33a7dc1f48ea68fb66eea637aebaf2b2c42a3bfd320ed7e72acb12917/microsoft/TypeScript/issues/37816 |
| og:image:alt | As requested by Ryan Cavanaugh (@RyanCavanaugh) on issue #24809 - reopening the issue with an updated concrete way to reproduce. Tested with latest VSCode 1.43, latest typescript 3.8.3. Simply crea... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | davnicwil |
| hostname | github.com |
| expected-hostname | github.com |
| None | cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c |
| turbo-cache-control | no-preview |
| go-import | github.com/microsoft/TypeScript git https://github.com/microsoft/TypeScript.git |
| octolytics-dimension-user_id | 6154722 |
| octolytics-dimension-user_login | microsoft |
| octolytics-dimension-repository_id | 20929025 |
| octolytics-dimension-repository_nwo | microsoft/TypeScript |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 20929025 |
| octolytics-dimension-repository_network_root_nwo | microsoft/TypeScript |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 8c77c9e8439031ad54c75a250694842892f693e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width