From 1ff9e0947e0cba5dd74197a624533fc189facfaa Mon Sep 17 00:00:00 2001 From: Colin Grant Date: Tue, 11 Mar 2025 09:47:44 -0600 Subject: [PATCH 1/2] Add descriptions to open AI config widget --- .../src/browser/workspace-preferences.ts | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/packages/ai-ide/src/browser/workspace-preferences.ts b/packages/ai-ide/src/browser/workspace-preferences.ts index 73591df4384e3..ec380825e21bc 100644 --- a/packages/ai-ide/src/browser/workspace-preferences.ts +++ b/packages/ai-ide/src/browser/workspace-preferences.ts @@ -38,6 +38,27 @@ export const WorkspacePreferencesSchema: PreferenceSchema = { items: { type: 'string' } - } + }, + 'ai-features.agents.details': { + type: 'null', + markdownDescription: nls.localize('theia/ai/ide/agent-description', + 'Additional settings for AI agents can be configured using the [AI Configuration View]({0}).', + 'command:aiConfiguration:open' + ) + }, + 'ai-features.promptTemplates.details': { + type: 'null', + markdownDescription: nls.localize('theia/ai/ide/prompt-template-description', + 'Additional AI prompt template settings can be configured using the [AI Configuration View]({0}).', + 'command:aiConfiguration:open' + ) + }, + 'ai-features.models.details': { + type: 'null', + markdownDescription: nls.localize('theia/ai/ide/prompt-template-description', + 'Additional settings for AI models can be configured using the [AI Configuration View]({0}).', + 'command:aiConfiguration:open' + ) + }, } }; From 9e342693ecdb1cfd8c90f92bb7af51e61ab6e119 Mon Sep 17 00:00:00 2001 From: Colin Grant Date: Wed, 12 Mar 2025 23:07:31 -0600 Subject: [PATCH 2/2] Null renderer with no interactable --- .../views/components/preference-null-input.ts | 52 +++++++++++++++++++ .../views/preference-widget-bindings.ts | 3 ++ 2 files changed, 55 insertions(+) create mode 100644 packages/preferences/src/browser/views/components/preference-null-input.ts diff --git a/packages/preferences/src/browser/views/components/preference-null-input.ts b/packages/preferences/src/browser/views/components/preference-null-input.ts new file mode 100644 index 0000000000000..3ca4f32962886 --- /dev/null +++ b/packages/preferences/src/browser/views/components/preference-null-input.ts @@ -0,0 +1,52 @@ +// ***************************************************************************** +// Copyright (C) 2025 Eclipse GmbH and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { injectable, interfaces } from '@theia/core/shared/inversify'; +import { PreferenceLeafNodeRenderer, PreferenceNodeRenderer } from './preference-node-renderer'; +import { Preference } from '../../util/preference-types'; +import { PreferenceLeafNodeRendererContribution } from './preference-node-renderer-creator'; + +@injectable() +/** For rendering preference items for which the only interesting feature is the description */ +export class PreferenceNullInputRenderer extends PreferenceLeafNodeRenderer { + protected override createInteractable(container: HTMLElement): void { + const span = document.createElement('span'); + this.interactable = span; + container.appendChild(span); + } + + protected override getFallbackValue(): null { + // eslint-disable-next-line no-null/no-null + return null; + } + + protected override doHandleValueChange(): void { } +} + +@injectable() +export class PreferenceNullRendererContribution extends PreferenceLeafNodeRendererContribution { + static ID = 'preference-null-renderer'; + id = PreferenceNullRendererContribution.ID; + + canHandleLeafNode(node: Preference.LeafNode): number { + const isOnlyNull = node.preference.data.type === 'null' || Array.isArray(node.preference.data.type) && node.preference.data.type.every(candidate => candidate === 'null'); + return isOnlyNull ? 5 : 0; + } + + createLeafNodeRenderer(container: interfaces.Container): PreferenceNodeRenderer { + return container.get(PreferenceNullInputRenderer); + } +} diff --git a/packages/preferences/src/browser/views/preference-widget-bindings.ts b/packages/preferences/src/browser/views/preference-widget-bindings.ts index 926893f74ad96..fe2fc680d5fe1 100644 --- a/packages/preferences/src/browser/views/preference-widget-bindings.ts +++ b/packages/preferences/src/browser/views/preference-widget-bindings.ts @@ -36,6 +36,7 @@ import { PreferencesScopeTabBar } from './preference-scope-tabbar-widget'; import { PreferencesSearchbarWidget } from './preference-searchbar-widget'; import { PreferencesTreeWidget } from './preference-tree-widget'; import { PreferencesWidget } from './preference-widget'; +import { PreferenceNullInputRenderer, PreferenceNullRendererContribution } from './components/preference-null-input'; export function bindPreferencesWidgets(bind: interfaces.Bind): void { bind(PreferenceTreeLabelProvider).toSelf().inSingletonScope(); @@ -58,6 +59,8 @@ export function bindPreferencesWidgets(bind: interfaces.Bind): void { bind(PreferenceStringInputRenderer).toSelf(); bind(PreferenceNodeRendererContribution).to(PreferenceStringInputRendererContribution).inSingletonScope(); + bind(PreferenceNullInputRenderer).toSelf(); + bind(PreferenceNodeRendererContribution).to(PreferenceNullRendererContribution).inSingletonScope(); bind(PreferenceBooleanInputRenderer).toSelf(); bind(PreferenceNodeRendererContribution).to(PreferenceBooleanInputRendererContribution).inSingletonScope();