Skip to content

Commit

Permalink
Add the possibility to open structure-view on startup (resolve alibab…
Browse files Browse the repository at this point in the history
  • Loading branch information
bl00mber committed Apr 26, 2019
1 parent 3193b99 commit f128813
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 20 deletions.
6 changes: 5 additions & 1 deletion lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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();

Expand Down
12 changes: 0 additions & 12 deletions lib/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
});
}
};
13 changes: 6 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down

0 comments on commit f128813

Please sign in to comment.