Useful Pine Editor commands

From the Pine Editor’s Command Palette, you can run commands that affect your code directly or change how the Pine Editor works. You can open the Command Palette by pressing F1 or CTRL/CMD + SHIFT + P, or by right-clicking in the editor and selecting “Command Palette”.

To enter a command, type part of its name to find it in the list, then click on it. Below, we list some useful commands that you might not have used before.

Text display and hints

The following commands change the appearance of text in the Pine Editor or trigger useful code hints.

Command


Description


Decrease Editor Font Size

Makes the text in the Pine Editor smaller.

Increase Editor Font Size

Makes the text in the Pine Editor larger.

Reset Editor Font Size

Resets the text in the Pine Editor to the default size.

Trigger Parameter Hints

When the cursor is between the parentheses of a function or method, this command opens the "Parameters hint" pop-up window that shows the function and parameter descriptions.

Trigger Suggest


Displays a dropdown list of code suggestions, if any are available. For example, if the cursor is within the parentheses of a function or method call, the list includes the function's available parameters. In other instances, the list can include code keywords that contain the characters next to the cursor.

View: Toggle Word Wrap

Enables or disables word wrapping in the Pine Editor. This command overrides the “Use word wrap by default” option in the Pine Editor settings.

Text selection and transformation

You can use the following commands to find and select text, change case, rearrange code lines, and quickly comment or uncomment lines.

Command

Description

Add cursor above/below

Adds an extra cursor at the same text column on the line above or below the main cursor.

Add cursors to top/bottom

Adds an extra cursor at the same text column on every line above or below the main cursor.

Add Selection To Next Find Match

Highlights the next instance of the currently selected text and allows you to change both instances at the same time.

Add Selection To Previous Find Match

Highlights the previous instance of the currently selected text and allows you to change both instances at the same time.

Sort Lines Ascending

Sorts all selected code lines in ascending order.

Sort Lines Descending

Sorts all selected code lines in descending order.

Toggle Line Comment

Comments or uncomments the line that the cursor is on. If multiple lines are highlighted, this command comments or uncomments all of them.

Transform to Camel Case

Transforms the selected text to camel case, likeThisExample.

Transform to Kebab Case

Transforms the selected text to kebab case, like-this-example.

Transform to Lowercase

Transforms the selected text to all lowercase, like this example.

Transform to Snake Case

Transforms the selected text to snake case, LIKE_THIS_EXAMPLE.

Transform to Title Case

Transforms the selected text to title case, Like This Example.

Transform to Uppercase

Transforms the selected text to all uppercase, LIKE THIS EXAMPLE.

Trim Trailing Whitespace

Removes all whitespace characters from the end of the selected lines.

Folding commands

Use the following commands to work with text folds. A fold is a collapsible region of code in the Pine Editor. When you hover over any line number, a downward-facing arrow appears next to each section of code that contains a fold. If you click an arrow, the section is folded, and the arrow points rightwards. Clicking the arrow again unfolds the section.

Folds thus work similarly to text regions. To create a collapsible text region in your code, type the //#region annotation on the first line of the region, and //#endregion on the last line.

Command

Description

Create Folding Range from Selection

Creates a folding range from the selected text.

Fold/Unfold/Toggle Fold

Collapses or expands a folding range.

Fold All/Unfold All

Collapses or expands all folding ranges in the script.

Fold/Unfold All Except Selected

Collapses or expands all folding ranges in the script except the selected range.

Fold/Unfold All Regions

Collapses or expands all code regions that are marked with //#region and //#endregion annotations.

Remove Manual Folding Ranges

Removes any folding ranges that you added to the code, within the selected lines.

Fold Level 1-7

Collapses embedded ranges. For example, Fold Level 2 collapses all regions contained within a top-level region. Fold Level 1 is equivalent to the "Fold All" command.

Fold/Unfold Recursively

Collapses or expands the selected range and all ranges inside it.