-
Notifications
You must be signed in to change notification settings - Fork 33.4k
Make symbol link icon to be refreshed correctly #168707
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -57,6 +57,11 @@ export interface IResourceLabelOptions extends IIconLabelValueOptions { | |
* Will take the provided label as is and e.g. not override it for untitled files. | ||
*/ | ||
readonly forceLabel?: boolean; | ||
|
||
/** | ||
* Whether this resource is a symbolic link. | ||
*/ | ||
readonly isSymbolicLink?: boolean; | ||
} | ||
|
||
export interface IFileLabelOptions extends IResourceLabelOptions { | ||
|
@@ -456,6 +461,7 @@ class ResourceLabelWidget extends IconLabel { | |
} | ||
} | ||
|
||
const hasIsSymbolicLinkChanged = this.hasIsSymbolicLinkChanged(options); | ||
const hasResourceChanged = this.hasResourceChanged(label); | ||
const hasPathLabelChanged = hasResourceChanged || this.hasPathLabelChanged(label); | ||
const hasFileKindChanged = this.hasFileKindChanged(options); | ||
|
@@ -472,11 +478,18 @@ class ResourceLabelWidget extends IconLabel { | |
} | ||
|
||
this.render({ | ||
updateIcon: hasResourceChanged || hasFileKindChanged, | ||
updateDecoration: hasResourceChanged || hasFileKindChanged | ||
updateIcon: hasResourceChanged || hasFileKindChanged || hasIsSymbolicLinkChanged, | ||
updateDecoration: hasResourceChanged || hasFileKindChanged || hasIsSymbolicLinkChanged | ||
}); | ||
} | ||
|
||
private hasIsSymbolicLinkChanged(newOptions?: IResourceLabelOptions): boolean { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
const isNewSymbolicLink = newOptions?.isSymbolicLink; | ||
const isOldSymbolicLink = this.options?.isSymbolicLink; | ||
|
||
return isNewSymbolicLink !== isOldSymbolicLink; | ||
} | ||
|
||
private hasFileKindChanged(newOptions?: IResourceLabelOptions): boolean { | ||
const newFileKind = newOptions?.fileKind; | ||
const oldFileKind = this.options?.fileKind; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,7 @@ import { DisposableStore } from 'vs/base/common/lifecycle'; | |
import { explorerRootErrorEmitter } from 'vs/workbench/contrib/files/browser/views/explorerViewer'; | ||
import { ExplorerItem } from 'vs/workbench/contrib/files/common/explorerModel'; | ||
import { IExplorerService } from 'vs/workbench/contrib/files/browser/files'; | ||
import { IFileService } from 'vs/platform/files/common/files'; | ||
|
||
export function provideDecorations(fileStat: ExplorerItem): IDecorationData | undefined { | ||
if (fileStat.isRoot && fileStat.isError) { | ||
|
@@ -50,7 +51,8 @@ export class ExplorerDecorationsProvider implements IDecorationsProvider { | |
|
||
constructor( | ||
@IExplorerService private explorerService: IExplorerService, | ||
@IWorkspaceContextService contextService: IWorkspaceContextService | ||
@IWorkspaceContextService contextService: IWorkspaceContextService, | ||
@IFileService fileService: IFileService, | ||
) { | ||
this.toDispose.add(this._onDidChange); | ||
this.toDispose.add(contextService.onDidChangeWorkspaceFolders(e => { | ||
|
@@ -59,6 +61,9 @@ export class ExplorerDecorationsProvider implements IDecorationsProvider { | |
this.toDispose.add(explorerRootErrorEmitter.event((resource => { | ||
this._onDidChange.fire([resource]); | ||
}))); | ||
this.toDispose.add(fileService.onDidFilesChange(e => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This event can fire thousands of times at the same time for thousands of files, so whoever is listening needs to be checked for perf bottlenecks if that happens. |
||
this._onDidChange.fire([...e.rawAdded, ...e.rawUpdated]); | ||
})); | ||
} | ||
|
||
get onDidChange(): Event<URI[]> { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hasSymbolicLinkChanged
?