diff --git a/lib/main.js b/lib/main.js index cf8d189..b222a6b 100644 --- a/lib/main.js +++ b/lib/main.js @@ -14,6 +14,10 @@ export default { 'structure-view:show': () => this.switch('on'), 'structure-view:hide': () => this.switch('off'), })); + + if (atom.config.get('structure-view.ShowOnStartup')) { + this.switch('on'); + } }, deactivate() { @@ -26,7 +30,7 @@ export default { switch (stat) { let editors = atom.workspace.getTextEditors(); if (editors.length < 1 || - (editors.length === 1 && !editors[0].getPath())) return Util.alert('WARN', 'No file is opened!'); + (editors.length === 1 && !editors[0].getPath())) return; if (!this.structureView) this.structureView = new StructureView(); diff --git a/lib/util.js b/lib/util.js index a672db1..1a10a19 100644 --- a/lib/util.js +++ b/lib/util.js @@ -43,17 +43,5 @@ export default { notify(title, msg) { atom.notifications.addInfo(title, { detail: msg, dismissable: true }); - }, - - alert(title, msg) { - atom.confirm({ - message: title, - detailedMessage: msg, - buttons: { - Close: function() { - return; - } - } - }); } }; diff --git a/package.json b/package.json index d4d1c35..32de5df 100644 --- a/package.json +++ b/package.json @@ -20,14 +20,13 @@ "lodash": "^4.17.10", "vue": "1.0.27-csp" }, - "activationCommands": { - "atom-workspace": [ - "structure-view:toggle", - "structure-view:show", - "structure-view:hide" - ] - }, "configSchema": { + "ShowOnStartup": { + "title": "Show On Startup", + "description": "Show the Stucture View on startup.", + "type": "boolean", + "default": false + }, "ShowVariables": { "title": "Show Variables", "description": "If you don't need variables in the structure of file, just uncheck this config.",