File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 559559 "category" : " R Markdown" ,
560560 "command" : " r.rmarkdown.newDraft"
561561 },
562+ {
563+ "title" : " R Markdown (rmd)" ,
564+ "category" : " R Markdown" ,
565+ "when" : false ,
566+ "command" : " r.rmarkdown.newFileDraft"
567+ },
568+ {
569+ "title" : " R Document (r)" ,
570+ "category" : " R" ,
571+ "when" : false ,
572+ "command" : " r.newFileDocument"
573+ },
562574 {
563575 "command" : " r.rmarkdown.setKnitDirectory" ,
564576 "title" : " Set Knit directory" ,
12371249 {
12381250 "command" : " r.knitRmdToAll"
12391251 }
1252+ ],
1253+ "file/newFile" : [
1254+ {
1255+ "group" : " R" ,
1256+ "command" : " r.rmarkdown.newFileDraft"
1257+ },
1258+ {
1259+ "group" : " R" ,
1260+ "command" : " r.newFileDocument"
1261+ }
12401262 ]
12411263 },
12421264 "submenus" : [
Original file line number Diff line number Diff line change @@ -105,6 +105,10 @@ export async function activate(context: vscode.ExtensionContext): Promise<apiImp
105105 'r.rmarkdown.preview.enableAutoRefresh' : ( ) => rmdPreviewManager . enableAutoRefresh ( ) ,
106106 'r.rmarkdown.preview.disableAutoRefresh' : ( ) => rmdPreviewManager . disableAutoRefresh ( ) ,
107107
108+ // file creation (under file submenu)
109+ 'r.rmarkdown.newFileDraft' : ( ) => rmarkdown . newDraft ( ) ,
110+ 'r.newFileDocument' : ( ) => vscode . workspace . openTextDocument ( { language : 'r' } ) . then ( ( v ) => vscode . window . showTextDocument ( v ) ) ,
111+
108112 // editor independent commands
109113 'r.createGitignore' : rGitignore . createGitignore ,
110114 'r.loadAll' : ( ) => rTerminal . runTextInTerm ( 'devtools::load_all()' ) ,
Original file line number Diff line number Diff line change @@ -132,7 +132,7 @@ export async function newDraft(): Promise<void> {
132132 const parsedPath = path . parse ( uri . fsPath ) ;
133133 const dir = path . join ( parsedPath . dir , parsedPath . name ) ;
134134 if ( fs . existsSync ( dir ) ) {
135- if ( await getConfirmation ( `Folder already exists. Are you sure to replace the folder?` ) ) {
135+ if ( await getConfirmation ( `Folder already exists. Are you sure you want to replace the folder?` ) ) {
136136 fs . rmdirSync ( dir , { recursive : true } ) ;
137137 } else {
138138 return ;
You can’t perform that action at this time.
0 commit comments