feat: surface pinned editor state in Explorer file tooltip#301674
Open
murataslan1 wants to merge 1 commit intomicrosoft:mainfrom
Open
feat: surface pinned editor state in Explorer file tooltip#301674murataslan1 wants to merge 1 commit intomicrosoft:mainfrom
murataslan1 wants to merge 1 commit intomicrosoft:mainfrom
Conversation
When hovering over a file in the Explorer that is pinned in any editor group, the tooltip now shows "(pinned)" alongside the file path. This helps users identify pinned files while navigating through the Explorer without switching to the editor tab strip. Fixes microsoft#285850
📬 CODENOTIFYThe following users are being notified based on files changed in this PR: @bpaseroMatched files:
|
Contributor
There was a problem hiding this comment.
Pull request overview
This PR enhances the Files Explorer UX by surfacing whether a file is currently pinned in any editor group directly in the Explorer hover tooltip, helping users understand tab state while navigating from the sidebar.
Changes:
- Injects
IEditorGroupsServiceintoFilesRenderer. - Adds
isFilePinned(resource)to detect pinned editors across groups. - Sets a custom
titleinrenderStat()so pinned files showpath (pinned)in the tooltip.
Comment on lines
+1027
to
1043
| // Surface pinned editor state in tooltip | ||
| let title: string | undefined; | ||
| if (!stat.isDirectory && this.isFilePinned(stat.resource)) { | ||
| const filePath = this.labelService.getUriLabel(stat.resource); | ||
| title = `${filePath} (${localize('pinned', "pinned")})`; | ||
| } | ||
|
|
||
| templateData.contribs.forEach(c => c.setResource(stat.resource)); | ||
| templateData.label.setResource({ resource: stat.resource, name: label }, { | ||
| fileKind: stat.isRoot ? FileKind.ROOT_FOLDER : stat.isDirectory ? FileKind.FOLDER : FileKind.FILE, | ||
| extraClasses: realignNestedChildren ? [...extraClasses, 'align-nest-icon-with-parent-icon'] : extraClasses, | ||
| fileDecorations: this.config.explorer.decorations, | ||
| matches: createMatches(filterData), | ||
| separator: this.labelService.getSeparator(stat.resource.scheme, stat.resource.authority), | ||
| domId | ||
| domId, | ||
| title | ||
| }); |
Comment on lines
+995
to
+1003
| private isFilePinned(resource: URI): boolean { | ||
| for (const group of this.editorGroupsService.groups) { | ||
| const editors = group.findEditors(resource); | ||
| for (const editor of editors) { | ||
| if (group.isPinned(editor)) { | ||
| return true; | ||
| } | ||
| } | ||
| } |
Comment on lines
+1027
to
+1032
| // Surface pinned editor state in tooltip | ||
| let title: string | undefined; | ||
| if (!stat.isDirectory && this.isFilePinned(stat.resource)) { | ||
| const filePath = this.labelService.getUriLabel(stat.resource); | ||
| title = `${filePath} (${localize('pinned', "pinned")})`; | ||
| } |
| let title: string | undefined; | ||
| if (!stat.isDirectory && this.isFilePinned(stat.resource)) { | ||
| const filePath = this.labelService.getUriLabel(stat.resource); | ||
| title = `${filePath} (${localize('pinned', "pinned")})`; |
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.
Summary
When hovering over a file in the Explorer that is currently pinned in any editor group, the tooltip now shows the file path followed by "(pinned)". This surfaces the pinned state during sidebar navigation without adding persistent icons or changing the Explorer layout.
Before: Hovering a pinned file shows only the file path
After: Hovering a pinned file shows
path/to/file.ts (pinned)Changes
IEditorGroupsServiceintoFilesRendererisFilePinned(resource)helper that checks all editor groupsrenderStat()to set a custom tooltip title when the file is pinnedTest plan
Fixes #285850