@@ -40,39 +40,45 @@ const runCommands = async (commands: string[], language: string = 'JAVASCRIPT')
4040
4141const setupActions = async ( workspaceRoot : vscode . WorkspaceFolder , { commands, commits, files} : G . StepActions ) : Promise < void > => {
4242 // run commits
43- for ( const commit of commits ) {
44- await git . loadCommit ( commit )
43+ if ( commits ) {
44+ for ( const commit of commits ) {
45+ await git . loadCommit ( commit )
46+ }
4547 }
4648
4749 // run command
48- await runCommands ( commands )
50+ if ( commands ) {
51+ await runCommands ( commands )
52+ }
4953
5054 // open files
51- for ( const filePath of files ) {
52- try {
53- // TODO: figure out why this does not work
54- // try {
55- // const absoluteFilePath = join(workspaceRoot.uri.path, filePath)
56- // const doc = await vscode.workspace.openTextDocument(absoluteFilePath)
57- // await vscode.window.showTextDocument(doc, vscode.ViewColumn.One)
58- // // there are times when initialization leave the panel behind any files opened
59- // // ensure the panel is redrawn on the right side first
60- // // webview.createOrShow()
61- // } catch (error) {
62- // console.log(`Failed to open file ${filePath}`, error)
63- // }
64- const wr = vscode . workspace . rootPath
65- if ( ! wr ) {
66- throw new Error ( 'No workspace root path' )
55+ if ( files ) {
56+ for ( const filePath of files ) {
57+ try {
58+ // TODO: figure out why this does not work
59+ // try {
60+ // const absoluteFilePath = join(workspaceRoot.uri.path, filePath)
61+ // const doc = await vscode.workspace.openTextDocument(absoluteFilePath)
62+ // await vscode.window.showTextDocument(doc, vscode.ViewColumn.One)
63+ // // there are times when initialization leave the panel behind any files opened
64+ // // ensure the panel is redrawn on the right side first
65+ // // webview.createOrShow()
66+ // } catch (error) {
67+ // console.log(`Failed to open file ${filePath}`, error)
68+ // }
69+ const wr = vscode . workspace . rootPath
70+ if ( ! wr ) {
71+ throw new Error ( 'No workspace root path' )
72+ }
73+ const absoluteFilePath = join ( wr , filePath )
74+ const doc = await vscode . workspace . openTextDocument ( absoluteFilePath )
75+ await vscode . window . showTextDocument ( doc , vscode . ViewColumn . One )
76+ // there are times when initialization leave the panel behind any files opened
77+ // ensure the panel is redrawn on the right side first
78+ vscode . commands . executeCommand ( 'coderoad.open_webview' )
79+ } catch ( error ) {
80+ console . log ( `Failed to open file ${ filePath } ` , error )
6781 }
68- const absoluteFilePath = join ( wr , filePath )
69- const doc = await vscode . workspace . openTextDocument ( absoluteFilePath )
70- await vscode . window . showTextDocument ( doc , vscode . ViewColumn . One )
71- // there are times when initialization leave the panel behind any files opened
72- // ensure the panel is redrawn on the right side first
73- vscode . commands . executeCommand ( 'coderoad.open_webview' )
74- } catch ( error ) {
75- console . log ( `Failed to open file ${ filePath } ` , error )
7682 }
7783 }
7884}
0 commit comments