
Building Your First Atom Plugin - apetresc
https://github.com/blog/2231-building-your-first-atom-plugin
======
pbiggar
After 10 years in Vim and 5 years in Emacs, I recently switched to Atom. The
reason I switched is how easy it is to extend. And it truly is: I was up and
running in a few hours with my first plugin in Atom (the emacs legacy of code
is daunting, while vimscript is truly awful). This is a great resource, which
I had patched together while I was building my first plugins.

One major downide of atom is that while you can develop your own plugins, core
atom modules are extremely slow to accept contributions. I spent a lot of time
on something ([https://github.com/atom/tree-
view/pull/913](https://github.com/atom/tree-view/pull/913)) which makes sense
in core but is hard to do as a package, and it's been ignored, along with 42
other PRs on the same repo.

I really like Atom for its hackability, but an important part of hackability
is community contribution. Their roadmap is 404ing
([http://blog.atom.io/2014/10/23/public-
roadmap.html](http://blog.atom.io/2014/10/23/public-roadmap.html)), they don't
really take public contributions, and AFAICT there's no public product
direction of any kind. I hope they solve this - Atom is too good to lose to
bad community management.

~~~
lee-dohm
Thanks very much for the feedback! We're always excited to hear when people
enjoy using Atom.

It is true that we have been extremely slow to accept contributions. There are
many causes for this, not the least of which is that we are a small team of
maintainers working on a very large and ambitious project. Whatever the
causes, it is something that I am committed to fixing. I'm working with the
engineering manager on a new system of prioritization to burn down the backlog
of PRs needing review
([https://github.com/search?utf8=%E2%9C%93&q=user%3Aatom+is%3A...](https://github.com/search?utf8=%E2%9C%93&q=user%3Aatom+is%3Apr+is%3Aopen+label%3Aneeds-
review)). We feel we've made some good progress because of it.

We took down the roadmap because it wasn't being maintained by the team
anymore. (I'll amend the blog post to note that fact.) We felt that no roadmap
is better than an incorrect one. The best we can offer right now for a public
roadmap is what is currently being worked on by the official Atom maintainers.
There is an easy GitHub search linked in the Atom FAQ on the subject
([https://discuss.atom.io/t/is-there-an-atom-
roadmap/21033](https://discuss.atom.io/t/is-there-an-atom-roadmap/21033)).
Longer term this is also something that we are going to be increasing
transparency on.

Again, thank you for calling out these problems. Community contribution is
important to us. We're having some growing pains right now, yes. We are
committed to fixing them and I and the rest of the team hope that you and
others with the same concerns will stick with us while we work out exactly how
to fix them!

~~~
io
I'm the engineering manager lee-dohm mentioned and I just want to echo his
sentiment.

We recognize this problem and are working hard to improve it! We're of course
thrilled by how popular Atom is, but as you've seen, it's been a real
challenge to keep up with the size of the community. The team is small, but
growing!

In fact, if you're interested in getting paid to help us fix this, apply to
join the team! Openings for engineers on the Atom team will be posted here
later this week:
[https://github.com/about/jobs#positions](https://github.com/about/jobs#positions)

------
neuromute
Is there any plugin similar to this for Sublime?

EDIT: Not sure why I'm being downvoted, but I'm genuinely curious. I searched
the package manager and google, but couldn't find anything that offered this
functionality.

~~~
striking
Here you go. [https://github.com/azac/sublime-howdoi-direct-
paste](https://github.com/azac/sublime-howdoi-direct-paste)

I think it's really sad you're being downvoted. Dunno why anyone would do
that, it's a good question.

~~~
neuromute
So, the first 2 searches pulled back fairly poor results. It would perhaps be
useful to have a _cycle to next result_ shortcut, in order to keep searching
until you find something of use. That said, the Atom plugin used the same
search term and returned a better first result, so it might be worth using
something like their method for determining the top result.

FWIW...

First search, "QuickSort" returned:

    
    
      6 + 7 = 13
      13 / 2 = 6.5
      6.5 rounded down = 6
    

Next search, "BubbleSort", produced:

    
    
      It depends on the way your data is distributed - if you can make some assumptions. One of the best links I've found to understand when to use a bubble sort - or some other sort, is this - an animated view on sorting algorithms: http://www.sorting-algorithms.com/

------
todd8
Atom does look very cool. Systems will get faster and any performance problems
with Atom should diminish.

But Atom makes me sad. I've got years and years invested in understanding how
Emacs works and being able to tweet the capabilities of Emacs and write my own
commands and packages in Emacs Lisp. I feel kind of stuck with it now.

Don't get me wrong its a great place to be stuck--Emacs is the world's most
powerful editor. Yet, a weakness that has always bothered about Emacs is it's
reliance on an unpopular language, its own version of Lisp. There are so many
Javascript programmers that, eventually, a Javascript based editor will exceed
the capabilities Emacs which is written in Lisp and C. (I don't rule out
success for NeoVim either, the foundation of vim with a clean way to write
packages in Python, totally cool!)

I wish there was a Neomacs project or a true org-mode and magit for Atom.

~~~
formula1
Systems will not get faster since Moore's (not murphys) law is reaching its
end. Though Atom could certainly get faster in a variety of ways. I think my
biggest problem with atom currently is that its only useful on a personal
computer in long sessions. I would never (could never) install it on a server
and certainly cant use it to create a little script or project.

~~~
fizzbatter
Is it reaching it's end though? I could foresee us simply scaling horizontally
rather than vertically. Even if it ends up drawing more power, more total CPU
could still mean an increase in raw performance, no?

 _(assuming systems were setup with better parallel processing. I 'm aware
that NodeJS is pretty terrible on this front)_

------
mhw
Yay - it's great to get some more documentation about how to build plugins for
Atom.

That said, this tutorial neatly avoids adding much to Atom's view layer. When
you try to extend the user interface you'll eventually run into
[https://github.com/atom/atom/issues/5756](https://github.com/atom/atom/issues/5756)
"Let's choose a view framework for docs, generated packages, etc." which has
been open for nearly 18 months.

There's a commendable commitment not to force a single view framework on all
plugin authors, but the cost of that seems to be that there's no single view
framework that the project feels comfortable recommending and documenting as a
starting point for new authors. And without a view framework to present as an
example, there's little to go on to help figure out how to structure a plugin
with some custom user interface components. The project generator used in this
tutorial creates a sourcefetch-view.js file, but the tutorial never mentions
it. The Atom flight manual talks about the view file in a little more detail,
but stops short of explaining how responsibilities should be split between
model and view in a more complex plugin. The best option available seems to be
to go reading through the source code of other existing plugins out there, but
as each chooses a different approach (see original problem) it's difficult to
pick up what might be considered best practice and what has been deprecated -
some packages use atom-space-pen-views for example, but that's the old
recommended view framework that's been deprecated for a while.

I like Atom as an editor, and part of the reason is that I really would like
to extend it by using the languages that I'm already familiar with. But
writing a plugin will (for me) only ever be a side project, and the amount of
research I need to do to understand how to build some meaningful UI in Atom is
too great at the moment for me.

------
asd
I really want to love Atom, mainly due to the plethora of cool plugins being
created lately. However, its inability to handle large files and the slow
launch times are unfortunate.

~~~
thom
It seems like some people have created VLF-like packages for Atom that employ
similar workarounds to emacs for large files. This tickles me, but I assume
long term this'll be solved more fundamentally.

I personally never cared much about emacs' similarly slow loading times, and
don't see much of an issue with a modern editor taking time to start up. I'm
happy just never quitting emacs on any of my machines, but it does mean you
need something that interacts with sudo (i.e. tramp in emacs) to make quick
edits to config files etc.

~~~
tombert
In Emacs' case, it bothered me until I discovered you can compile everything
(including your `.emacs` file) and have it boot a lot faster.

AFAIK, there's no equivalent in Atom yet.

------
hifumi
I'm glad someone finally made a tutorial for this. I've had some ideas for
atom plugins but little help in implementing them.

------
nicktikhonov
Hey everyone ! I'm Nick - GitHub Campus Expert and the author of this
tutorial. I'm glad that you all enjoyed hacking with Atom and can't believe
that my post got to the front page! I would love to answer any questions about
the content and would appreciate any feedback for this or future posts.

~~~
ben_jones
Automatically finding and dragging in code from stackoverflow is the most
dangerous thing I've ever heard of. How accurate would you consider
comparisons between yourself and J. Robert Oppenheimer?

Jokes aside it's a cool tutorial. Plugin development for many editors is
unnecessarily hard and a detriment to their ecosystems. It's cool that it's
that simple for Atom. But as someone happy with my current editors (Jetbrains
derivatives + plugins for projects / Sublime + plugins for small stuff), what
advantages would you say Atom has that would incentivize people to try it out?

~~~
nicktikhonov
While I advocate hacking Atom, I don't advocate actually using the plugin the
tutorial teaches you to make as-is! A safer bet is Sourcerer
([https://atom.io/packages/sourcerer](https://atom.io/packages/sourcerer)) -
it's got some neat features like previewing snippets and attributing credit to
the SO author through added comments. I always thought of this plugin as an
educational tool for learning new languages, rather than something to be used
regularly when building real software. That said, So many of us use
StackOverflow to find library/API examples, and this is a nice shortcut! I
think that this is generally safe for finding one-line examples and shorter
snippets, where it's easy to read and understand what the code does.

Before switching to Atom, I used vim and Sublime Text. The thing I enjoyed
most about both of these editors was extending them with plugins. I think it's
important to customise and personalise your editor because it's one of the few
tools we use the most as developers, and any tweak/feature that saves us time
doing a particular task means a great deal in the long term. I chose to switch
to Atom because it's an editor designed around being easy to extend and
customise - anyone who has done any web/Node development can dive right in.
There are already nearly 5000 packages and themes available, and so far I
found it much more open and easier to develop for than both Sublime and Vim.

------
0xmohit

      We'll be building a clone of Sourcerer, a plugin for finding
      and using code snippets from StackOverflow.
    

I wish some other example was demonstrated. This reminds one of
[https://imgur.com/gallery/SZPjHwz](https://imgur.com/gallery/SZPjHwz)

EDIT: This is even more disappointing after observing that the post author --
"GitHub Campus Expert". What a fantastic example being presented to students.

------
romanovcode
Offtopic but is there some similar resource regarding VS Code?

~~~
cloverich
They have an overview and inside it links to a copule example repos:

\-
[https://code.visualstudio.com/docs/extensions/overview](https://code.visualstudio.com/docs/extensions/overview)
\- [https://code.visualstudio.com/docs/extensions/example-
hello-...](https://code.visualstudio.com/docs/extensions/example-hello-world))
to some getting started examples

------
deelowe
I like Atom, but man the start-up time is rough when there are several plugins
installed.

~~~
nikmobi
Given the amount of complaints about this (from me as well) I would think this
would be priority #1 for Atom developers, but that doesn't seem to be the
case.

I remember some time ago there was an uber issue on Github for this, but I
think I remember seeing it marked as resolved when I can absolutely tell not
much has changed (and I have installed barely any plugins). :(

EDIT: I guess I was wrong[0,1]

[0]
[https://github.com/atom/atom/issues/2654](https://github.com/atom/atom/issues/2654)
[1]
[https://github.com/atom/atom/issues/9572](https://github.com/atom/atom/issues/9572)

------
crashdown
in before Visual Stuidio Code/Sublime is better than Atom

------
whizzkid
Little bit off topic but it is ironic that Atom's biggest problem of being
laggy also applies to their blog post.

