You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: add wslConvertWindowsPath option for WSL path conversion control
Add a new configuration option `wslConvertWindowsPath` to control whether
WSL paths should be converted to Windows paths in WSL remote mode.
- Default is true (convert to Windows path) for Windows applications
- Set to false to keep WSL native path for WSL applications like evince
- Fixes#74 (WSL applications) while maintaining compatibility with #16 (Windows applications)
Changes:
- Add wslConvertWindowsPath field to ExternalAppConfig interface
- Update package.json schema and validation logic
- Add i18n translations for 5 languages
- Refactor path conversion to handle once at the beginning of open()
- Add WSL usage documentation in README
Copy file name to clipboardExpand all lines: README.md
+64-25Lines changed: 64 additions & 25 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -177,10 +177,9 @@ Yes, you can use shellEnv to set additional environment variables:
177
177
{
178
178
"title":"run ts file",
179
179
"shellCommand":"ts-node ${file}",
180
-
"shellEnv":
181
-
{
182
-
"TOKEN":"tyekjjbqbptcxeycgmwqfepus"
183
-
},
180
+
"shellEnv": {
181
+
"TOKEN":"tyekjjbqbptcxeycgmwqfepus"
182
+
}
184
183
}
185
184
]
186
185
}
@@ -200,41 +199,81 @@ Or you can set separate environment variables for Windows, Linux and macOS:
200
199
{
201
200
"title":"run ts file",
202
201
"shellCommand":"ts-node ${file}",
203
-
"shellEnv":
204
-
{
205
-
"windows":
206
-
{
207
-
"PLATFORM":"Windows"
208
-
},
209
-
"linux":
210
-
{
211
-
"PLATFORM":"GNU/Linux"
212
-
},
213
-
"osx":
214
-
{
215
-
"PLATFORM":"macOS"
216
-
},
202
+
"shellEnv": {
203
+
"windows": {
204
+
"PLATFORM":"Windows"
205
+
},
206
+
"linux": {
207
+
"PLATFORM":"GNU/Linux"
217
208
},
209
+
"osx": {
210
+
"PLATFORM":"macOS"
211
+
}
212
+
}
213
+
}
214
+
]
215
+
}
216
+
]
217
+
}
218
+
```
219
+
220
+
### How to use in WSL (Windows Subsystem for Linux)?
221
+
222
+
When using VSCode in WSL remote mode, file paths need to be converted between WSL and Windows formats depending on whether you're opening the file in a Windows application or a WSL application.
223
+
224
+
**By default, the extension converts WSL paths to Windows paths** (e.g., `/home/user/file.pdf` → `C:\Users\user\file.pdf`) to support opening files in Windows applications from WSL.
225
+
226
+
However, if you want to open files with **WSL applications** (like `evince`, `xdg-open`), you need to set `wslConvertWindowsPath: false` to keep the WSL native path:
227
+
228
+
```jsonc
229
+
{
230
+
"openInExternalApp.openMapper": [
231
+
// ✅ Open with Windows application (default behavior)
232
+
{
233
+
"extensionName":"lyx",
234
+
"apps": [
235
+
{
236
+
"title":"Lyx (Windows)",
237
+
"shellCommand":"lyx.exe ${file}"
238
+
// wslConvertWindowsPath defaults to true
239
+
// ${file} will be: C:\Users\username\file.lyx
240
+
}
241
+
]
242
+
},
243
+
// ✅ Open with WSL application
244
+
{
245
+
"extensionName":"pdf",
246
+
"apps": [
247
+
{
248
+
"title":"Evince (WSL)",
249
+
"shellCommand":"evince ${file}",
250
+
"wslConvertWindowsPath":false
251
+
// ${file} will be: /home/username/file.pdf
218
252
}
219
253
]
220
254
}
221
255
]
222
256
}
223
257
```
224
258
259
+
**Related Issues:**
260
+
261
+
-[#16](https://github.com/tjx666/open-in-external-app/issues/16) - Opening files in Windows applications from WSL
262
+
-[#74](https://github.com/tjx666/open-in-external-app/issues/74) - Opening files in WSL applications from WSL
263
+
225
264
### assign keyboard shortcut for specific config item
"cfg.openInExternalApp.openMapper.item.apps.item.shellEnv.windows": "Additional shellCommand environment variables for Windows",
24
24
"cfg.openInExternalApp.openMapper.item.apps.item.shellEnv.linux": "Additional shellCommand environment variables for Linux",
25
-
"cfg.openInExternalApp.openMapper.item.apps.item.shellEnv.osx": "Additional shellCommand environment variables for macOS"
25
+
"cfg.openInExternalApp.openMapper.item.apps.item.shellEnv.osx": "Additional shellCommand environment variables for macOS",
26
+
"cfg.openInExternalApp.openMapper.item.apps.item.wslConvertWindowsPath": "Whether to convert WSL path to Windows path when running in WSL remote mode. Default is true (convert to Windows path for Windows applications). Set to false to keep WSL native path for WSL applications like evince"
Copy file name to clipboardExpand all lines: package.nls.pt-br.json
+7-1Lines changed: 7 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -16,5 +16,11 @@
16
16
"cfg.openInExternalApp.openMapper.item.apps.item.title": "Título que será exibido na lista suspensa, se houver vários aplicativos para abrir o arquivo.",
17
17
"cfg.openInExternalApp.openMapper.item.apps.item.shellCommand": "Usar o shell de comando com um placeholder para lidar com arquivo.",
18
18
"cfg.openInExternalApp.openMapper.item.apps.item.args": "Argumentos passados para 'openCommand'.",
19
-
"cfg.openInExternalApp.openMapper.item.apps.item.isElectronApp": "Defina como verdadeiro (true) quando o apicativo for baseado em Electron."
19
+
"cfg.openInExternalApp.openMapper.item.apps.item.isElectronApp": "Defina como verdadeiro (true) quando o apicativo for baseado em Electron.",
"cfg.openInExternalApp.openMapper.item.apps.item.shellEnv.windows": "Additional shellCommand environment variables for Windows",
23
+
"cfg.openInExternalApp.openMapper.item.apps.item.shellEnv.linux": "Additional shellCommand environment variables for Linux",
24
+
"cfg.openInExternalApp.openMapper.item.apps.item.shellEnv.osx": "Additional shellCommand environment variables for macOS",
25
+
"cfg.openInExternalApp.openMapper.item.apps.item.wslConvertWindowsPath": "Whether to convert WSL path to Windows path when running in WSL remote mode. Default is true (convert to Windows path for Windows applications). Set to false to keep WSL native path for WSL applications like evince"
"cfg.openInExternalApp.openMapper.item.apps.item.shellEnv.windows": "Дополнительные переменные окружения для shellCommand, для Windows",
24
24
"cfg.openInExternalApp.openMapper.item.apps.item.shellEnv.linux": "Дополнительные переменные окружения для shellCommand, для Linux",
25
-
"cfg.openInExternalApp.openMapper.item.apps.item.shellEnv.osx": "Дополнительные переменные окружения для shellCommand, для macOS"
25
+
"cfg.openInExternalApp.openMapper.item.apps.item.shellEnv.osx": "Дополнительные переменные окружения для shellCommand, для macOS",
26
+
"cfg.openInExternalApp.openMapper.item.apps.item.wslConvertWindowsPath": "Whether to convert WSL path to Windows path when running in WSL remote mode. Default is true (convert to Windows path for Windows applications). Set to false to keep WSL native path for WSL applications like evince"
0 commit comments