feat: open settings in new full tab similar to VSCode

- Added new openSettingsInNewTab function to create dedicated webview panel for settings
- Updated settings button click handler to open settings in new tab instead of within extension
- Added localized 'Roo Code Settings' title for the new settings tab
- Settings now open in a full VSCode tab with proper state management
- All localization files updated with new tabTitle key
This commit is contained in:
Roo Code 2025-09-23 09:55:43 +00:00
parent 12f94fc727
commit d46cdca142
19 changed files with 101 additions and 9 deletions

View file

@ -130,17 +130,10 @@ const getCommandsMap = ({ context, outputChannel, provider }: RegisterCommandOpt
},
openInNewTab: () => openClineInNewTab({ context, outputChannel }),
settingsButtonClicked: () => {
const visibleProvider = getVisibleProviderOrLog(outputChannel)
if (!visibleProvider) {
return
}
TelemetryService.instance.captureTitleButtonClicked("settings")
visibleProvider.postMessageToWebview({ type: "action", action: "settingsButtonClicked" })
// Also explicitly post the visibility message to trigger scroll reliably
visibleProvider.postMessageToWebview({ type: "action", action: "didBecomeVisible" })
// Open settings in a new tab instead of within the extension
return openSettingsInNewTab({ context, outputChannel })
},
historyButtonClicked: () => {
const visibleProvider = getVisibleProviderOrLog(outputChannel)
@ -310,3 +303,84 @@ export const openClineInNewTab = async ({ context, outputChannel }: Omit<Registe
return tabProvider
}
export const openSettingsInNewTab = async ({ context, outputChannel }: Omit<RegisterCommandOptions, "provider">) => {
const contextProxy = await ContextProxy.getInstance(context)
// Get the existing MDM service instance to ensure consistent policy enforcement
let mdmService: MdmService | undefined
try {
mdmService = MdmService.getInstance()
} catch (error) {
// MDM service not initialized, which is fine - extension can work without it
mdmService = undefined
}
const tabProvider = new ClineProvider(context, outputChannel, "editor", contextProxy, mdmService)
const lastCol = Math.max(...vscode.window.visibleTextEditors.map((editor) => editor.viewColumn || 0))
// Check if there are any visible text editors, otherwise open a new group
// to the right.
const hasVisibleEditors = vscode.window.visibleTextEditors.length > 0
if (!hasVisibleEditors) {
await vscode.commands.executeCommand("workbench.action.newGroupRight")
}
const targetCol = hasVisibleEditors ? Math.max(lastCol + 1, 1) : vscode.ViewColumn.Two
// Get the localized title for the settings tab
const settingsTitle = t("settings:tabTitle") || "Roo Code Settings"
const newPanel = vscode.window.createWebviewPanel(
"rooCodeSettings", // Unique ID for settings panel
settingsTitle,
targetCol,
{
enableScripts: true,
retainContextWhenHidden: true,
localResourceRoots: [context.extensionUri],
},
)
// Save as tab type panel.
setPanel(newPanel, "tab")
// Use the same icon as the main panel
newPanel.iconPath = {
light: vscode.Uri.joinPath(context.extensionUri, "assets", "icons", "panel_light.png"),
dark: vscode.Uri.joinPath(context.extensionUri, "assets", "icons", "panel_dark.png"),
}
await tabProvider.resolveWebviewView(newPanel)
// Immediately send a message to open the settings view
newPanel.webview.postMessage({ type: "action", action: "settingsButtonClicked" })
// Add listener for visibility changes to notify webview
newPanel.onDidChangeViewState(
(e) => {
const panel = e.webviewPanel
if (panel.visible) {
panel.webview.postMessage({ type: "action", action: "didBecomeVisible" })
}
},
null,
context.subscriptions,
)
// Handle panel closing events.
newPanel.onDidDispose(
() => {
setPanel(undefined, "tab")
},
null,
context.subscriptions,
)
// Lock the editor group so clicking on files doesn't open them over the panel.
await delay(100)
await vscode.commands.executeCommand("workbench.action.lockEditorGroup")
return tabProvider
}

View file

@ -8,6 +8,7 @@
"add": "Afegir capçalera",
"remove": "Eliminar"
},
"tabTitle": "Roo Code Settings",
"header": {
"title": "Configuració",
"saveButtonTooltip": "Desar canvis",

View file

@ -8,6 +8,7 @@
"add": "Header hinzufügen",
"remove": "Entfernen"
},
"tabTitle": "Roo Code Settings",
"header": {
"title": "Einstellungen",
"saveButtonTooltip": "Änderungen speichern",

View file

@ -8,6 +8,7 @@
"add": "Add Header",
"remove": "Remove"
},
"tabTitle": "Roo Code Settings",
"header": {
"title": "Settings",
"saveButtonTooltip": "Save changes",

View file

@ -8,6 +8,7 @@
"add": "Añadir encabezado",
"remove": "Eliminar"
},
"tabTitle": "Roo Code Settings",
"header": {
"title": "Configuración",
"saveButtonTooltip": "Guardar cambios",

View file

@ -8,6 +8,7 @@
"add": "Ajouter un en-tête",
"remove": "Supprimer"
},
"tabTitle": "Roo Code Settings",
"header": {
"title": "Paramètres",
"saveButtonTooltip": "Enregistrer les modifications",

View file

@ -8,6 +8,7 @@
"add": "हेडर जोड़ें",
"remove": "हटाएं"
},
"tabTitle": "Roo Code Settings",
"header": {
"title": "सेटिंग्स",
"saveButtonTooltip": "परिवर्तन सहेजें",

View file

@ -8,6 +8,7 @@
"add": "Tambah Header",
"remove": "Hapus"
},
"tabTitle": "Roo Code Settings",
"header": {
"title": "Pengaturan",
"saveButtonTooltip": "Simpan perubahan",

View file

@ -8,6 +8,7 @@
"add": "Aggiungi intestazione",
"remove": "Rimuovi"
},
"tabTitle": "Roo Code Settings",
"header": {
"title": "Impostazioni",
"saveButtonTooltip": "Salva modifiche",

View file

@ -8,6 +8,7 @@
"add": "ヘッダーを追加",
"remove": "削除"
},
"tabTitle": "Roo Code Settings",
"header": {
"title": "設定",
"saveButtonTooltip": "変更を保存",

View file

@ -8,6 +8,7 @@
"add": "헤더 추가",
"remove": "삭제"
},
"tabTitle": "Roo Code Settings",
"header": {
"title": "설정",
"saveButtonTooltip": "변경 사항 저장",

View file

@ -8,6 +8,7 @@
"add": "Header toevoegen",
"remove": "Verwijderen"
},
"tabTitle": "Roo Code Settings",
"header": {
"title": "Instellingen",
"saveButtonTooltip": "Wijzigingen opslaan",

View file

@ -8,6 +8,7 @@
"add": "Dodaj nagłówek",
"remove": "Usuń"
},
"tabTitle": "Roo Code Settings",
"header": {
"title": "Ustawienia",
"saveButtonTooltip": "Zapisz zmiany",

View file

@ -8,6 +8,7 @@
"add": "Adicionar cabeçalho",
"remove": "Remover"
},
"tabTitle": "Roo Code Settings",
"header": {
"title": "Configurações",
"saveButtonTooltip": "Salvar alterações",

View file

@ -8,6 +8,7 @@
"add": "Добавить заголовок",
"remove": "Удалить"
},
"tabTitle": "Roo Code Settings",
"header": {
"title": "Настройки",
"saveButtonTooltip": "Сохранить изменения",

View file

@ -8,6 +8,7 @@
"add": "Başlık Ekle",
"remove": "Kaldır"
},
"tabTitle": "Roo Code Settings",
"header": {
"title": "Ayarlar",
"saveButtonTooltip": "Değişiklikleri kaydet",

View file

@ -8,6 +8,7 @@
"add": "Thêm tiêu đề",
"remove": "Xóa"
},
"tabTitle": "Roo Code Settings",
"header": {
"title": "Cài đặt",
"saveButtonTooltip": "Lưu thay đổi",

View file

@ -8,6 +8,7 @@
"add": "添加标头",
"remove": "移除"
},
"tabTitle": "Roo Code Settings",
"header": {
"title": "设置",
"saveButtonTooltip": "保存更改",

View file

@ -8,6 +8,7 @@
"add": "新增標頭",
"remove": "移除"
},
"tabTitle": "Roo Code Settings",
"header": {
"title": "設定",
"saveButtonTooltip": "儲存變更",