fix: render file tree tooltip path as literal text, not markdown#493
Draft
laileni-aws wants to merge 2 commits into
Draft
fix: render file tree tooltip path as literal text, not markdown#493laileni-aws wants to merge 2 commits into
laileni-aws wants to merge 2 commits into
Conversation
The file tree item tooltip ran the file name and path through the markdown parser. For Windows paths this dropped backslashes that precede a period (e.g. C:\\Users\\me\\.gradle\\init.gradle was shown as C:\\Users\\me.gradle\\init.gradle), because \. is a markdown escape. File names and paths are literal text, so render each tooltip line as plain text instead of markdown. Adds a test asserting a Windows path is shown verbatim.
Keeps the repo lint gate green (strict-boolean-expressions).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
File paths shown in the file-tree item tooltip are displayed incorrectly on Windows: the backslash before a dot is dropped. For example
C:\Users\discr\.gradle\init.gradleis shown asC:\Users\discr.gradle\init.gradle, and...\repo\project\.github\workflows\main.ymlis shown as...\repo\project.github\workflows\main.yml.Root cause
In
src/components/chat-item/chat-item-tree-file.ts, the tooltip built its content by running the file name anddetails.description(the full path) throughparseMarkdown(...), and then rendered the result throughCardBody, which parses markdown as well.A file path is not markdown. Markdown treats a backslash before ASCII punctuation as an escape, so
\.becomes.and the backslash is removed. Backslashes before letters (e.g.\U,\g) are preserved, which is why only the\.segments were affected — exactly matching the reported behavior.Fix
Render the tooltip lines (file name and path) as literal text instead of markdown:
mouseoverhandler now collects the file name / description into astring[]without parsing them as markdown.showTooltiprenders each line as a plain textdiv(text node), so the content — including backslashes in Windows paths — is shown verbatim.The now-unused
parseMarkdownandCardBodyimports were removed from this file.Testing
src/components/__test__/chat-item/chat-item-tree-file.spec.tswith a test that hovers a tree file whose path is a Windows path and asserts the tooltip contains the path verbatim (backslashes preserved), and does not collapsediscr\.gradletodiscr.gradle.npx jest): 843 tests.eslintandprettier --checkpass; production build (npm run build) succeeds.Additional change
ui-tests/__test__/flows/quick-action-commands-header.ts: coerced the result of a Playwrightevaluatecall to a boolean withBoolean(...)to satisfy@typescript-eslint/strict-boolean-expressionsand keep the repo lint gate green.