fix-eol-banner.patch 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. diff --git a/src/vs/workbench/browser/parts/banner/bannerPart.ts b/src/vs/workbench/browser/parts/banner/bannerPart.ts
  2. index 1f329c4..3e36bff 100644
  3. --- a/src/vs/workbench/browser/parts/banner/bannerPart.ts
  4. +++ b/src/vs/workbench/browser/parts/banner/bannerPart.ts
  5. @@ -11,3 +11,3 @@ import { InstantiationType, registerSingleton } from '../../../../platform/insta
  6. import { IInstantiationService, ServicesAccessor } from '../../../../platform/instantiation/common/instantiation.js';
  7. -import { IStorageService } from '../../../../platform/storage/common/storage.js';
  8. +import { IStorageService, StorageScope } from '../../../../platform/storage/common/storage.js';
  9. import { IThemeService } from '../../../../platform/theme/common/themeService.js';
  10. @@ -30,2 +30,3 @@ import { widgetClose } from '../../../../platform/theme/common/iconRegistry.js';
  11. import { BannerFocused } from '../../../common/contextkeys.js';
  12. +import { INeverShowAgainOptions, NeverShowAgainScope } from '../../../../platform/notification/common/notification.js';
  13. @@ -67,3 +68,3 @@ export class BannerPart extends Part implements IBannerService {
  14. @IWorkbenchLayoutService layoutService: IWorkbenchLayoutService,
  15. - @IStorageService storageService: IStorageService,
  16. + @IStorageService private readonly storageService: IStorageService,
  17. @IContextKeyService private readonly contextKeyService: IContextKeyService,
  18. @@ -187,2 +188,14 @@ export class BannerPart extends Part implements IBannerService {
  19. + if (item.neverShowAgain) {
  20. + const scope = this.toStorageScope(item.neverShowAgain);
  21. + const id = item.neverShowAgain.id;
  22. +
  23. + // If the user already picked to not show the notification
  24. + // again, we return with a no-op notification here
  25. + if (this.storageService.getBoolean(id, scope)) {
  26. + this.close(item);
  27. + return;
  28. + }
  29. + }
  30. +
  31. // Clear previous item
  32. @@ -235,2 +248,15 @@ export class BannerPart extends Part implements IBannerService {
  33. + private toStorageScope(options: INeverShowAgainOptions): StorageScope {
  34. + switch (options.scope) {
  35. + case NeverShowAgainScope.APPLICATION:
  36. + return StorageScope.APPLICATION;
  37. + case NeverShowAgainScope.PROFILE:
  38. + return StorageScope.PROFILE;
  39. + case NeverShowAgainScope.WORKSPACE:
  40. + return StorageScope.WORKSPACE;
  41. + default:
  42. + return StorageScope.APPLICATION;
  43. + }
  44. + }
  45. +
  46. toJSON(): object {
  47. diff --git a/src/vs/workbench/services/banner/browser/bannerService.ts b/src/vs/workbench/services/banner/browser/bannerService.ts
  48. index 2db0fa4..d179055 100644
  49. --- a/src/vs/workbench/services/banner/browser/bannerService.ts
  50. +++ b/src/vs/workbench/services/banner/browser/bannerService.ts
  51. @@ -10,2 +10,3 @@ import { ILinkDescriptor } from '../../../../platform/opener/browser/link.js';
  52. import { ThemeIcon } from '../../../../base/common/themables.js';
  53. +import { INeverShowAgainOptions } from '../../../../platform/notification/common/notification.js';
  54. @@ -18,2 +19,3 @@ export interface IBannerItem {
  55. readonly onClose?: () => void;
  56. + readonly neverShowAgain?: INeverShowAgainOptions;
  57. readonly closeLabel?: string;