Title: Duplicate callsite ranges for a single method call in callHierarchy/outgoingCalls · Issue #65526 · microsoft/TypeScript · GitHub
Open Graph Title: Duplicate callsite ranges for a single method call in callHierarchy/outgoingCalls · Issue #65526 · microsoft/TypeScript
X Title: Duplicate callsite ranges for a single method call in callHierarchy/outgoingCalls · Issue #65526 · microsoft/TypeScript
Description: 🔎 Search Terms "callsite", "callHierarchy" 🕗 Version & Regression Information Version Observed result 6.0.2, 6.0.3 The LSP startup command is unsupported, repro script cannot determine whether duplicate ranges occur. 7.0.2 Duplicate rang...
Open Graph Description: 🔎 Search Terms "callsite", "callHierarchy" 🕗 Version & Regression Information Version Observed result 6.0.2, 6.0.3 The LSP startup command is unsupported, repro script cannot determine whether dupl...
X Description: 🔎 Search Terms "callsite", "callHierarchy" 🕗 Version & Regression Information Version Observed result 6.0.2, 6.0.3 The LSP startup command is unsupported, repro script canno...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/65526
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Duplicate callsite ranges for a single method call in callHierarchy/outgoingCalls","articleBody":"### 🔎 Search Terms\n\n\"callsite\", \"callHierarchy\"\n\n### 🕗 Version & Regression Information\n\n| Version | Observed result |\n| --- | --- |\n| 6.0.2, 6.0.3 | The LSP startup command is unsupported, repro script cannot determine whether duplicate ranges occur. |\n| 7.0.2 | Duplicate ranges reproduced. |\n| 7.1.0-dev.20261116.1 | Duplicate ranges reproduced. |\n\n\n### ⏯ Playground Link\n\n_No response_\n\n### 💻 Code\n\n### Minimal reproduction\n\n```ts\ninterface G { m(): void; }\nfunction probe(g: G) { g.m(); }\n```\n\n### Steps to reproduce\n\nUse Node.js 22.21 or later and pnpm. In a new reproduction directory, install the pinned dependencies:\n\n```sh\nmkdir ts-call-hierarchy-repro\ncd ts-call-hierarchy-repro\npnpm add --save-exact typescript@7.0.2 vscode-jsonrpc@10.0.0\npnpm exec tsc --version\n```\n\nConfirm that the version output is `Version 7.0.2`. Save the following JavaScript as `repro.mjs` in that directory:\n\n```js\nimport assert from \"node:assert/strict\";\nimport { spawn } from \"node:child_process\";\nimport { mkdtemp, writeFile } from \"node:fs/promises\";\nimport { tmpdir } from \"node:os\";\nimport { join } from \"node:path\";\nimport { pathToFileURL } from \"node:url\";\nimport { createMessageConnection } from \"vscode-jsonrpc/node\";\n\nconst cwd = await mkdtemp(join(tmpdir(), \"ts-call-hierarchy-\"));\nconst text = \"interface G { m(): void; }\\nfunction probe(g: G) { g.m(); }\\n\";\n\nawait writeFile(join(cwd, \"repro.ts\"), text);\nawait writeFile(\n join(cwd, \"tsconfig.json\"),\n JSON.stringify({\n compilerOptions: { noEmit: true, types: [] },\n files: [\"repro.ts\"],\n }),\n);\n\nconst server = spawn(\"tsc\", [\"--lsp\", \"--stdio\"], {\n cwd,\n stdio: [\"pipe\", \"pipe\", \"inherit\"],\n});\nconst serverExited = new Promise((resolve) => {\n server.once(\"exit\", (code, signal) => resolve({ code, signal }));\n server.once(\"error\", (error) => resolve({ error }));\n});\nconst rpc = createMessageConnection(server.stdout, server.stdin);\n\nrpc.onRequest(\"workspace/configuration\", ({ items }) => items.map(() => null));\nfor (const method of [\n \"client/registerCapability\",\n \"client/unregisterCapability\",\n \"window/workDoneProgress/create\",\n]) {\n rpc.onRequest(method, () => null);\n}\nrpc.listen();\n\nasync function withTimeout(promise, milliseconds, label) {\n let timer;\n try {\n return await Promise.race([\n promise,\n new Promise((_, reject) => {\n timer = setTimeout(() => reject(new Error(`Timeout: ${label}`)), milliseconds);\n }),\n ]);\n } finally {\n clearTimeout(timer);\n }\n}\n\nasync function request(method, ...params) {\n return await withTimeout(rpc.sendRequest(method, ...params), 15_000, method);\n}\n\ntry {\n await request(\"initialize\", {\n processId: null,\n rootUri: pathToFileURL(cwd).href,\n capabilities: {\n workspace: {\n didChangeWatchedFiles: { dynamicRegistration: true },\n },\n },\n });\n await rpc.sendNotification(\"initialized\", {});\n\n const uri = pathToFileURL(join(cwd, \"repro.ts\")).href;\n await rpc.sendNotification(\"textDocument/didOpen\", {\n textDocument: { uri, languageId: \"typescript\", version: 1, text },\n });\n\n const [item] = await request(\"textDocument/prepareCallHierarchy\", {\n textDocument: { uri },\n position: { line: 1, character: 9 },\n });\n const result = await request(\"callHierarchy/outgoingCalls\", { item });\n console.log(JSON.stringify(result));\n\n assert.equal(result.length, 1);\n assert.equal(result[0].to.name, \"m\");\n const ranges = result[0].fromRanges;\n assert.equal(ranges.length, 2);\n assert.deepEqual(ranges[0], ranges[1]);\n console.log(\"PASS: two identical ranges for one method call\");\n\n await request(\"shutdown\");\n await rpc.sendNotification(\"exit\");\n const status = await withTimeout(serverExited, 5_000, \"server exit\");\n if (status.error) throw status.error;\n if (status.code === 0 && status.signal === null) {\n console.log(\"Server shutdown completed (code 0)\");\n } else {\n console.error(`Server shutdown abnormal: code ${status.code}, signal ${status.signal}`);\n process.exitCode = 1;\n }\n} finally {\n rpc.dispose();\n if (server.pid && server.exitCode === null && server.signalCode === null) {\n console.error(\"Terminating server after failure or shutdown timeout\");\n if (!server.kill()) console.error(\"Failed to send termination signal to server\");\n }\n}\n```\n\nRun it with:\n\n```sh\npnpm exec node repro.mjs\n```\n\n\n### 🙁 Actual behavior\n\nThe `callHierarchy/outgoingCalls` result contains one outgoing target named `m`, with two identical entries in `fromRanges` (excerpt):\n\n```json\n\"fromRanges\": [\n {\n \"start\": { \"line\": 1, \"character\": 23 },\n \"end\": { \"line\": 1, \"character\": 26 }\n },\n {\n \"start\": { \"line\": 1, \"character\": 23 },\n \"end\": { \"line\": 1, \"character\": 26 }\n }\n]\n```\n\nBoth entries identify the same `g.m` expression, from line 1, character 23 to line 1, character 26 (zero-based coordinates, exclusive end). There is only one method declaration and one method call.\n\n`PASS: two identical ranges for one method call` means that the script successfully reproduced the duplicate ranges, its assertions check the observed bug.\n\nIn both tested 7.x versions, after returning the query result and printing `PASS`, the server prints `context canceled` during shutdown and exits with code 1, which the script reports separately.\n\n\n### 🙂 Expected behavior\n\n`fromRanges` should contain a single entry for the single source occurrence.\n\n### Additional information about the issue\n\n_No response_","author":{"url":"https://github.com/char8x","@type":"Person","name":"char8x"},"datePublished":"2026-11-16T13:45:02Z","url":"https://github.com/microsoft/TypeScript/issues/65526"}
| 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:28e4b4f8-04b7-f6f1-3aa2-2299289e9997 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | EB10:11EACE:82F651:B0D621:6B00E177 |
| html-safe-nonce | 78c8aaee566927d3c9153a87db9c12f669557fd451e8c5e1f2c5f9e63b893e53 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFQjEwOjExRUFDRTo4MkY2NTE6QjBENjIxOjZCMDBFMTc3IiwidmlzaXRvcl9pZCI6IjY2NDM0MzI0MDcxMDgyMTUxNTkiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 63d84df509b84ccb3d007721c3a8470eb31f55c0e718841560baf25c0a98aeee |
| hovercard-subject-tag | issue:6422582038 |
| 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/65526/issue_layout |
| twitter:image | https://opengraph.githubassets.com/e555ee107331637db0db3dbc379c708f44cc72f9aa21195af1617030475fa550/microsoft/TypeScript/issues/65526 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/e555ee107331637db0db3dbc379c708f44cc72f9aa21195af1617030475fa550/microsoft/TypeScript/issues/65526 |
| og:image:alt | 🔎 Search Terms "callsite", "callHierarchy" 🕗 Version & Regression Information Version Observed result 6.0.2, 6.0.3 The LSP startup command is unsupported, repro script cannot determine whether dupl... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | char8x |
| hostname | github.com |
| expected-hostname | github.com |
| None | 043c3f30fbcbe2c6c8e729e10cbbbc90c406546f9fbbb67c648d38f6b7d16daf |
| 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 | 5425dc24e8bd8d6fca9641a12afc984825a43875 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width