@@ -61,7 +61,7 @@ export class Background implements Disposable {
6161 // #region private methods 私有方法
6262
6363 /**
64- * 检测是否初次加载,并在初次加载的时候提示用户
64+ * 检测是否初次加载
6565 *
6666 * @private
6767 * @returns {boolean } 是否初次加载
@@ -71,22 +71,6 @@ export class Background implements Disposable {
7171 const firstLoad = ! fs . existsSync ( TOUCH_JSFILE_PATH ) ;
7272
7373 if ( firstLoad ) {
74- // 提示
75- vscode . window
76- . showInformationMessage ( l10n . t ( 'Welcome to use background@{version}!' , { version : VERSION } ) , {
77- title : l10n . t ( 'More' )
78- } )
79- . then ( confirm => {
80- if ( ! confirm ) {
81- return ;
82- }
83- this . showWelcome ( ) ;
84- } ) ;
85-
86- // 新版本强制提示下吧
87- // if (VERSION === '2.0.0' || true) {
88- // this.showWelcome();
89- // }
9074 // 标识插件已启动过
9175 await fs . promises . writeFile ( TOUCH_JSFILE_PATH , vscodePath . jsPath , ENCODING ) ;
9276 return true ;
@@ -165,8 +149,8 @@ export class Background implements Disposable {
165149
166150 // 更新,需要二次确认
167151 vsHelp . reload ( {
168- message : l10n . t ( 'Configuration has been changed, click to update .' ) ,
169- btnReload : l10n . t ( 'Update and Reload' ) ,
152+ message : l10n . t ( 'Configuration has been changed, click to apply .' ) ,
153+ btnReload : l10n . t ( 'Apply and Reload' ) ,
170154 beforeReload : ( ) => this . applyPatch ( )
171155 } ) ;
172156 }
@@ -199,17 +183,37 @@ export class Background implements Disposable {
199183 const patchType = await this . jsFile . getPatchType ( ) ; // 「js文件」目前状态
200184
201185 // 如果「开启」状态,文件不是「latest」,则进行「提示更新」
202- if ( this . config . enabled ) {
203- // 此时一般为 「background更新」、「vscode更新」
204- if ( [ EFilePatchType . Legacy , EFilePatchType . None ] . includes ( patchType ) ) {
205- // 提示: background 可更新
206- if ( await this . applyPatch ( ) ) {
207- vsHelp . reload ( {
208- message : l10n . t ( 'Background has been changed! Please reload.' )
209- } ) ;
210- }
211- }
186+ // 此时一般为 「background更新」、「vscode更新」
187+ const needApply = [ EFilePatchType . Legacy , EFilePatchType . None ] . includes ( patchType ) ;
188+ if ( this . config . enabled && needApply ) {
189+ // 提示
190+ vscode . window
191+ . showInformationMessage (
192+ l10n . t ( 'Background@{version} is ready! Apply to take effect.' , { version : VERSION } ) ,
193+ {
194+ title : l10n . t ( 'Apply and Reload' ) ,
195+ action : async ( ) => {
196+ await this . applyPatch ( ) ;
197+ await vsHelp . reload ( ) ;
198+ }
199+ } ,
200+ {
201+ title : l10n . t ( 'More' ) ,
202+ action : ( ) => this . showWelcome ( )
203+ }
204+ )
205+ . then ( confirm => {
206+ confirm ?. action ( ) ;
207+ } ) ;
212208 }
209+ // if ([EFilePatchType.Legacy, EFilePatchType.None].includes(patchType)) {
210+ // // 提示: 欢迎使用 background@version! 「应用并重载」、「更多」
211+ // if (await this.applyPatch()) {
212+ // vsHelp.reload({
213+ // message: l10n.t('Background has been changed! Please reload.')
214+ // });
215+ // }
216+ // }
213217
214218 // 监听文件改变
215219 this . disposables . push (
0 commit comments