Problem: When developing inside vs code you may have several chrome browsers open that respectively have mulitple tabs open in each browser window pertaining to different topics in regards to your development tasks or other. When you need to move back to a certain browser you have to leave vs code and hover or open each browser to find the exact tab with the information you are looking for.
Solution: Build Vs Code extention that you can manage your browsers by opening new browser windows or restore minimized browser windows. The extension would create new browser groups for each new window you open, and then create a tree view of the browser windows by grouped names.
Benefit: You would not need to leave vs code to restore or open theses windows (this doesnt mean the browser opens in vs code (webview?), I just mean you dont have to leave vs code to search for which window group to restore).
Current: Debugging locally, I can activate the extension which then does a quick pick of options for ‘Installs’ or ‘Browser’. The Installs options is outside of the scope of the question but would just open one off URLs to helpful/needful installs. The Browser options show options to open google, youtube, and default groups Primary, Secondary, and Tertiary. The goal would be opening google or youtube or any additional defaults in a new browser attaching a grouped name (Primary, Seconday, Tertiary) and then if you minimize that window I would be able to restore a minimized browser group by chosing their respective name.
Issue: The Browser default URLs, google and youtube at the moment, open in the same default browser without designating a group name and in turn opening a minimized browser with the group name does not work either.
Attempts: In the below code I have tried to open and asign browser group names like:
open(<url>, options)
I cant find good docs for what the options entail
window.open(<url>, options)
Errors arent helpful but breaks at start on const window = require(‘window’);
vscode.window.open(browser.link, browser.detail)
Opens in default
vscode.commands.executeCommand('vscode.open',vscode.Uri.parse(browser.link))
Opens in default
Let me know what you think, thanks.
`
const vscode = require(‘vscode’);
const open = require(‘open’);
/**
- @param {vscode.ExtensionContext} context
*/
function activate(context) {
var opts = [
{label: "Installs", detail:"Software Installation"},
{label: "Browsers", detail: "Browser Manager"}
]
var installs = [
{label: "python", link: "https://Python.org/download/"},
{label: "node", link: "https://https://nodejs.org/en/download/"},
{label: "aws cli", link: "https://docs.aws.amazon.com/cli/latest/
userguide/getting-started-install.html"}
]
var browsers = [
{label: "google", link: "https://Google.com", detail: "Primary"},
{label: "YouTube", link: "https://youtube.com", detail: "Primary"},
{label: "Primary Browser", detail: "Primary"},
{label: "Secondary Browser", detail: "Secondary"},
{label: "Tertiary Browser", detail: "Tertiary"},
]
vscode.window.showInformationMessage('Browser Manager Activated!');
let disposable = vscode.commands.registerCommand(
'browsermanager.ManageChrome',
async function () {
const opt = await vscode.window.showQuickPick(opts, {
matchOnDetail: true
})
if (opt.label == "Installs"){
const install = await vscode.window.showQuickPick(installs, {
matchOnDetail: true
})
open(install.link)
}
else if (opt.label == "Browsers"){
const browser = await vscode.window.showQuickPick(browsers, {
matchOnDetail: true
})
if (["Primary","Secondary","Tertiary"].includes(browser.detail)) {
vscode.commands.executeCommand(
'vscode.open',
vscode.Uri.parse(browser.link)
)
}
else{
vscode.commands.executeCommand(
'vscode.open',
vscode.Uri.parse(browser.link)
)
}
}
});
context.subscriptions.push(disposable);
}
function deactivate() {}
module.exports = {
activate,
deactivate
}
`