mirror of
https://github.com/kiteco/vscode-plugin.git
synced 2024-10-27 01:12:35 +03:00
add simple install notification
This commit is contained in:
parent
a4c48ecf73
commit
77733c8d88
@ -69,6 +69,11 @@
|
||||
"default": false,
|
||||
"description": "Displays JSON data used by a view and also updates sample.html with the last rendered HTML."
|
||||
},
|
||||
"kite.installKiteEngineOnStartup": {
|
||||
"type": "boolean",
|
||||
"default": true,
|
||||
"description": "Offer to install Kite Engine on editor startup if it's not already installed."
|
||||
},
|
||||
"kite.startKiteEngineOnStartup": {
|
||||
"type": "boolean",
|
||||
"default": true,
|
||||
|
20
src/kite.js
20
src/kite.js
@ -388,6 +388,7 @@ const Kite = {
|
||||
this.supportedExtensions = [];
|
||||
this.shown = {};
|
||||
this.disposables = [];
|
||||
this.attemptedToInstallKite = false;
|
||||
this.attemptedToStartKite = false;
|
||||
delete this.shownNotifications;
|
||||
delete this.lastState;
|
||||
@ -482,6 +483,25 @@ const Kite = {
|
||||
);
|
||||
break;
|
||||
case KiteAPI.STATES.UNINSTALLED:
|
||||
if (
|
||||
!this.attemptedToInstallKite
|
||||
&& vscode.workspace.getConfiguration("kite").installKiteEngineOnStartup
|
||||
) {
|
||||
const msg = "Kite requires the Kite Engine backend to provide completions and documentation.";
|
||||
const ok = "Install Kite Engine";
|
||||
const hide = "Don't show this again";
|
||||
metrics.track("vscode_kite_installer_notification_shown");
|
||||
vscode.window.showInformationMessage(msg, ok, hide).then(item => {
|
||||
if (item === ok) {
|
||||
opn("https://kite.com/download?utm_source=vscode")
|
||||
metrics.track("vscode_kite_installer_download_opened");
|
||||
}
|
||||
if (item === hide) {
|
||||
config.update("installKiteEngineOnStartup", false, true);
|
||||
}
|
||||
});
|
||||
this.attemptedToInstallKite = true;
|
||||
}
|
||||
if (
|
||||
this.shown[state] ||
|
||||
(vscode.window.activeTextEditor &&
|
||||
|
Loading…
Reference in New Issue
Block a user