On TypeScript 7, Call hierarchy shows a full absolute path instead of file name + relative path
Đánh giá
Issue này chưa được đánh giá.
Mô tả
🔎 Search Terms
"call hierarchy"
"function call hierarchy files"
"call hierarchy file path"
"absolute path"
"full file path"
Found: Possibly related #36511 — same symptom, reported in 2020 and closed as fixed.
🕗 Version & Regression Information
- Work as expected on
6.0.3: TypeScript and JavaScript Language Features (built-in) - Bug on
TypeScriptTeam.native-preview0.20260226.1(first version with Call Hierarchy support) - Bug on
TypeScriptTeam.native-preview0.20260708.2(latest)
⏯ Playground Link
https://github.com/brian-xu-vlt/typescript-hierarchy-repro
💻 Code
[!IMPORTANT]
I provided a repository above because the playground does not seem to supportshow call hierarchyon a symbol in order to reproduce the bug, but below is the playground code form the provided repository in case it helps
callers.ts
import { targetFunction } from "./target.js";
export const levelOne = (value: number): number => {
return targetFunction(value);
};
function levelTwo(value: number): number {
return levelOne(value);
}
const { levelThree } = {
levelThree: (value: number): number => {
return levelTwo(value);
},
};
const levelFour = (value: number): void => {
console.log(levelThree(42));
};
target.ts
export function targetFunction(value: number): number {
return value * 2;
}
🙁 Actual behavior
Steps to reproduce
- Clone this repo (https://github.com/brian-xu-vlt/typescript-hierarchy-repro) and run
pnpm install. - Open
src/target.ts. - On
targetFunction(line 1) Run Show Call Hierarchy (Shift+Alt+H) and expand the incoming calls
down to the last level.
🚨 → See the issue: The hierarchy istargetFunction→levelOne→levelTwo, then a node for the
containing file with a full path. That last node is where the two TS versions differ.
🙂 Expected behavior
The file node is labelled the way TypeScript 6 labels it: the file name, with
the path relative to the workspace shown as the secondary detail.
Additional information about the issue
Real life issue
For a simple call the issue is benign, but in real monorepos, a list of many absolute paths make it very hard to navigate the call hierarchy.
Language server likely not the root cause
The reproduction repository contains a simple script to show tsserver and TypeScript 7 LSP server produce the same value, meaning the issue is quite likely to come from TypeScriptTeam.native-preview
Show to run
# with typescript 6.0.3 installed, over the tsserver JSON protocol
node tools/callhierarchy.mjs ./src/target.ts targetFunction --depth 10 --engine tsserver
# with typescript 7.0.2 installed, over LSP
node tools/callhierarchy.mjs ./src/target.ts targetFunction --depth 10 --engine lsp
Result for TS6 and TS7
- Ngôn ngữ chính
- Go
- Star
- 111k
- Fork
- 14.4k
- Merge trung bình
- 1 ngày 15 giờ
- Pull request đã merge (30 ngày)
- 106
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của microsoft/TypeScript
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
microsoft/TypeScript#64322 · 2 bình luận · 1 reaction · 2 người được giao ·
-
Possible Improvement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
microsoft/TypeScript#64278 · 1 bình luận · 1 reaction ·
-
Docs
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
microsoft/TypeScript#64118 · 1 bình luận ·
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
microsoft/TypeScript#64094 ·
-
Docs
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
microsoft/TypeScript#63959 · 5 bình luận ·
Tất cả issue của microsoft/TypeScript
Issue tương tự
-
Type/Bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
OpenNSW/nsw-srilanka#497 ·
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 92/100
milvus-io/birdwatcher#545 ·
-
kind/bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
kubernetes-sigs/prow#953 · 1 bình luận ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
JuliusBrussee/caveman#1102 · 1 bình luận ·