Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add dummy preference descriptions to open AI config widget #15166

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion packages/ai-ide/src/browser/workspace-preferences.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
)
},
}
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
// *****************************************************************************
// Copyright (C) 2025 Eclipse GmbH and others.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// Copyright (C) 2025 Eclipse GmbH and others.
// Copyright (C) 2025 EclipseSource 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<null, HTMLElement> {
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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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();
Expand Down
Loading