diff --git a/Manual/contents/Setting_Up_And_Version_Information/IDE_Preferences/Text_Editor_2_Preferences.htm b/Manual/contents/Setting_Up_And_Version_Information/IDE_Preferences/Text_Editor_2_Preferences.htm index bf1fa0bac..384bd7bed 100644 --- a/Manual/contents/Setting_Up_And_Version_Information/IDE_Preferences/Text_Editor_2_Preferences.htm +++ b/Manual/contents/Setting_Up_And_Version_Information/IDE_Preferences/Text_Editor_2_Preferences.htm @@ -3,7 +3,7 @@
-This page describes all the preferences for The Code Editor (Beta), which contains the following sections:
Mini TOC (placeholder)
@@ -25,8 +25,8 @@The main section contains the following options:
The Theme section allows you to modify how documents are rendered in the editor.
-The first option is the font used by the Code Editor. Fonts that are fixed-width (which are recommended for coding over non-fixed-width fonts) are bolded in the drop-down list.
The first option is the font used by the Code Editor 2. Fonts that are fixed-width (which are recommended for coding over non-fixed-width fonts) are bolded in the drop-down list.
You can also choose the size of the font, and whether to enable ligatures for fonts that use them.
This contains a drop-drop menu for theme selection, with the default being "GameMaker Dark - Default". You can edit any properties of the default theme.
diff --git a/Manual/contents/The_Asset_Editors/Code_Editor_Properties/Code_Snippets.htm b/Manual/contents/The_Asset_Editors/Code_Editor_Properties/Code_Snippets.htm index 54afa58f3..1b454faa9 100644 --- a/Manual/contents/The_Asset_Editors/Code_Editor_Properties/Code_Snippets.htm +++ b/Manual/contents/The_Asset_Editors/Code_Editor_Properties/Code_Snippets.htm @@ -19,29 +19,92 @@A very handy tool you have at your disposal when editing your code is the use of Code Snippets.
These are pre-made blocks of code you can insert into your code at any time. A snippet can have placeholders, where you can insert expressions while entering the snippet.
In The Code Editor, code snippets are inserted through Code Completion. For example, writing for will show its snippet in the Candidate Window, and pressing enter will insert that snippet.
+In The Code Editor (Beta), code snippets are inserted through Code Completion. For example, writing for will show its snippet in the Candidate Window, and pressing enter will insert that snippet.
Inserting a snippet will highlight its first placeholder. After entering text into that placeholder, press tab to cycle through each placeholder until you have gone through all of them.
You can also define your own code snippets if you want to. Before doing this, you'll need to create a file called "snippets.txt" in one of the following directories:
+You can define your own code snippets. Before doing this, you'll need to create a file with the extension .tmSnippet in one of the following directories:
This folder is not modified during any update to GameMaker, so your edited file will remain intact (but any edits to the base snippets file in the install directory will be reverted).
-Once the file is created in the User directory, you can edit it with any text editor following these rules:
+This folder is not modified during any update to GameMaker, so your edited file will remain intact.
+Each .tmSnippet file must contain one snippet. This is an example snippet file (you can copy this to create your own snippets):
+<?xml version="1.0" encoding="UTF-8"?>
+ <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+ <plist version="1.0">
+ <dict>
+ <key>content</key>
+ <string>CONTENT</string>
+ <key>name</key>
+ <string>NAME</string>
+ <key>scope</key>
+ <string>source.gml</string>
+ <key>uuid</key>
+ <string>UUID</string>
+ <key>tabTrigger</key>
+ <string>Inc</string>
+ </dict>
+ </plist>
This is a basic XML with some keys (with the names "content", "name", "scope" etc.):
+Hotkeys for your snippets can be assigned in the Redefine Keys Preferences under the "Code Editor 2" section. They will be created as unbound by default.
+The snippet content must follow a specific format where:
+You can use the following variables in your snippets:
+ +More rules about the snippet syntax can be found here, including more variables that can be used in your snippets.
+If the legacy snippets.txt file (described in the section below) is found in the User directory, all contained snippets will automatically be converted to .tmSnippet files when the IDE is started.
+When using the Legacy Code Editor, you can press F4 to open the code snippet pop-up:
+From this window you can select with the mouse the snippet to use, or you can press the associated hotkey listed on the right. This will add the snippet to your code for editing.
Snippets for the Legacy Code Editor can be created in the same directories listed above, but instead in a snippets.txt file containing all snippets.
+The following rules must be followed for the snippets file:
Instance Create:
After the colon you add your snippet of code:
-Instance Create:instance_create_layer(x, y, |layer|, object);
+Instance Create:instance_create_layer(x, y, {$0:layer}, object);
The code that you add must also follow a specific format where:
+These snippets must follow a specific format where:
When using the Legacy Code Editor, you can press F4 to open the code snippet pop-up:
-From this window you can select with the mouse the snippet to use, or you can press the associated hotkey listed on the right. This will add the snippet to your code for editing.