Improve Update Notifier
This commit is contained in:
		
							parent
							
								
									2275c834ff
								
							
						
					
					
						commit
						238dd4a996
					
				
					 1 changed files with 7 additions and 2 deletions
				
			
		| 
						 | 
					@ -1,6 +1,6 @@
 | 
				
			||||||
'use strict';
 | 
					'use strict';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import { window } from 'vscode';
 | 
					import { window, commands } from 'vscode';
 | 
				
			||||||
import { ExtensionManifestReader } from './ManifestUtils';
 | 
					import { ExtensionManifestReader } from './ManifestUtils';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
let req = require('request');
 | 
					let req = require('request');
 | 
				
			||||||
| 
						 | 
					@ -27,7 +27,12 @@ export function checkForUpdates() {
 | 
				
			||||||
			let latestVersion = release.name.substring(1); // the telease/tag is prefixed with a "v"
 | 
								let latestVersion = release.name.substring(1); // the telease/tag is prefixed with a "v"
 | 
				
			||||||
			
 | 
								
 | 
				
			||||||
			if (!release.draft && semver.gt(latestVersion, currentVersion)) {
 | 
								if (!release.draft && semver.gt(latestVersion, currentVersion)) {
 | 
				
			||||||
				window.showInformationMessage(`Version ${latestVersion} of the ${manifestReader.displayName} extension is available.`);
 | 
									let updateNowLabel = 'Update Now';
 | 
				
			||||||
 | 
									window.showInformationMessage(`Version ${latestVersion} of the ${manifestReader.displayName} extension is available.`, updateNowLabel).then((clicked) => {
 | 
				
			||||||
 | 
										if (clicked == updateNowLabel) {
 | 
				
			||||||
 | 
											commands.executeCommand('workbench.extensions.action.installExtension', manifestReader.displayName);
 | 
				
			||||||
 | 
										}
 | 
				
			||||||
 | 
									});
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	});
 | 
						});
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue