Skip to content

feat: surface pinned editor state in Explorer file tooltip#301674

Open
murataslan1 wants to merge 1 commit intomicrosoft:mainfrom
murataslan1:feat/explorer-pinned-tooltip
Open

feat: surface pinned editor state in Explorer file tooltip#301674
murataslan1 wants to merge 1 commit intomicrosoft:mainfrom
murataslan1:feat/explorer-pinned-tooltip

Conversation

@murataslan1
Copy link
Contributor

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

  • Inject IEditorGroupsService into FilesRenderer
  • Add isFilePinned(resource) helper that checks all editor groups
  • Modify renderStat() to set a custom tooltip title when the file is pinned
  • Uses plain string format for full compatibility with decoration tooltip concatenation

Test plan

  • Pin a file in an editor group → hover it in Explorer → verify tooltip shows "(pinned)"
  • Unpin the file → re-navigate in Explorer to trigger re-render → verify "(pinned)" is gone
  • Pin the same file in multiple groups → verify still shows "(pinned)"
  • Hover a file that is not open in any editor → verify normal tooltip (path only)
  • Hover a directory → verify no "(pinned)" indicator (directories are excluded)

Fixes #285850

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
Copilot AI review requested due to automatic review settings March 14, 2026 08:30
@vs-code-engineering
Copy link

📬 CODENOTIFY

The following users are being notified based on files changed in this PR:

@bpasero

Matched files:

  • src/vs/workbench/contrib/files/browser/views/explorerViewer.ts

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 IEditorGroupsService into FilesRenderer.
  • Adds isFilePinned(resource) to detect pinned editors across groups.
  • Sets a custom title in renderStat() so pinned files show path (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")})`;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Surface pinned editor state on hover when navigating files via Explorer

3 participants