Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the possibility to open structure-view on startup (resolve #18) #39

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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