@@ -8,27 +8,27 @@ let instance:Scheduler
88
99export function activate ( context : vscode . ExtensionContext ) {
1010 let config :Option = {
11- path :vscode . workspace . workspaceFile ?. path ,
12- commitTimeInterval :getConfig ( 'commitTimeInterval' ) as number ,
13- autoPush :getConfig ( 'autoPush' ) as boolean ,
11+ commitTimeInterval :getConfig < number > ( 'commitTimeInterval' ) || 0 ,
12+ autoPush :getConfig < boolean > ( 'autoPush' ) || false ,
1413 context
1514 }
16- vscode . window . showInformationMessage ( 'git-auto-commit成功启用' ) ;
17- if ( ! vscode . workspace . workspaceFile ) {
18- vscode . window . showErrorMessage ( '当前目录下不存在工作区,无法获取执行目录。请先将本项目保存为工作区' ) ;
15+ if ( ! vscode . workspace . workspaceFolders ) {
16+ vscode . window . showErrorMessage ( '当前目录不合法' ) ;
17+ return
1918 } else {
20- instance = new Scheduler ( { ...config , context} ) ;
19+ config . path = vscode . workspace . workspaceFolders [ 0 ] . uri . fsPath
20+ instance = new Scheduler ( { ...config , context} )
21+ vscode . window . showInformationMessage ( 'git-auto-commit成功启用' ) ;
2122 vscode . workspace . onDidSaveTextDocument ( ( e ) => { instance . changeListener ( e ) } )
22-
2323 }
2424 let disposable = vscode . commands . registerCommand ( 'code-auto-commit.runCommit' , ( ) => {
2525
2626 } ) ;
2727
2828 context . subscriptions . push ( disposable ) ;
2929 context . subscriptions . push ( vscode . workspace . onDidChangeConfiguration ( ( ) => {
30- config . commitTimeInterval = getConfig ( 'commitTimeInterval' ) as number ;
31- config . autoPush = getConfig ( 'autoPush' ) as boolean ;
30+ config . commitTimeInterval = getConfig < number > ( 'commitTimeInterval' ) || 0 ;
31+ config . autoPush = getConfig < boolean > ( 'autoPush' ) || false ;
3232 instance . changeOptions ( config )
3333 } ) ) ;
3434}
0 commit comments