Package : Strucure-view auto toggle at startup


#1

Hello,

I’m new to Atom, just started using it today and I love it so far, everything is so easy !
I’ve installed the “Structure view” package but it is not loaded by default at startup. The “mini map” one has an auto toggle setting for that.

Any idea how I can have the “Structure view” to be toggled at startup ? I’ve seen that there is an init script but not quite sure how it works.

Thanks


#2

The init script is run when Atom starts, and it works like normal JavaScript with full access to Node and Atom’s APIs. To run a command, you can use atom.commands.dispatch().

atom.commands.dispatch(atom.workspace.element, 'structure-view:toggle')

#4

Hi @DamnedScholar

Thank you for the info, I’m absolutely not familiar with JavaScript. I will have to look into it.
The code to obtain the right behavior is the following:
atom.commands.dispatch(atom.workspace.element, ‘structure-view:show’)


#5

Right. My bad. I mis-typed that. Fixed.

You are able to have an init.coffee or init.js script, depending on your taste. Atom’s CoffeeScript support is only for version 1, and Atom has been transitioning from CS to JS since JS has developed to fix some of the problems that CS once solved, so if you are in a position of having to learn from scratch, it might be best to focus on JS. If there are any CoffeeScript snippets you want to use, you can easily have a web utility convert them (the official CoffeeScript site has one, and there are a few others that Google can find).