@@ -45,34 +45,38 @@ const setupActions = async (workspaceRoot: vscode.WorkspaceFolder, {commands, co
4545}
4646
4747// run command
48- await runCommands ( commands )
48+ if ( commands ) {
49+ await runCommands ( commands )
50+ }
4951
5052// 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' )
53+ if ( files ) {
54+ for ( const filePath of files ) {
55+ try {
56+ // TODO: figure out why this does not work
57+ // try {
58+ // const absoluteFilePath = join(workspaceRoot.uri.path, filePath)
59+ // const doc = await vscode.workspace.openTextDocument(absoluteFilePath)
60+ // await vscode.window.showTextDocument(doc, vscode.ViewColumn.One)
61+ // // there are times when initialization leave the panel behind any files opened
62+ // // ensure the panel is redrawn on the right side first
63+ // // webview.createOrShow()
64+ // } catch (error) {
65+ // console.log(`Failed to open file ${filePath}`, error)
66+ // }
67+ const wr = vscode . workspace . rootPath
68+ if ( ! wr ) {
69+ throw new Error ( 'No workspace root path' )
70+ }
71+ const absoluteFilePath = join ( wr , filePath )
72+ const doc = await vscode . workspace . openTextDocument ( absoluteFilePath )
73+ await vscode . window . showTextDocument ( doc , vscode . ViewColumn . One )
74+ // there are times when initialization leave the panel behind any files opened
75+ // ensure the panel is redrawn on the right side first
76+ vscode . commands . executeCommand ( 'coderoad.open_webview' )
77+ } catch ( error ) {
78+ console . log ( `Failed to open file${ filePath } ` , error )
6779}
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 )
7680}
7781}
7882}