FunctionGraph allows you to edit function code in the same way as managing a project. You can create and edit files and folders. With the inline editor, you can edit function code from scratch, or modify the function code of an uploaded package. In addition, when the editor is displayed in full screen, you can save code modifications, test functions online, and view the test result, digest, and logs.
Managing Folders and Files
Choose
File from the menu bar, and create files or folders.
Figure 1 shows the
File menu.
Figure 1 File menu
Choose
New File from the drop-down list to create a file with a specified name.
Figure 2 shows the new file.
Figure 2 New file
Choose
New From Template from the drop-down list to create a file with a template.
Figure 3 shows the
New From Template submenu.
Figure 3 Creating a template
Select a template, and create a file with a specified name.
Figure 4 shows the new file.
Figure 4 New file created based on a template
To rename a file or folder, right-click and choose
Rename. To delete the file or folder, right-click and choose
Delete.
Figure 5 shows the shortcut menu.
Figure 5 Renaming a file
Choose File > New Folder to create a folder with a specified name (see Figure 1).
To create a file under the folder, right-click the folder and choose
New File. You can also rename and delete folders and create Python modules.
Figure 6 shows the shortcut menu.
Figure 6 Modifying a folder
Choose File > Close All Files to close all files (see Figure 1).
You can quickly create a multi-level Python module, as shown in
Figure 7.
Figure 7 Multi-level Python module
Edit
The
Edit menu provides options for code editing. Choose
Undo to cancel the previous operation, choose
Redo to restore the previous operation, and choose
Cut to cut the selected code.
Figure 8 highlights these options.
Figure 8 Edit menu
In the
Edit menu, choose
Line to edit code by line.
Figure 9 shows the
Line submenu.
Figure 9 Editing code lines
In the Line submenu, choose Delete Line to delete a code line, choose Delete All Left to delete the code on the left of the cursor in the current line, choose Delete All Right to delete the code on the right of the cursor in the current line, and choose Join Lines to merge the current line with the next line.
Choose
Edit >
Comment to edit comments.
Figure 10 highlights this option.
Figure 10 Editing comments
In the Comment submenu, choose Toggle Line Comment to open the comment of a code line, choose Toggle Block Comment to open the comment of a code block, choose Add Line Comment to add a comment to a code line, and choose Remove Line Comment to delete the comment of a code line.
Choose
Edit >
Folding to expand or collapse code.
Figure 11 shows the
Folding submenu.
Figure 11 Folding or unfolding code
In the Folding submenu, choose Unfold or Fold to expand or collapse all code, and choose Fold Level XX to fold code by level.
Choose
Edit >
Sort to sort code.
Figure 12 shows the
Sort submenu.
Figure 12 Sorting code
In the Edit menu, you can also trim trailing spaces, transform code to uppercase or lowercase letters, and format documents.
Find and Replace
Choose
Find from the menu bar to find or replace a keyword.
Figure 13 shows the
Find menu.
Figure 13 Find menu
Choose
Find >
Find or
Replace to find or replace a keyword.
Figure 14 shows the
Find interface.
Figure 14 Finding a code keyword
Go to
Choose
Go to from the menu bar, and go to a specified position in the code.
Figure 15 shows the
Go to menu.
Figure 15 Go to menu
Choose
Go to >
Go to Line to go to a specified code line.
Figure 16 shows the
Go to Line interface.
Figure 16 Going to a code line
For a large number of code lines, you can choose Go to Bracket or Go to Next Problem (Error, Warning, Info) to respectively switch to the other bracket of a bracket pair or to the next problematic line.
Online Function Test
After configuring a test event for a function, you can click
Test in the full screen mode of the editor to test the function, and view the test result, digest, and logs, as shown in
Figure 17.
Figure 17 Online function test
Other Common Functions
- In the View menu, choose Theme to change the editor theme, and choose Show Command Palette to view all commands. Figure 18 shows the command list.
Figure 18 Viewing all commands
- The inline editor can autocomplete a keyword when you input only the first several letters. Figure 19 shows the associated keywords.
Figure 19 Associated keywords
- The left pane can be adjusted to expand the working area. To open a local code file, drag it to the editor.
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.