mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-03-17 17:41:24 -07:00
Co-authored-by: Adam Weidman <65992621+adamfweidman@users.noreply.github.com> Co-authored-by: Sehoon Shon <sshon@google.com> Co-authored-by: Adib234 <30782825+Adib234@users.noreply.github.com> Co-authored-by: Sandy Tao <sandytao520@icloud.com> Co-authored-by: Abhi <43648792+abhipatel12@users.noreply.github.com> Co-authored-by: Aishanee Shah <aishaneeshah@gmail.com> Co-authored-by: gemini-cli-robot <gemini-cli-robot@google.com> Co-authored-by: Gal Zahavi <38544478+galz10@users.noreply.github.com> Co-authored-by: Jacob Richman <jacob314@gmail.com> Co-authored-by: joshualitt <joshualitt@google.com> Co-authored-by: Jenna Inouye <jinouye@google.com>
57 lines
1.3 KiB
TypeScript
57 lines
1.3 KiB
TypeScript
/**
|
|
* @license
|
|
* Copyright 2025 Google LLC
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
import {
|
|
allowEditorTypeInSandbox,
|
|
checkHasEditorType,
|
|
type EditorType,
|
|
EDITOR_DISPLAY_NAMES,
|
|
} from '@google/gemini-cli-core';
|
|
|
|
export interface EditorDisplay {
|
|
name: string;
|
|
type: EditorType | 'not_set';
|
|
disabled: boolean;
|
|
}
|
|
|
|
class EditorSettingsManager {
|
|
private readonly availableEditors: EditorDisplay[];
|
|
|
|
constructor() {
|
|
const editorTypes = Object.keys(
|
|
EDITOR_DISPLAY_NAMES,
|
|
).sort() as EditorType[];
|
|
this.availableEditors = [
|
|
{
|
|
name: 'None',
|
|
type: 'not_set',
|
|
disabled: false,
|
|
},
|
|
...editorTypes.map((type) => {
|
|
const hasEditor = checkHasEditorType(type);
|
|
const isAllowedInSandbox = allowEditorTypeInSandbox(type);
|
|
|
|
let labelSuffix = !isAllowedInSandbox
|
|
? ' (Not available in sandbox)'
|
|
: '';
|
|
labelSuffix = !hasEditor ? ' (Not installed)' : labelSuffix;
|
|
|
|
return {
|
|
name: EDITOR_DISPLAY_NAMES[type] + labelSuffix,
|
|
type,
|
|
disabled: !hasEditor || !isAllowedInSandbox,
|
|
};
|
|
}),
|
|
];
|
|
}
|
|
|
|
getAvailableEditorDisplays(): EditorDisplay[] {
|
|
return this.availableEditors;
|
|
}
|
|
}
|
|
|
|
export const editorSettingsManager = new EditorSettingsManager();
|