Skip to content

Commit d950894

Browse files
jsjoeiocode-asher
andcommitted
feat: add helper header above extensions search
Add a short message above the search box on the Extensions panel. This helps explain the extension divergence to the user. If they click dismiss, it stores an item in localStorage to prevent the message from showing up on subsequent loads. Co-authored-by: Asher <ash@coder.com>
1 parent eae285c commit d950894

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

lib/vscode/src/vs/workbench/contrib/extensions/browser/extensionsViewlet.ts

+32
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,38 @@ export class ExtensionsViewPaneContainer extends ViewPaneContainer implements IE
410410
overlay.style.backgroundColor = overlayBackgroundColor;
411411
hide(overlay);
412412

413+
// NOTE@coder this UI element helps users understand the extension marketplace divergence
414+
const extensionHelperLocalStorageKey = 'coder.extension-help-message';
415+
416+
if (localStorage.getItem(extensionHelperLocalStorageKey) === null) {
417+
const helperHeader = append(this.root, $('.header'));
418+
helperHeader.id = 'codeServerMarketplaceHelper';
419+
helperHeader.style.height = 'auto';
420+
helperHeader.style.fontWeight = '600';
421+
helperHeader.style.padding = 'padding: 5px 16px';
422+
helperHeader.style.position = 'relative';
423+
helperHeader.innerHTML = `
424+
<div style="margin-bottom: 8px;">
425+
<p style="margin-bottom: 0; display: flex; align-items: center"><span class="codicon codicon-warning" style="margin-right: 2px; color: #C4A103"></span>WARNING</p>
426+
<p style="margin-top: 0; margin-bottom: 4px">
427+
These extensions are not official. Find additional open-source extensions
428+
<a href="https://open-vsx.org/" target="_blank">here</a>.
429+
See <a href="https://github.com/cdr/code-server/blob/master/doc/FAQ.md#differences-compared-to-vs-code" target="_blank">docs</a>.
430+
</p>
431+
</div>
432+
`;
433+
434+
const dismiss = append(helperHeader, $('span'));
435+
dismiss.innerHTML = 'Dismiss';
436+
dismiss.style.display = 'block';
437+
dismiss.style.textAlign = 'right';
438+
dismiss.style.cursor = 'pointer';
439+
dismiss.onclick = () => {
440+
helperHeader.remove();
441+
localStorage.setItem(extensionHelperLocalStorageKey, 'viewed');
442+
};
443+
}
444+
413445
const header = append(this.root, $('.header'));
414446
const placeholder = localize('searchExtensions', "Search Extensions in Marketplace");
415447
const searchValue = this.searchViewletState['query.value'] ? this.searchViewletState['query.value'] : '';

0 commit comments

Comments
 (0)