Skip to content

Switch from open package to using vscode.open command. #65

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ScottTodd
Copy link

The open command in VSCode's extension API supports choosing a browser (or browser launch options) via the workbench.externalBrowser setting. API reference: https://code.visualstudio.com/api/references/commands.

Without this change, the open package always uses the default browser determined by the OS. This could be customized via the app argument (docs: https://www.npmjs.com/package/open). That could be useful if someone wants to customize this extension independent of the full VSCode editor, but I figured removing a dependency and reusing other editor settings would make more sense.

Motivating usage

If the extension just uses my default OS browser, that has no launch arguments and uses my "personal profile" when I want to launch my "work profile". I can use this to open a different browser profile (controlled by launch args as indicated by this guide) if I set a script as my externalBrowser:

// vscode settings
"workbench.externalBrowser": "launch_firefox_work.vbs",
' launch_firefox_work_.vbs
Set objShell = CreateObject("Wscript.Shell")
programFiles = objShell.ExpandEnvironmentStrings("%PROGRAMFILES%")
profileName = "Work"
strPath = """" & programFiles & "\Mozilla Firefox\firefox.exe" & """ --no-remote -P " & profileName & " " & WScript.Arguments(0)
objShell.Run strPath

' this could also be a .bat file but that shows a window whenever it runs
' the equivalent .bat file is simpler:
' "%PROGRAMFILES%\Mozilla Firefox\firefox.exe" --no-remote -P Work %1

The open command supports choosing a browser (or browser launch options) via the `workbench.externalBrowser` setting.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant