This commit is contained in:
Deleted user 2026-05-27 10:05:34 +08:00 committed by GitHub
commit 16a53bcaba
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
21 changed files with 87 additions and 0 deletions

View file

@ -35,6 +35,7 @@ export const commandIds = [
"settingsButtonClicked",
"openInNewTab",
"openInCurrentTab",
"newTask",

View file

@ -88,6 +88,7 @@ const getCommandsMap = ({ context, outputChannel, provider }: RegisterCommandOpt
return openClineInNewTab({ context, outputChannel })
},
openInNewTab: () => openClineInNewTab({ context, outputChannel }),
openInCurrentTab: () => openClineInCurrentTab({ context, outputChannel }),
settingsButtonClicked: () => {
const visibleProvider = getVisibleProviderOrLog(outputChannel)
@ -237,3 +238,65 @@ export const openClineInNewTab = async ({ context, outputChannel }: Omit<Registe
return tabProvider
}
export const openClineInCurrentTab = async ({ context, outputChannel }: Omit<RegisterCommandOptions, "provider">) => {
const contextProxy = await ContextProxy.getInstance(context)
const codeIndexManager = CodeIndexManager.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)
// Use ViewColumn.Active to open in the current editor column instead of creating a new split
const targetCol = vscode.ViewColumn.Active
const newPanel = vscode.window.createWebviewPanel(ClineProvider.tabPanelId, "Roo Code", targetCol, {
enableScripts: true,
retainContextWhenHidden: true,
localResourceRoots: [context.extensionUri],
})
// Save as tab type panel.
setPanel(newPanel, "tab")
// TODO: Use better svg icon with light and dark variants (see
// https://stackoverflow.com/questions/58365687/vscode-extension-iconpath).
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)
// 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,
)
// Do NOT lock the editor group - allow files to open over the panel like normal tabs
return tabProvider
}

View file

@ -95,6 +95,11 @@
"title": "%command.openInNewTab.title%",
"category": "%configuration.title%"
},
{
"command": "roo-cline.openInCurrentTab",
"title": "%command.openInCurrentTab.title%",
"category": "%configuration.title%"
},
{
"command": "roo-cline.explainCode",
"title": "%command.explainCode.title%",

View file

@ -7,6 +7,7 @@
"command.improveCode.title": "Millorar Codi",
"command.addToContext.title": "Afegir al Context",
"command.openInNewTab.title": "Obrir en una Nova Pestanya",
"command.openInCurrentTab.title": "Obrir a la Pestanya Actual",
"command.focusInput.title": "Enfocar Camp d'Entrada",
"command.setCustomStoragePath.title": "Establir Ruta d'Emmagatzematge Personalitzada",
"command.importSettings.title": "Importar Configuració",

View file

@ -7,6 +7,7 @@
"command.improveCode.title": "Code Verbessern",
"command.addToContext.title": "Zum Kontext Hinzufügen",
"command.openInNewTab.title": "In Neuem Tab Öffnen",
"command.openInCurrentTab.title": "Im Aktuellen Tab Öffnen",
"command.focusInput.title": "Eingabefeld Fokussieren",
"command.setCustomStoragePath.title": "Benutzerdefinierten Speicherpfad Festlegen",
"command.importSettings.title": "Einstellungen Importieren",

View file

@ -7,6 +7,7 @@
"command.improveCode.title": "Mejorar Código",
"command.addToContext.title": "Añadir al Contexto",
"command.openInNewTab.title": "Abrir en Nueva Pestaña",
"command.openInCurrentTab.title": "Abrir en Pestaña Actual",
"command.focusInput.title": "Enfocar Campo de Entrada",
"command.setCustomStoragePath.title": "Establecer Ruta de Almacenamiento Personalizada",
"command.importSettings.title": "Importar Configuración",

View file

@ -7,6 +7,7 @@
"command.improveCode.title": "Améliorer le Code",
"command.addToContext.title": "Ajouter au Contexte",
"command.openInNewTab.title": "Ouvrir dans un Nouvel Onglet",
"command.openInCurrentTab.title": "Ouvrir dans l'Onglet Actuel",
"command.focusInput.title": "Focus sur le Champ de Saisie",
"command.setCustomStoragePath.title": "Définir le Chemin de Stockage Personnalisé",
"command.importSettings.title": "Importer les Paramètres",

View file

@ -7,6 +7,7 @@
"command.improveCode.title": "कोड सुधारें",
"command.addToContext.title": "संदर्भ में जोड़ें",
"command.openInNewTab.title": "नए टैब में खोलें",
"command.openInCurrentTab.title": "वर्तमान टैब में खोलें",
"command.focusInput.title": "इनपुट फ़ील्ड पर फोकस करें",
"command.setCustomStoragePath.title": "कस्टम स्टोरेज पाथ सेट करें",
"command.importSettings.title": "सेटिंग्स इम्पोर्ट करें",

View file

@ -11,6 +11,7 @@
"command.settings.title": "Pengaturan",
"command.documentation.title": "Dokumentasi",
"command.openInNewTab.title": "Buka di Tab Baru",
"command.openInCurrentTab.title": "Buka di Tab Saat Ini",
"command.explainCode.title": "Jelaskan Kode",
"command.fixCode.title": "Perbaiki Kode",
"command.improveCode.title": "Tingkatkan Kode",

View file

@ -7,6 +7,7 @@
"command.improveCode.title": "Migliora Codice",
"command.addToContext.title": "Aggiungi al Contesto",
"command.openInNewTab.title": "Apri in Nuova Scheda",
"command.openInCurrentTab.title": "Apri nella Scheda Corrente",
"command.focusInput.title": "Focalizza Campo di Input",
"command.setCustomStoragePath.title": "Imposta Percorso di Archiviazione Personalizzato",
"command.importSettings.title": "Importa Impostazioni",

View file

@ -11,6 +11,7 @@
"command.settings.title": "設定",
"command.documentation.title": "ドキュメント",
"command.openInNewTab.title": "新しいタブで開く",
"command.openInCurrentTab.title": "現在のタブで開く",
"command.explainCode.title": "コードの説明",
"command.fixCode.title": "コードの修正",
"command.improveCode.title": "コードの改善",

View file

@ -11,6 +11,7 @@
"command.settings.title": "Settings",
"command.documentation.title": "Documentation",
"command.openInNewTab.title": "Open In New Tab",
"command.openInCurrentTab.title": "Open In Current Tab",
"command.explainCode.title": "Explain Code",
"command.fixCode.title": "Fix Code",
"command.improveCode.title": "Improve Code",

View file

@ -7,6 +7,7 @@
"command.improveCode.title": "코드 개선",
"command.addToContext.title": "컨텍스트에 추가",
"command.openInNewTab.title": "새 탭에서 열기",
"command.openInCurrentTab.title": "현재 탭에서 열기",
"command.focusInput.title": "입력 필드 포커스",
"command.setCustomStoragePath.title": "사용자 지정 저장소 경로 설정",
"command.importSettings.title": "설정 가져오기",

View file

@ -11,6 +11,7 @@
"command.settings.title": "Instellingen",
"command.documentation.title": "Documentatie",
"command.openInNewTab.title": "Openen in Nieuw Tabblad",
"command.openInCurrentTab.title": "Openen in Huidig Tabblad",
"command.explainCode.title": "Leg Code Uit",
"command.fixCode.title": "Repareer Code",
"command.improveCode.title": "Verbeter Code",

View file

@ -7,6 +7,7 @@
"command.improveCode.title": "Ulepsz Kod",
"command.addToContext.title": "Dodaj do Kontekstu",
"command.openInNewTab.title": "Otwórz w Nowej Karcie",
"command.openInCurrentTab.title": "Otwórz w Bieżącej Karcie",
"command.focusInput.title": "Fokus na Pole Wprowadzania",
"command.setCustomStoragePath.title": "Ustaw Niestandardową Ścieżkę Przechowywania",
"command.importSettings.title": "Importuj Ustawienia",

View file

@ -7,6 +7,7 @@
"command.improveCode.title": "Melhorar Código",
"command.addToContext.title": "Adicionar ao Contexto",
"command.openInNewTab.title": "Abrir em Nova Aba",
"command.openInCurrentTab.title": "Abrir na Aba Atual",
"command.focusInput.title": "Focar Campo de Entrada",
"command.setCustomStoragePath.title": "Definir Caminho de Armazenamento Personalizado",
"command.importSettings.title": "Importar Configurações",

View file

@ -11,6 +11,7 @@
"command.settings.title": "Настройки",
"command.documentation.title": "Документация",
"command.openInNewTab.title": "Открыть в новой вкладке",
"command.openInCurrentTab.title": "Открыть в текущей вкладке",
"command.explainCode.title": "Объяснить код",
"command.fixCode.title": "Исправить код",
"command.improveCode.title": "Улучшить код",

View file

@ -7,6 +7,7 @@
"command.improveCode.title": "Kodu İyileştir",
"command.addToContext.title": "Bağlama Ekle",
"command.openInNewTab.title": "Yeni Sekmede Aç",
"command.openInCurrentTab.title": "Mevcut Sekmede Aç",
"command.focusInput.title": "Giriş Alanına Odaklan",
"command.setCustomStoragePath.title": "Özel Depolama Yolunu Ayarla",
"command.importSettings.title": "Ayarları İçe Aktar",

View file

@ -7,6 +7,7 @@
"command.improveCode.title": "Cải Thiện Mã",
"command.addToContext.title": "Thêm vào Ngữ Cảnh",
"command.openInNewTab.title": "Mở trong Tab Mới",
"command.openInCurrentTab.title": "Mở trong Tab Hiện Tại",
"command.focusInput.title": "Tập Trung vào Trường Nhập",
"command.setCustomStoragePath.title": "Đặt Đường Dẫn Lưu Trữ Tùy Chỉnh",
"command.importSettings.title": "Nhập Cài Đặt",

View file

@ -7,6 +7,7 @@
"command.improveCode.title": "改进代码",
"command.addToContext.title": "添加到上下文",
"command.openInNewTab.title": "在新标签页中打开",
"command.openInCurrentTab.title": "在当前标签页中打开",
"command.focusInput.title": "聚焦输入框",
"command.setCustomStoragePath.title": "设置自定义存储路径",
"command.importSettings.title": "导入设置",

View file

@ -7,6 +7,7 @@
"command.improveCode.title": "改進程式碼",
"command.addToContext.title": "新增到上下文",
"command.openInNewTab.title": "在新分頁中開啟",
"command.openInCurrentTab.title": "在當前分頁中開啟",
"command.focusInput.title": "聚焦輸入框",
"command.setCustomStoragePath.title": "設定自訂儲存路徑",
"command.importSettings.title": "匯入設定",