[tp widget="default/tpw_default.php"]

how to write atom package

how to write atom package

how to write atom package插图

How do I install a package in atom?

Atom Packages. In order to install a new package, you can use the Install tab in the now familiar Settings View. Open up the Settings View using Ctrl+,, click on the Install tab and type your search query into the box under Install Packages.

How to install and configure Atom editor?

Open Atom editor and from the top menu, go to Edit-Preferences. You’ll see a Settings tab now. In here, go to the Install option from the left sidebar. You’ll now see some featured packages. You can also search for packages based on the name. Installing these packages is as simple as clicking the install button.

How to setup atom for writing JavaScript?

How To Setup Atom For Writing JavaScript? Before you begin to write and run a JavaScript program or script in Atom, you need two Atom packages: Install Node.js on your system. This will enable you to write JavaScript code in your editor by providing access to JS commands and functionalities.

How to generate atom packages in Python?

Indeed, we will use the Package Generator command which is brought to us by Atom core. To do that, you will just have to navigate into Packages – Package Generator – Generate Atom Package. In order to generate your package, you can choose the language between Javascript and Coffeescript .

What is the engine entry in Atom?

The engines entry can be used to indicate the minimal required version of Atom for your package to work. In the same vein, we find the dependencies entry to indicate other packages needed by your package. It must be used if you create a plugin for another package. Then we find the repository entry.

How to add syntax highlighting rules?

To add new syntax highlighting rules, you need to create a subfolder named grammars. In this folder, create a new CSON file named after the language you want to support (e.g. mylanguage.cson ). This file will contain all your syntax highlighting rules.

Where is Atom installed?

This folder is named .atom, and is located in your personal folder ( /home/user/.atom for instance). The packages you install are all located in the packages subfolder of this folder.

What is package.json file?

This file contains some information, like the name of your package or the repository where we can find it. Below is the package.json file of our language-mylanguage package (explanations follow):

What is the parentheses in regex?

Our regex contains capturing parentheses around function and the name of the function. As in other languages, these captures can be retrieved thanks to the captures entry. The 1 then refers to the first capture (the function keyword) and the 2 refers to the second (the name of the function). We apply the right class names to them with name.

What is theme in Atom?

In Atom, it’s the theme that decides which style will be displayed for element you want to highlight. These themes try to be compatible with the more languages possible, so they use these conventions.

Is Scilab a language?

Recently I wanted to develop some programs in the Scilab language. As it’s a language used in maths , it’s not really the type of language we find by default in Atom , and there was no package for its syntax. That’s why I decided to write my own package: language-scilab.

How to create a package in Atom?

To do that, you will just have to navigate into Packages -> Package Generator -> Generate Atom Package.

How to run package spec in Jasmine?

In order to run the specs tests, you just have to navigate into the following menu: View -> Packages -> Run Package Specs.

What is the main feature of Atom?

The main interesting feature of Atom is that it also has a great package management tool and packages are also written in Javascript so it’s quite easy for anyone to create one. This article aims to talk about it. Finally, its community is also active as it already has a lot of available packages: 5 285 at this time. You can browse all packages by going to the following address: https://atom.io/packages.

How to write a Jasmine test?

Jasmine specs tests are written in the following way: 1 describe () : A Jasmine test suite starts with a “describe” function which takes a name as the first argument and a function as the second, 2 it () : A specification is added by using this function, “it” has to be contained into a specification, 3 expect () : This one is an assertion, when we expect something to happen.

What are atom settings?

Atom settings allow multiple setting types ( boolean , color , integer , string , …) so it can fit your needs on setting values by your users.

How to test Atom command?

This command will execute the code contained in the toggle () method of the class and will display a little modal at the top of the window . You can add as many commands as you want and I really encourage you to decouple your code.

What is the first element to add to your package?

The first element to add to your package is the package.json file which has to contain all information of your package such as its name, version, license type, keywords that will enable you to find your package into Atom registry and also your package dependancies.

What framework does Atom use?

Atom uses the Jasmine framework for its tests. Tests are placed in the spec/ top-level directory and files within must end with -spec (e.g. fancy-component-spec.js ). Tests aren’t required to run your package or publish it, but they are a good way to back up the quality of your code and make sure nothing breaks when adding new features.

What is a pane in Atom?

A pane is the individual window in Atom. It contains all open tabs, called “items”. These panes are stored in the atom.workspace object. With atom.workspace.getActivePane () you are requesting the current active pane. A pane object doesn’t contain any DOM elements, but all the instances of Atom’s internal components (e.g. TextEditor, GutterContainer, NotificationManager ). Understanding these panes is essential to create custom views for your package.

What is serialization in Atom?

Serialization is a powerful, but again optional, feature of Atom packages. Serialization/deserialization happens when a window is shutting down, refreshed or restored from a previous session. It is up to you to define which and how many of your components should serialize their data. What’s important is that it returns JSON. If you have a view, and want that to be able to be refreshed, you need to make it compatible with serialization and deserialization.

What is a package subscribed to?

A package usually subscribes to multiple events like adding custom commands, listening to changes, or modified files. It is possible to bundle these into an instance of CompositeDisposable (), and this way they can all be disposed of at once.

What is activate function?

The activate () function is the only required method. Initialise all your modules, views or helpers here. It is passed an object, containing the previous serialized state of your package. If you don’t serialize anything in your package, it will be an empty object. That means, it is entirely up to you and your package architecture on what to serialize.

What is a Babel compiler?

Babel is a source-to-source compiler; turning ECMAScript 2015 (formerly known as ES6) code into ECMAScript 5 code. Since the environment is Chromium, there are already a lot of supported ES2015 features available. But instead of always looking up which ones are implemented, I recommend using Babel to transpile your code. In a later release — when ES2015 is better supported in Chromium — you can deactivate Babel again and keep your code base (almost) untouched.

What is Atom application?

Atom is a Node.js and Chromium based application, written with GitHub’s Electron framework. That means it is technically a web application, running on the desktop. Atom’s internal functionality is split up into tiny core packages; they’re developed the same way as any other package from the community. Although they are all written in CoffeeScript, it is possible to either write them in plain JavaScript, or transpile them via Babel.

What is Atom package?

As we mentioned previously, Atom itself is a very basic core of functionality that ships with a number of useful packages that add new features like the Tree View and the Settings View.

How to change the default variables in a package?

Clicking on the "Settings" button for a package will give you the settings screen for that package specifically. Here you have the option of changing some of the default variables for the package, seeing what all the command keybindings are, disabling the package temporarily, looking at the source code, seeing the current version of the package, reporting issues and uninstalling the package.

How to update Atom packages?

If a new version of any of your packages is released, Atom will automatically detect it and you can upgrade the package from either this screen or from the "Updates" tab. This helps you easily keep all your installed packages up to date.

How to find Atom themes?

These can be either UI themes or syntax themes and you can search for them from the "Install" tab, just like searching for new packages. Make sure to press the "Themes" toggle next to the search box.

How to see what a theme looks like on Atom?

Clicking on the theme title will take you to a profile page for the theme on atom.io, which often has a screenshot of the theme. This way you can see what it looks like before installing it.

Can you install packages from the command line?

You can also install packages or themes from the command line using apm.

What is the Atom command line tool?

As I mentioned earlier, Atom provides a command line tool called apm (short for Atom Package Manager) that allows you to do all things you can do graphically, in the command line. It will show you all the packages matching your search query.

How to see all packages in Atom?

To see the installed packages, from the left sidebar, choose Packages option. This will show you all installed packages in your Atom editor.

Where is Atom installed?

The package usually gets installed in .atom/packages directory in your home directory. This is why you don’t need to use sudo while installing Atom packages.

Is Atom a good open source editor?

Atom is undoubtedly one of the best open source code editors available for any platform. Developed by GitHub, Atom takes pride in pitching itself as the hackable text editor for the 21st century. How is it a ‘hackable’ text editor?

Can you install Atom plugins from terminal?

If you are not too comfortable with the terminal, don’t worry. You can also install Atom plugins graphically from within the terminal.

Is Atom dead?

This is a great write up. However, Atom is all but dead since MS purchased GitHub and shifted almost all development to VSCode.

How to start hacking Atom?

To start hacking, make sure to run atom –dev from the package directory. Cut a branch while you’re working then either submit a Pull Request when done or when you want some feedback!

How to change the default language in Atom?

Change Default Language by opening Atom Settings as follows: Atom→Preferences→Open Config Folder. Then, you can use the tree-view to navigate to and open packages→script→lib→grammar→python.js to make your edits. It is also possible to directly edit the code under .atom/packages/script/lib/grammars/python.js

What is a script run with profile?

Profiles can be added in Script: Run Options dialog. Script: Kill Process will kill the process but leaves the pane open. Script: Close View closes the pane and kills the process.

What is commit access?

Individuals making significant and valuable contributions are given commit-access to the project to contribute as they see fit.

What is a script that runs while text is selected?

Script: Run while text is selected will perform a "Selection Based" run executing just the highlighted code.

What is the rule of a script?

Scripts must contain a rule with the head main (e.g. main:- parent (X,lucas),writeln (X). ). The script is executed with the goal main and exits after the first result is found. The output is produced by the writeln/1 predicates.

What is a run script based on?

Run scripts based on file name, a selection of code, or by line number.

How to install atom packages

Atom packages can either be installed using a CLI or through Atom itself.

Recommended Packages

File Icons updates the tree-view and tab icons within Atom to show an icon which represents the file type. This is very handy when quickly trying to find a particular file.


Atom Pigments visualises CSS colours such as Hex and RGB. But it also parses css-preprocessor variables as well as functions. One feature that the below animation doesn’t represent which I find helpful is that it will also pick up the value of the preprocessor variables, even when they’re declared in different files.

Highlight Selected

The Highlight Selected package is simple, but very useful. When you select a word in the document, all other instances of this word are highlighted.

Todo Show

Todo Show will collate all the TODO comments throughout your code and display them in a quick table. Each record will also have a quick link through to the file and line of code containing the TODO.


The Emmet package is a plugin for the original emmit toolkit. Basically this allows you to write CSS selectors in HTML which by pressing tab will parse into a HTML structure.


EditorConfig is a universal file format which helps developers define and maintain consistent coding styles between different editors and IDEs.

Can You Run JavaScript In Atom?

Yes, we can run JavaScript inside the Atom editor itself. All you need is to download and install the Script Package in Atom.

How to run a JS file?

To run this JS file, go to the menu bar, click Packages -> Script -> Run Script as shown in the screenshot above.

What is Skillshare learning?

Skillshare is an online learning platform with courses on pretty much anything you want to learn. To learn more about Skillshare and its vast library of courses and get 30% off, click the link below:

What is Atom code?

Atom is one of the most well-known source code editors for JavaScript out there. It is free of cost, flexible, customizable, and is entirely built using HTML, CSS, JavaScript, and Node.js integration.

How many Atom packages are needed to run JavaScript?

Before you begin to write and run a JavaScript program or script in Atom, you need two Atom packages:

How to install Atom on Windows?

To install any Atom package on Windows, all you need to do is go to File -> Settings -> Install.

What is the Productive Engineer newsletter?

If you haven’t already subscribed, please subscribe to The Productive Engineer newsletter. It is filled with tips and tricks on how to get the most out of the productivity apps you use every day. We hate spam as much as you do and promise only to send you stuff we think will help you get things done.