From f1632532b9d3e136d464639b661a32dac020fa31 Mon Sep 17 00:00:00 2001 From: gurpreetsinghmatharoo Date: Tue, 24 Dec 2024 11:40:46 +0530 Subject: [PATCH 01/10] docs(feature): initial (unfinished) work on ce2 new snippets --- .../Code_Editor_Properties/Code_Snippets.htm | 32 ++++++++++++++----- 1 file changed, 24 insertions(+), 8 deletions(-) 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..96a7db03a 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,48 @@

Code Snippets

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.

Using Snippets

-

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.

Custom Snippets

-

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 also define your own code snippets if you want to. 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:

+

Each .tmSnippet file must contain one snippet. The following rules must be followed for the file:

+ + +

These snippets must follow a specific format where:

+ +

More rules about the snippet syntax can be found here. 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.

+

Legacy Code Editor

+

When using the Legacy Code Editor, you can press F4 to open the code snippet pop-up:

+

Code Snippets WindowFrom 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.

+

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:

Code Snippets Example

-

Legacy Code Editor

-

When using the Legacy Code Editor, you can press F4 to open the code snippet pop-up:

-

Code Snippets WindowFrom 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.

 

 

-
© Copyright YoYo Games Ltd. 2023 All Rights Reserved
+
© Copyright YoYo Games Ltd. 2024 All Rights Reserved
-

Code Editor Preferences

+

Code Editor 2 Preferences

This page describes all the preferences for The Code Editor (Beta), which contains the following sections:

Mini TOC (placeholder)

@@ -25,8 +25,8 @@

Code Editor Preferences

Main

The main section contains the following options:

@@ -88,7 +88,7 @@

Editing

Theme

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.

Theme Selector

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/The_Text_Editor.htm b/Manual/contents/The_Asset_Editors/The_Text_Editor.htm index 34211fc77..7f421a033 100644 --- a/Manual/contents/The_Asset_Editors/The_Text_Editor.htm +++ b/Manual/contents/The_Asset_Editors/The_Text_Editor.htm @@ -4,7 +4,7 @@ - The Code Editor (Beta) + Code Editor 2 (Beta) @@ -12,8 +12,8 @@ -

The Code Editor (Beta)

-

The Code Editor is used to edit text files in your GameMaker projects.

+

Code Editor 2 (Beta)

+

Code Editor 2 is used to edit text files in your GameMaker projects.

You will mostly use this to edit Object Events and Scripts, however it is also used for:

-

If your game contains any Included Files or Extension files of the formats given below, they will be editable in the Code Editor through the right-click menu:

+

If your game contains any Included Files or Extension files of the formats given below, they will be editable in Code Editor 2 through the right-click menu:

Included Files Supported Formats

    @@ -46,13 +46,13 @@

    The Code Editor (Beta)

Editor Frame

-

The Code Editor always opens in a new workspace tab, containing the editor itself, with a frame around it:

+

Code Editor 2 always opens in a new workspace tab, containing the editor itself, with a frame around it:

 Closing an editor window will automatically save any unsaved changes in open documents.

This page covers all parts of the Editor Frame. For information on writing code inside the editor, see Editing Code and Code Completion.

Workspace Tab Menu

-

 Right-clicking the workspace tab for the Code Editor will display the following options:

-

These are the Code Editor-specific options:

+

 Right-clicking the workspace tab for Code Editor 2 will display the following options:

+

These are the Code Editor 2-specific options:

 Changing the active document when you have split views open will remove those split views and reset the editor to a single view.

@@ -117,13 +117,13 @@

Horizontal Scrollbar

The horizontal scrollbar appears at the bottom of the frame, to scroll left or right. This has the following parts:

Further Reading

-

Read these pages to learn more about writing code in the Code Editor:

+

Read these pages to learn more about writing code in Code Editor 2:

 

-

So, to answer our question of "What is programming?", we can say that programming is using a combination of statements  - which can use variabless to form expressionsfunctions to perform tasks, and conditionals to ask questions - and then run these statements concurrently to achieve an objective. Below you can see a slightly more complex program in GML Visual and GML. Can you guess what it does?

+

So, to answer our question of "What is programming?", we can say that programming is using a combination of statements  - which can use variables to form expressionsfunctions to perform tasks, and conditionals to ask questions - and then run these statements concurrently to achieve an objective. Below you can see a slightly more complex program in GML Visual and GML. Can you guess what it does?

GML VisualFinal Code Example

or:

if (mouse_check_button_pressed(mb_left) == true)