Custom tooltip on the remote indicator. Fixes #126494

This commit is contained in:
Martin Aeschlimann
2021-06-16 17:47:51 +02:00
parent 99f4201e20
commit fe850fbb57
7 changed files with 60 additions and 35 deletions

View File

@@ -83,6 +83,10 @@ class ResourceLabelFormattersHandler implements IWorkbenchContribution {
constructor(@ILabelService labelService: ILabelService) {
resourceLabelFormattersExtPoint.setHandler((extensions, delta) => {
delta.added.forEach(added => added.value.forEach(formatter => {
if (!added.description.enableProposedApi && formatter.formatting.workspaceTooltip) {
// workspaceTooltip is only proposed
formatter.formatting.workspaceTooltip = undefined;
}
this.formattersDisposables.set(formatter, labelService.registerFormatter(formatter));
}));
delta.removed.forEach(removed => removed.value.forEach(formatter => {
@@ -249,6 +253,11 @@ export class LabelService extends Disposable implements ILabelService {
return formatter?.workspaceSuffix || '';
}
getHostTooltip(scheme: string, authority?: string): string | undefined {
const formatter = this.findFormatting(URI.from({ scheme, authority }));
return formatter?.workspaceTooltip;
}
registerFormatter(formatter: ResourceLabelFormatter): IDisposable {
this.formatters.push(formatter);
this._onDidChangeFormatters.fire({ scheme: formatter.scheme });