@@ -3,6 +3,7 @@ import * as vscode from "vscode";
33import MarkdownIt from "markdown-it" ;
44import wrap from "word-wrap" ;
55
6+ import { commandPrefix } from "../constants" ;
67import Logger from "../logging" ;
78
89enum MarkdownTableColumnAlignment {
@@ -99,6 +100,61 @@ export function registerHelperCommands(context: vscode.ExtensionContext) {
99100 }
100101 } ,
101102 ) ,
103+ vscode . commands . registerCommand (
104+ `${ commandPrefix } .debug.showOpenDialog` ,
105+ async ( ) => {
106+ const selection = await vscode . window . showQuickPick (
107+ [
108+ {
109+ label : "Default Electron App" ,
110+ iconPath : {
111+ dark : vscode . Uri . joinPath (
112+ context . extensionUri ,
113+ "resources" ,
114+ "icons" ,
115+ "dark" ,
116+ "electron.svg" ,
117+ ) ,
118+ light : vscode . Uri . joinPath (
119+ context . extensionUri ,
120+ "resources" ,
121+ "icons" ,
122+ "light" ,
123+ "electron.svg" ,
124+ ) ,
125+ } ,
126+ detail : "The default Electron app" ,
127+ } ,
128+ {
129+ label : "Custom Electron App" ,
130+ iconPath : new vscode . ThemeIcon ( "folder-opened" ) ,
131+ detail : "Select a local path to an Electron app" ,
132+ } ,
133+ {
134+ label : "URL" ,
135+ iconPath : new vscode . ThemeIcon ( "globe" ) ,
136+ detail : "Enter a URL starting with http(s)://" ,
137+ } ,
138+ ] ,
139+ { placeHolder : "Select Electron app to run, or run the default app" } ,
140+ ) ;
141+
142+ if ( selection ?. label === "Custom Electron App" ) {
143+ return (
144+ await vscode . window . showOpenDialog ( {
145+ canSelectFiles : true ,
146+ canSelectFolders : true ,
147+ } )
148+ ) ?. [ 0 ] . fsPath ;
149+ } else if ( selection ?. label === "URL" ) {
150+ return await vscode . window . showInputBox ( {
151+ placeHolder : "Enter a URL starting with http(s)://" ,
152+ } ) ;
153+ }
154+
155+ return "" ;
156+ } ,
157+ ) ,
102158 vscode . commands . registerTextEditorCommand (
103159 "markdown.prettifyTable" ,
104160 ( textEditor : vscode . TextEditor , edit : vscode . TextEditorEdit ) => {
0 commit comments