Difference between revisions of "Atom Setup"

From the CreationKit Wiki
Jump to navigation Jump to search
imported>Gawdl3y
(Added message to error matching)
imported>Gawdl3y
(Removed info about remote events and ref collections)
 
(6 intermediate revisions by the same user not shown)
Line 1: Line 1:
Atom is an open-source, highly-extensible text editor based on Chromium and Node.js. It was created and is being actively developed by the GitHub team. It can be downloaded from the [https://atom.io/ official Atom site]. Atom has an extremely flexible package system that allows customization of virtually everything about the editor.
[[Category:Scripting]]
[[Category:Text Editors]]
'''Atom''' is a completely free, open-source, highly-extensible text editor based on Chromium and Node.js.
It was created and is being actively developed by the GitHub team.
It can be downloaded from the [https://atom.io/ official Atom site].
Atom's interface and functionality is very similar to Sublime Text, so it's a fairly painless transition if you have experience with it.
Atom has an extremely flexible package system that allows customization of virtually everything about the editor.


== Syntax highlighting and snippets ==
{{See Wikipedia|Atom (text editor)}}
Syntax highlighting for Papyrus and Papyrus assembly is provided by the [https://atom.io/packages/language-papyrus language-papyrus] package. To install it, follow these instructions:


=== Method 1 ===
==Installation==
Open the settings tab (File -> Settings, or Ctrl + Comma), select the "Install" tab on the side, and search for "language-papyrus". When the results appear, click "Install" on the package.
===Install Atom===
#Go to [https://atom.io/ the Atom website], download the setup file, and run it.


=== Method 2 ===
===Install Packages===
Run <code>apm install language-papyrus</code> in a command prompt.
Syntax highlighting and snippets are provided by the [https://atom.io/packages/language-papyrus language-papyrus] package.
Compilation is provided by the [https://atom.io/packages/build build] and [https://atom.io/packages/build-papyrus build-papyrus] packages.
#In Atom, open the settings tab (File -> Settings, or {{key press|Ctrl|,}})
#Select the Install tab on the side
#Search for <code>language-papyrus</code>, then click install on the package when the results appear
#Repeat the previous step for <code>build</code> and <code>build-papyrus</code>
#To see compiler errors inline with your code, also install the <code>[https://atom.io/packages/linter linter]</code> package


== Quick compile ==
Obtain the [https://atom.io/packages/build build] package the same way as above. Then, place the below text in a file called '''.atom-build.json''' (yes, with the leading dot!) in your <code>Skyrim\Data\Scripts\Source</code> directory. Change the path in the <code>cwd</code> setting if you need to (make sure to use double-backslashes). If you don't have the DLC, just remove them from the <code>-import</code> argument.
<pre>{
"cmd": "Papyrus Compiler\\PapyrusCompiler.exe",
"cwd": "C:\\Program Files (x86)\\Steam\\SteamApps\\common\\Skyrim\\",
"sh": false,
"args": [
"{FILE_ACTIVE}",
"-import=Data\\Scripts\\Source;Data\\Scripts\\Source\\Dawnguard;Data\\Scripts\\Source\\Dragonborn;Data\\Scripts\\Source\\Hearthfire",
"-output=Data\\Scripts",
"-flags=TESV_Papyrus_Flags.flg"
],
"env": {},
"errorMatch": "\n(?<file>[A-Za-z0-9_:\\-\\.\\/ \\\\]+\\.(psc|PSC))\\((?<line>[0-9]+),(?<col>[0-9]+)\\): (?<message>.+)"
}</pre>
After placing the .atom-build.json file there, any of the scripts you open in Atom will be able to be compiled simply by pressing '''Ctrl-Alt-B'''.<br />
If there are errors during compilation, clicking a filename in the build output window will take you directly to the spot in your code in which the error occurred. '''Ctrl-Alt-G''' will also jump between any errors.


=== Mod Organizer ===
If your Papyrus Compiler isn't in the default location (<code>C:\Program Files (x86)\Steam\SteamApps\common\Skyrim\Papyrus Compiler\PapyrusCompiler.exe</code>), then you must set it in the build-papyrus package settings:
One of the most common problem modders have with Mod Organizer is getting Papyrus compilation working correctly. Setting up Atom to work with Mod Organizer is simple. You do '''not''' need to launch Atom through Mod Organizer. Instead, just place the above '''.atom-build.json''' file in the mod's scripts source directory that you're working on, e.g. <code>Mod Organizer\mods\Ultra Cool Mod\Scripts\Source</code>. Some tweaking to the file needs to be done, namely changing the <code>-import</code> and <code>-output</code> arguments. Using the prior mod example, your import and output lines would look similar to this:
#In Atom, open the settings tab (File -> Settings, or {{key press|Ctrl|,}})
<pre>"-import=C:\\Program Files (x86)\\Mod Organizer\\mods\\Ultra Cool Mod\\Scripts\\Source;Data\\Scripts\\Source;Data\\Scripts\\Source\\Dawnguard;Data\\Scripts\\Source\\Dragonborn;Data\\Scripts\\Source\\Hearthfire",
#Select the Packages tab on the side
"-output=C:\\Program Files (x86)\\Mod Organizer\\mods\\Ultra Cool Mod\\Scripts",</pre>
#Search for <code>build-papyrus</code> or find it in the list, and click on Settings
If your scripts depend on another mod, just add its script source directory to the <code>-import</code> argument as well, after your mod's directory, but before the Skyrim and DLC directories. Example:
#Change the compiler path setting to your appropriate path
<pre>"-import=C:\\Program Files (x86)\\Mod Organizer\\mods\\Ultra Cool Mod\\Scripts\\Source;C:\\Program Files (x86)\\Mod Organizer\\mods\\Some Other Mod\\Scripts\\Source;Data\\Scripts\\Source;Data\\Scripts\\Source\\Dawnguard;Data\\Scripts\\Source\\Dragonborn;Data\\Scripts\\Source\\Hearthfire",</pre>
 
==Usage==
===Snippets===
The language-papyrus package includes hundreds of snippets you can use for vanilla Skyrim functions and events, as well as various library mods.
To use a snippet, just begin typing the name of a function/event/other snippet, and a list of matched snippets will appear.
You can choose which one to use with the arrow keys or mouse, and complete it by pressing {{key press|Tab}} or clicking on it.
Immediately after autocompletion, you may be able to cycle through pieces of it by pressing {{key press|Tab}} again, depending on the snippet.
 
===Compilation===
Place the below text in a file called '''.build-papyrus.yml''' (yes, with the leading dot!) in your <code>Skyrim\Data\Scripts\Source</code> directory. If you don't have the DLC, just remove them from the <code>imports</code> list.
<pre>game: skyrim
imports:
    - C:\Program Files (x86)\Steam\SteamApps\common\Skyrim\Data\Scripts\Source
    - C:\Program Files (x86)\Steam\SteamApps\common\Skyrim\Data\Scripts\Source\Dawnguard
    - C:\Program Files (x86)\Steam\SteamApps\common\Skyrim\Data\Scripts\Source\Dragonborn
    - C:\Program Files (x86)\Steam\SteamApps\common\Skyrim\Data\Scripts\Source\Hearthfire
output: C:\Program Files (x86)\Steam\SteamApps\common\Skyrim\Data\Scripts\
optimize: true</pre>
After placing the .build-papyrus.yml file there, any of the scripts you open in Atom will be able to be compiled simply by pressing {{key press|Ctrl|Alt|B}} or {{key press|F9}}.<br />
If there are errors during compilation, clicking a filename in the build output window will take you directly to the spot in your code in which the error occurred. {{key press|Ctrl|Alt|G}} will also jump between any errors.
 
====Mod Organizer====
One of the most common problem modders have with Mod Organizer is getting Papyrus compilation working correctly. Setting up Atom to work with Mod Organizer is simple. You do '''not''' need to launch Atom through Mod Organizer. Instead, just place the above '''.build-papyrus.yml''' file in the mod's scripts source directory that you're working on, e.g. <code>Mod Organizer\mods\Ultra Cool Mod\Scripts\Source</code>. Some tweaking to the file needs to be done, namely changing the <code>imports</code> and <code>output</code> settings. Using the prior mod example, your imports and output settings would look similar to this:
<pre>imports:
    - C:\Program Files (x86)\Mod Organizer\mods\Ultra Cool Mod\Scripts\Source
    - C:\Program Files (x86)\Steam\SteamApps\common\Skyrim\Data\Scripts\Source\Dawnguard
    - C:\Program Files (x86)\Steam\SteamApps\common\Skyrim\Data\Scripts\Source\Dragonborn
    - C:\Program Files (x86)\Steam\SteamApps\common\Skyrim\Data\Scripts\Source\Hearthfire
    - C:\Program Files (x86)\Steam\SteamApps\common\Skyrim\Data\Scripts\Source
output: C:\Program Files (x86)\Mod Organizer\mods\Ultra Cool Mod\Scripts</pre>
If your scripts depend on another mod, just add its script source directory to the <code>imports</code> list as well, after your mod's directory, but before the Skyrim and DLC directories. Example:
<pre>imports:
    - C:\Program Files (x86)\Mod Organizer\mods\Ultra Cool Mod\Scripts\Source
    - C:\Program Files (x86)\Mod Organizer\mods\Some Other Mod\Scripts\Source
    - C:\Program Files (x86)\Steam\SteamApps\common\Skyrim\Data\Scripts\Source\Dawnguard
    - C:\Program Files (x86)\Steam\SteamApps\common\Skyrim\Data\Scripts\Source\Dragonborn
    - C:\Program Files (x86)\Steam\SteamApps\common\Skyrim\Data\Scripts\Source\Hearthfire
    - C:\Program Files (x86)\Steam\SteamApps\common\Skyrim\Data\Scripts\Source</pre>
 
==Tips and tricks==
*The command palette ({{key press|Ctrl|Shift|P}}) lists every single command available in Atom, with a fuzzy finder. If you ever forget a hotkey, you can search for the command with its full/partial name or whatever shorthand you come up with. Searching {{kbd|brt}} will find <code>Build: Refresh Targets</code>, for example.
*Pressing {{key press|Ctrl|P}} will open a fuzzy finder for all files in the folder you have open. It will list files that match your search in real-time. You can type file names in just about any shorthand you can think of, and it will find them correctly. "comph" will match a file named "CompanionsHousekeepingScript.psc", for example.
*After compiling, if there are any errors, you can cycle through them with {{key press|Ctrl|Alt|G}} or {{key press|F4}}. You can also jump straight to the first error with {{key press|Ctrl|Alt|H}} or {{key press|Shift|F4}}. Additionally, you can click on the errors at the bottom of the window to jump to them. The linter package will also list the errors in a much prettier, more usable way.
*Holding {{key press|Ctrl}} allows you to move lines up and down with the arrow keys.
*{{key press|Ctrl|Shift|D}} duplicates a line.
*Highlight a word, then press {{key press|Ctrl|D}} repeatedly to highlight each occurrence of it in succession. This makes renaming variables and functions quite simple!
*All Events that the compiler supports have been added as snippets, so if you type the name of the event and hit {{key press|Tab}}, it will autocomplete to the full event (with parameters) so you don't have to check the wiki for syntax.
*All the functions on the wiki have been added as snippets. You can type part of the function name and hit {{key press|Tab}} to fill out the function with all the parameters. Hit {{key press|Tab}} to switch between each parameter.
 
==Recommended packages==
To further enhance your experience with Atom, there are thousands of packages for Atom available.
You can browse them within the editor itself, or on the [https://atom.io/packages official packages site].
Here are a few worth taking a look at:
*[https://atom.io/packages/minimap minimap] - Adds a minimap preview of your source code like Sublime Text does
*[https://atom.io/packages/minimap-find-and-replace minimap-find-and-replace] - Highlights all found text on the minimap when finding/replacing code
*[https://atom.io/packages/minimap-selection minimap-selection] - Highlights your text selection on the minimap
*[https://atom.io/packages/highlight-selected highlight-selected] - Highlights all occurrences of your text selection
*[https://atom.io/packages/minimap-highlight-selected minimap-highlight-selected] - Highlights all occurrences of your text selection on the minimap
*[https://atom.io/packages/project-manager project-manager] - Lets you save your Atom workspace as a project, and easily reopen them
*[https://atom.io/packages/clipboard-plus clipboard-plus] - Keeps your clipboard history




{{Languages}}
{{Languages}}
[[Category:Scripting]]
[[Category:Text Editors]]

Latest revision as of 18:07, 20 June 2016

Atom is a completely free, open-source, highly-extensible text editor based on Chromium and Node.js. It was created and is being actively developed by the GitHub team. It can be downloaded from the official Atom site. Atom's interface and functionality is very similar to Sublime Text, so it's a fairly painless transition if you have experience with it. Atom has an extremely flexible package system that allows customization of virtually everything about the editor.

See Wikipedia's page for more information.

Installation[edit | edit source]

Install Atom[edit | edit source]

  1. Go to the Atom website, download the setup file, and run it.

Install Packages[edit | edit source]

Syntax highlighting and snippets are provided by the language-papyrus package. Compilation is provided by the build and build-papyrus packages.

  1. In Atom, open the settings tab (File -> Settings, or Ctrl+,)
  2. Select the Install tab on the side
  3. Search for language-papyrus, then click install on the package when the results appear
  4. Repeat the previous step for build and build-papyrus
  5. To see compiler errors inline with your code, also install the linter package


If your Papyrus Compiler isn't in the default location (C:\Program Files (x86)\Steam\SteamApps\common\Skyrim\Papyrus Compiler\PapyrusCompiler.exe), then you must set it in the build-papyrus package settings:

  1. In Atom, open the settings tab (File -> Settings, or Ctrl+,)
  2. Select the Packages tab on the side
  3. Search for build-papyrus or find it in the list, and click on Settings
  4. Change the compiler path setting to your appropriate path

Usage[edit | edit source]

Snippets[edit | edit source]

The language-papyrus package includes hundreds of snippets you can use for vanilla Skyrim functions and events, as well as various library mods. To use a snippet, just begin typing the name of a function/event/other snippet, and a list of matched snippets will appear. You can choose which one to use with the arrow keys or mouse, and complete it by pressing Tab ↹ or clicking on it. Immediately after autocompletion, you may be able to cycle through pieces of it by pressing Tab ↹ again, depending on the snippet.

Compilation[edit | edit source]

Place the below text in a file called .build-papyrus.yml (yes, with the leading dot!) in your Skyrim\Data\Scripts\Source directory. If you don't have the DLC, just remove them from the imports list.

game: skyrim
imports:
    - C:\Program Files (x86)\Steam\SteamApps\common\Skyrim\Data\Scripts\Source
    - C:\Program Files (x86)\Steam\SteamApps\common\Skyrim\Data\Scripts\Source\Dawnguard
    - C:\Program Files (x86)\Steam\SteamApps\common\Skyrim\Data\Scripts\Source\Dragonborn
    - C:\Program Files (x86)\Steam\SteamApps\common\Skyrim\Data\Scripts\Source\Hearthfire
output: C:\Program Files (x86)\Steam\SteamApps\common\Skyrim\Data\Scripts\
optimize: true

After placing the .build-papyrus.yml file there, any of the scripts you open in Atom will be able to be compiled simply by pressing Ctrl+Alt+B or F9.
If there are errors during compilation, clicking a filename in the build output window will take you directly to the spot in your code in which the error occurred. Ctrl+Alt+G will also jump between any errors.

Mod Organizer[edit | edit source]

One of the most common problem modders have with Mod Organizer is getting Papyrus compilation working correctly. Setting up Atom to work with Mod Organizer is simple. You do not need to launch Atom through Mod Organizer. Instead, just place the above .build-papyrus.yml file in the mod's scripts source directory that you're working on, e.g. Mod Organizer\mods\Ultra Cool Mod\Scripts\Source. Some tweaking to the file needs to be done, namely changing the imports and output settings. Using the prior mod example, your imports and output settings would look similar to this:

imports:
    - C:\Program Files (x86)\Mod Organizer\mods\Ultra Cool Mod\Scripts\Source
    - C:\Program Files (x86)\Steam\SteamApps\common\Skyrim\Data\Scripts\Source\Dawnguard
    - C:\Program Files (x86)\Steam\SteamApps\common\Skyrim\Data\Scripts\Source\Dragonborn
    - C:\Program Files (x86)\Steam\SteamApps\common\Skyrim\Data\Scripts\Source\Hearthfire
    - C:\Program Files (x86)\Steam\SteamApps\common\Skyrim\Data\Scripts\Source
output: C:\Program Files (x86)\Mod Organizer\mods\Ultra Cool Mod\Scripts

If your scripts depend on another mod, just add its script source directory to the imports list as well, after your mod's directory, but before the Skyrim and DLC directories. Example:

imports:
    - C:\Program Files (x86)\Mod Organizer\mods\Ultra Cool Mod\Scripts\Source
    - C:\Program Files (x86)\Mod Organizer\mods\Some Other Mod\Scripts\Source
    - C:\Program Files (x86)\Steam\SteamApps\common\Skyrim\Data\Scripts\Source\Dawnguard
    - C:\Program Files (x86)\Steam\SteamApps\common\Skyrim\Data\Scripts\Source\Dragonborn
    - C:\Program Files (x86)\Steam\SteamApps\common\Skyrim\Data\Scripts\Source\Hearthfire
    - C:\Program Files (x86)\Steam\SteamApps\common\Skyrim\Data\Scripts\Source

Tips and tricks[edit | edit source]

  • The command palette (Ctrl+⇧ Shift+P) lists every single command available in Atom, with a fuzzy finder. If you ever forget a hotkey, you can search for the command with its full/partial name or whatever shorthand you come up with. Searching brt will find Build: Refresh Targets, for example.
  • Pressing Ctrl+P will open a fuzzy finder for all files in the folder you have open. It will list files that match your search in real-time. You can type file names in just about any shorthand you can think of, and it will find them correctly. "comph" will match a file named "CompanionsHousekeepingScript.psc", for example.
  • After compiling, if there are any errors, you can cycle through them with Ctrl+Alt+G or F4. You can also jump straight to the first error with Ctrl+Alt+H or ⇧ Shift+F4. Additionally, you can click on the errors at the bottom of the window to jump to them. The linter package will also list the errors in a much prettier, more usable way.
  • Holding Ctrl allows you to move lines up and down with the arrow keys.
  • Ctrl+⇧ Shift+D duplicates a line.
  • Highlight a word, then press Ctrl+D repeatedly to highlight each occurrence of it in succession. This makes renaming variables and functions quite simple!
  • All Events that the compiler supports have been added as snippets, so if you type the name of the event and hit Tab ↹, it will autocomplete to the full event (with parameters) so you don't have to check the wiki for syntax.
  • All the functions on the wiki have been added as snippets. You can type part of the function name and hit Tab ↹ to fill out the function with all the parameters. Hit Tab ↹ to switch between each parameter.

Recommended packages[edit | edit source]

To further enhance your experience with Atom, there are thousands of packages for Atom available. You can browse them within the editor itself, or on the official packages site. Here are a few worth taking a look at:



Language: English