I tried the My First Package Tutorial.
I thought I followed the directions here:
To begin, press cmd-shift-P to bring up the Command Palette. Type "generate package" and select the "Package Generator: Generate Package" command. Now we need to name the package. Try to avoid naming your package with the atom- prefix, for example we are going to call this package ascii-art.
Atom will open a new window with the contents of our new ascii-art package displayed in the Tree View. Because this window is opened after the package is created, the ASCII Art package will be loaded and available in our new window. To verify this, toggle the Command Palette (cmd-shift-P) and type “ASCII Art”. You’ll see a new ASCII Art: Toggle command. When triggered, this command displays a default message.
Now let’s edit the package files to make our ASCII Art package do something interesting. Since this package doesn’t need any UI, we can remove all view-related code. Start by opening up lib/ascii-art.coffee. Remove all view code, so the module.exports section looks like this:
by deleting everything to the right of the assignment operator for module.exports, as well as everything below the line for “activate:” and modifying activate to look as shown. I am unsure what “Remove all view code” means and trusted that the tutorial shows all of the code that should remain in the file.
I then attempted this portion:
Create a Command Now let's add a command. We recommend that you namespace your commands with the package name followed by a :, so we'll call our command ascii-art:convert. Register the command in lib/ascii-art.coffee:
atom.workspaceView.command “ascii-art:convert”, => @convert()
# This assumes the active pane item is an editor
editor = atom.workspace.activePaneItem
The atom.workspaceView.command method takes a command name and a callback. The callback executes when the command is triggered. In this case, when the command is triggered the callback will call the convert method and insert ‘Hello, World!’.
Again, I made sure what was in the file matched what is pictured. This means what is pictured is the only thing that was in my edited copy of that file.
The errors showed up during the next section:
Reload the Package Before we can trigger ascii-art:convert, we need to load the latest code for our package by reloading the window. Run the command window:reload from the command palette or by pressing ctrl-alt-cmd-l.
Trigger the Command
Now open the command panel and search for the ascii-art:convert command. But it’s not there! To fix this, open package.json and find the property called activationEvents. Activation Events speed up load time by allowing Atom to delay a package’s activation until it’s needed. So remove the existing command and add ascii-art:convert to the activationEvents array:
First, reload the window by running the command window:reload. Now when you run the ascii-art:convert command it will output ‘Hello, World!’
The only thing I changed in this instance was the text for “activationEvents”. I deleted what was in the file and replaced it with what is pictured. Reloading the package caused error messages in Atom. I wasn’t able to quickly trace down what was wrong. I decided to delete the package and start over.
I cannot delete the package and start over.
Atom will not let me delete the package in the file tree on the lefthand side of the screen. I get a message saying I cannot remove the root directory.
Pictured above is my second attempt to delete the package. I received the same message on the first attempt, after which, I uninstalled the package. Notice a directory for the package still exists. It will not go away when I delete it from my local file structure with Windows Explorer.
Please tell me how to permanently remove the package directory. If someone would point me toward info that will tell me what I goofed up with the package creation that would be great.
note: Sorry for all the block quotes, as a new user I am only allowed one image per post.