Skip to content

Commit e433ff1

Browse files
committed
Add port forwarding action to remote browser warning message
- the notification [Fragment] should show 'Forward port' button, and open scrolled settings to `WEB > Remote machines`
1 parent bc7ec71 commit e433ff1

2 files changed

Lines changed: 32 additions & 3 deletions

File tree

‎apps/editor/src/i18n/translations/views/prompt/handlers/handle-run-browser.ts‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,22 @@
11
export const translations = {
2+
'views.prompt.handlers.handle-run-browser.forward-port': {
3+
en: 'Forward port',
4+
pl: 'Przekieruj port',
5+
'zh-cn': '转发端口',
6+
ja: 'ポートを転送',
7+
'zh-tw': '轉發通訊埠',
8+
de: 'Port weiterleiten',
9+
es: 'Reenviar puerto',
10+
fr: 'Transférer le port',
11+
'pt-br': 'Encaminhar porta',
12+
ru: 'Переадресовать порт',
13+
ko: '포트 포워딩',
14+
it: 'Inoltra porta',
15+
tr: 'Bağlantı noktasını yönlendir',
16+
cs: 'Přesměrovat port',
17+
hu: 'Port továbbítása',
18+
bg: 'Пренасочване на порт'
19+
},
220
'views.prompt.handlers.handle-run-browser.remote-not-supported': {
321
en: 'Running the browser in a remote environment is not supported.',
422
pl: 'Uruchamianie przeglądarki w środowisku zdalnym nie jest obsługiwane.',

‎apps/editor/src/views/prompt/backend/message-handlers/handle-run-browser.ts‎

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,20 @@ const launch_browser = (
3636

3737
export const handle_run_browser = async () => {
3838
if (vscode.env.remoteName) {
39-
vscode.window.showWarningMessage(
40-
t('views.prompt.handlers.handle-run-browser.remote-not-supported')
41-
)
39+
const action = t('views.prompt.handlers.handle-run-browser.forward-port')
40+
vscode.window
41+
.showWarningMessage(
42+
t('views.prompt.handlers.handle-run-browser.remote-not-supported'),
43+
action
44+
)
45+
.then((selection) => {
46+
if (selection === action) {
47+
vscode.commands.executeCommand(
48+
'codeWebChat.settings',
49+
'section:web:group:remote-machines'
50+
)
51+
}
52+
})
4253
return
4354
}
4455

0 commit comments

Comments
 (0)