wishforge-ide/apps/ide/policy/plugin-install-frontend.cjs
eust-w 0ef99b1e6d style: add Prettier and EditorConfig, format the codebase
Adds prettier 3.9.8 (exact) with a shared config (single quotes,
120 columns, trailing commas), .prettierignore, .editorconfig and the
`format` / `format:check` scripts, then formats all TypeScript,
JavaScript, CSS, JSON and YAML sources.

Purely mechanical: no behaviour change. Typecheck passes, the vitest
suite and the 74 IDE node tests produce the same results as before
(socket-binding tests still cannot run inside this sandbox).
Previously the longest source line was ~3000 characters; reviewing the
following semantic changes now produces readable diffs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 13:32:43 +08:00

42 lines
1.9 KiB
JavaScript

'use strict';
const { injectable, inject } = require('@theia/core/shared/inversify');
const { WidgetManager } = require('@theia/core/lib/browser/widget-manager');
const { FrontendApplicationContribution } = require('@theia/core/lib/browser/frontend-application-contribution');
const React = require('@theia/core/shared/react');
class ManagedExtensionsNotice {
onStart() {
const label = widget => {
if (widget.id !== 'vsx-extensions-view-container') return;
widget.title.label = 'Extensions · 管理员管理';
widget.title.caption = '扩展由管理员固定版本安装。可查看已安装扩展;安装、更新与移除须通过平台镜像发布。';
// ViewContainer restores its title from saved layout/part titles. Put the
// durable notice in the extension search widget as well as the caption.
if (!widget.searchBar || widget.searchBar.wishforgeManagedNotice) return;
const search = widget.searchBar;
search.wishforgeManagedNotice = true;
const render = search.render.bind(search);
search.render = () =>
React.createElement(
'div',
{ style: { width: '100%' } },
React.createElement(
'p',
{ style: { margin: '0 0 8px', fontSize: '12px', lineHeight: '1.6' } },
'扩展由管理员管理。安装与更新须通过平台镜像发布。',
),
render(),
);
search.update();
};
this.widgets.getWidgets('vsx-extensions-view-container').forEach(label);
this.widgets.onDidCreateWidget(({ widget }) => label(widget));
}
}
injectable()(ManagedExtensionsNotice);
inject(WidgetManager)(ManagedExtensionsNotice.prototype, 'widgets');
function bindManagedExtensionNotice(bind) {
bind(ManagedExtensionsNotice).toSelf().inSingletonScope();
bind(FrontendApplicationContribution).toService(ManagedExtensionsNotice);
}
module.exports = { bindManagedExtensionNotice };