File tree Expand file tree Collapse file tree 2 files changed +18
-3
lines changed Expand file tree Collapse file tree 2 files changed +18
-3
lines changed Original file line number Diff line number Diff line change 1818 "No any group can be added" : " 没有可以添加的组" ,
1919 "Are you sure to delete all alias?" : " 确认删除所有的别名吗?" ,
2020 "Confirm" : " 确认" ,
21- "Please check if the .zshrc file exists" : " 请检查.zshrc文件是否存在" ,
21+ "The .zshrc file on {path} doesn't exist. Do you want to create .zshrc file in this path?" : " {path} 下.zshrc文件不存在,你想创建此文件吗?" ,
22+ "Create .zshrc file on {path} successfully" : " {path} 下.zshrc文件创建成功" ,
2223 "Please check if the file exists" : " 请检查文件是否存在" ,
2324 "Fail to save json file, the error message is {message}" : " 文件保存失败,错误信息是 {message}" ,
2425 "Save file successfully, the path is {path}" : " 文件保存成功,路径是 {path}" ,
Original file line number Diff line number Diff line change @@ -17,11 +17,25 @@ import {
1717 resolveAlias ,
1818} from './utils'
1919
20- export function activate ( context : vscode . ExtensionContext ) {
20+ export async function activate ( context : vscode . ExtensionContext ) {
2121 // set default store path
2222 storePath . path = path . join ( os . homedir ( ) , '.zshrc' )
2323 if ( ! fs . existsSync ( storePath . path ) ) {
24- vscode . window . showErrorMessage ( vscode . l10n . t ( 'Please check if the .zshrc file exists' ) )
24+ const text = await vscode . window . showInformationMessage (
25+ vscode . l10n . t ( "The .zshrc file on {path} doesn't exist. Do you want to create .zshrc file in this path?" , {
26+ path : os . homedir ( ) ,
27+ } ) ,
28+ { modal : true } ,
29+ vscode . l10n . t ( 'Confirm' ) ,
30+ )
31+
32+ // click confirm button
33+ if ( text !== undefined ) {
34+ fs . writeFileSync ( storePath . path , '' )
35+ vscode . window . showInformationMessage (
36+ vscode . l10n . t ( 'Create .zshrc file on {path} successfully' , { path : os . homedir ( ) } ) ,
37+ )
38+ }
2539 }
2640
2741 const globalState = context . globalState
You can’t perform that action at this time.
0 commit comments