Repository navigation
Fix call hierarchy file node paths - #64108
Ryan Cavanaugh (RyanCavanaugh) with Copilot wants to merge 5 commits into
Conversation
Co-authored-by: RyanCavanaugh <6685088+RyanCavanaugh@users.noreply.github.com>
|
I'm not sure this is 100% right; it turns out that the old VS Code extension did I think we'd have to somehow plumb that info down from the init message. |
|
Hi! As OP on the issue #64097, I was wondering if there is any progress on this issue? Can I help in any way? |
|
Copilot merge main and do better per the above |
…archy-file-path # Conflicts: # tsc/internal/ls/callhierarchy.go Co-authored-by: jakebailey <5341706+jakebailey@users.noreply.github.com>
Co-authored-by: jakebailey <5341706+jakebailey@users.noreply.github.com>
Merged main in ce08218. In 1de9546, call hierarchy details use initialized workspace folders with typed paths, including named multi-root folders and VS Code’s workspace-root parent lookup. Navigation URIs remain unchanged. Build, tests, lint, and format passed; CodeQL was blocked by a Git diff timeout. |
There was a problem hiding this comment.
🟡 Changes recommended
Workspace-folder selection relies on UTF-8 byte length rather than case-aware ancestry, which can select an outer folder on case-insensitive hosts and produce incorrect call-hierarchy details.
1 open issue
What changed in this PR
This PR addresses #64097 by making call hierarchy file nodes easier to scan in the native TypeScript language server while preserving navigation targets.
Changes:
- Display file basenames with workspace-relative directory details where applicable.
- Pass workspace folder paths and names from server initialization to the language service.
- Add workspace regression cases and update call hierarchy baselines.
| File | Description |
|---|---|
tsc/testdata/baselines/reference/fourslash/callHierarchy/callHierarchyInterfaceMethod.callHierarchy.txt |
Updates incoming file labels and directory details. |
tsc/testdata/baselines/reference/fourslash/callHierarchy/callHierarchyFileWorkspaceRootUri.callHierarchy.txt |
Records root-URI-relative details. |
tsc/testdata/baselines/reference/fourslash/callHierarchy/callHierarchyFileWorkspaceFolders.callHierarchy.txt |
Records nested workspace selection and naming. |
tsc/testdata/baselines/reference/fourslash/callHierarchy/callHierarchyFileWorkspaceFolderRoot.callHierarchy.txt |
Records details for files at a workspace root. |
tsc/testdata/baselines/reference/fourslash/callHierarchy/callHierarchyFileOutsideWorkspace.callHierarchy.txt |
Records absolute-directory fallback outside workspaces. |
tsc/testdata/baselines/reference/fourslash/callHierarchy/callHierarchyFileNestedWorkspaceRoot.callHierarchy.txt |
Records nested-root directory handling. |
tsc/testdata/baselines/reference/fourslash/callHierarchy/callHierarchyFile.callHierarchy.txt |
Updates the subdirectory regression baseline. |
tsc/testdata/baselines/reference/fourslash/callHierarchy/callHierarchyExportEqualsFunction.callHierarchy.txt |
Updates source-file module labels. |
tsc/testdata/baselines/reference/fourslash/callHierarchy/callHierarchyCallExpressionByConstNamedFunctionExpression.callHierarchy.txt |
Updates incoming file labels. |
tsc/testdata/baselines/reference/fourslash/callHierarchy/callHierarchyAnonymousFunctionNoCrash2.callHierarchy.txt |
Updates anonymous-function fallback labels. |
tsc/testdata/baselines/reference/fourslash/callHierarchy/callHierarchyAnonymousClassNoCrash2.callHierarchy.txt |
Updates anonymous-class fallback labels. |
tsc/internal/project/snapshot.go |
Exposes workspace folders to the language service. |
tsc/internal/project/session.go |
Adds initial workspace folder metadata. |
tsc/internal/lsp/server.go |
Captures workspace paths and display names during initialization. |
tsc/internal/ls/host.go |
Defines workspace folder metadata and its host accessor. |
tsc/internal/ls/file_rename_test.go |
Updates the test host for the extended interface. |
tsc/internal/ls/callhierarchy.go |
Formats file basenames and workspace-aware directory details. |
tsc/internal/fourslash/tests/callHierarchyFile_test.go |
Adds subdirectory and workspace regression cases. |
tsc/internal/fourslash/fourslash.go |
Allows tests to supply workspace initialization parameters. |
Review effort: Balanced
| if l.CaseSensitivity().ComparePaths(folder.Path.AsPath(), directory.AsPath()) == 0 { | ||
| searchDirectory = directory.AsPath().Directory() | ||
| } | ||
| if l.CaseSensitivity().ContainsPath(folder.Path, searchDirectory.AsPath()) && (containingFolder == nil || len(folder.Path) > len(containingFolder.Path)) { |
There was a problem hiding this comment.
Copilot investigate, also why so many AsPaths
There was a problem hiding this comment.
Fixed in 5e5788f: workspace-folder depth is now determined with case-aware ancestry, with a regression test for the Unicode case-folding scenario. The .AsPath() calls convert RootedDirectoryPath values to the distinct RootedPath type required by the path-comparison APIs; they are type conversions, not repeated path normalization.
Co-authored-by: jakebailey <5341706+jakebailey@users.noreply.github.com>

TypeScript 7 call hierarchy file nodes displayed absolute paths, making large hierarchies difficult to scan.