Keyboard Shortcuts¶
This page lists keyboard shortcuts for plugin-specific features. Standard JetBrains shortcuts (copy, paste, find, etc.) are not listed here.
Note
Shortcuts shown are for macOS. On Windows/Linux, replace Cmd with Ctrl and Option with Alt.
Editing¶
Shortcut |
Action |
|---|---|
|
Format file (rescript format) |
|
Toggle line comment |
|
Toggle block comment |
|
Smart Enter (complete statement + new line) |
|
Move declaration up |
|
Move declaration down |
|
Show intentions (Wrap with Some/Ok/Error, etc.) |
|
Surround with (if/switch/try/block) |
|
Optimize imports (remove duplicate opens) |
|
Unwrap/Remove (Some/Ok/Error/if/switch/try/block) |
|
Smart Join Lines (pipe/let/arrow aware) |
|
Move element left/right |
|
Code block boundary selection |
Tips¶
Alt+Enter is the Swiss Army knife shortcut for quick fixes and context-aware actions. Place your cursor on an expression and press Alt+Enter to see available intentions. For example, on any expression you can choose Wrap with Some(…), Wrap with Ok(…), or Wrap with Error(…) to wrap the expression in an option or result constructor. On a declaration without a @genType annotation, you can choose Add @genType to add the decorator. The available intentions change depending on what is under the cursor.
Format file (Cmd+Option+L) runs rescript format through the language server on the current file. This reformats the entire file according to the standard ReScript style. Unlike some formatters that only adjust whitespace, rescript format can also normalize syntax (e.g., standardizing arrow function formatting). Since formatting requires the LSP, this shortcut has no effect when the language server is disconnected.
Smart Enter (Shift+Enter) is a time-saver when you want to start a new line below the current one without moving to the end of the line first. It completes the current statement contextually and positions the cursor on a new line with proper indentation.
Move declaration up/down (Alt+Shift+Up/Down) moves the entire top-level declaration at the cursor position up or down. Unlike the standard line-move shortcut, this operates on logical declarations — it moves the whole let binding, type definition, or module block as a unit. This is useful for reordering declarations within a file without cut-and-paste.
Surround with (Ctrl+Alt+T) wraps the selected code in a control structure. Select an expression or block of code, press the shortcut, and choose from if ... { }, switch ... { }, try { } catch { }, or { } (plain block). The selected code is placed inside the chosen structure with the cursor positioned for you to fill in the condition or pattern.
Optimize imports (Ctrl+Alt+O) removes duplicate open statements from the file. If you have accidentally opened the same module multiple times, this shortcut cleans them up in one action.
Unwrap/Remove (Ctrl+Shift+Delete) removes a surrounding wrapper and extracts the inner expression. Place your cursor inside Some(expr), Ok(expr), Error(expr), if, switch, try, or bare braces, and choose which wrapper to remove. This is the inverse of the “Wrap with” intention actions.
Smart Join Lines (Ctrl+Shift+J) joins the current line with the next using ReScript-aware logic. When joining pipe chains (->), lines are joined without adding a space. When joining let bindings or arrow functions, a single space is inserted after = or =>.
Refactoring¶
Shortcut |
Action |
|---|---|
|
Rename symbol |
|
Extract Variable |
|
Extract Function |
|
Inline Variable/Function |
|
Change Signature |
|
Safe Delete |
Tips¶
Rename symbol (Shift+F6) renames the identifier at the cursor and updates all references across the project. This works for let bindings, type names, module names, and other named entities. Since it relies on semantic analysis, it requires the LSP to be connected.
Extract Variable (Ctrl+Alt+V) extracts the selected expression into a new let binding placed above the current statement. The original expression is replaced with a reference to the new binding. This is useful for breaking up complex expressions into named intermediate values that improve readability.
Extract Function (Ctrl+Alt+M) extracts the selected code into a new function. The plugin analyzes which variables from the surrounding scope are used in the selection and generates the appropriate parameters. The original code is replaced with a call to the new function.
Inline Variable/Function (Ctrl+Alt+N) is the inverse of extraction: it replaces a variable or function reference with its definition and removes the original binding. Use this to simplify code when an intermediate variable or wrapper function adds no clarity.
Change Signature (Ctrl+F6) opens a dialog to modify a function’s parameters — add, remove, reorder, or rename them. All call sites are updated automatically to match the new signature. This is especially useful for adding labeled arguments to an existing function.
Safe Delete (Alt+Delete) deletes a symbol only after verifying that it has no remaining usages in the project. If usages are found, a dialog shows them so you can review and decide whether to proceed. This prevents accidental breakage from removing a function or type that is still referenced elsewhere.
Completion¶
Shortcut |
Action |
|---|---|
|
Trigger code completion |
|
Expand live template |
|
Postfix: wrap in switch |
|
Postfix: add pipe operator |
|
Postfix: wrap in Console.log |
|
Postfix: wrap in Some(…) |
|
Postfix: wrap in Ok(…) |
|
Postfix: wrap in Error(…) |
|
Postfix: pipe to ignore |
|
Postfix: wrap in Promise.then chain |
|
Postfix: prepend await |
Tips¶
Code completion (Cmd+Space) triggers the LSP completion popup, which provides context-aware suggestions based on the current scope and expected type. The completions include module members, record fields, variant constructors, and function names. Type information is shown alongside each suggestion, so you can distinguish between functions with similar names. Pressing Tab or Enter on a suggestion inserts it.
Postfix templates are one of the most productive features for writing idiomatic ReScript. They work by typing a dot (.) after an expression and then the template name. The expression is automatically rewritten into the expanded form.
The .switch postfix is especially useful when you want to pattern-match on a value. Type myOption.switch and the expression is rewritten to switch myOption { | _ => } with the cursor positioned after the arrow, ready for you to fill in the cases. This is faster than typing the switch keyword, parentheses, and braces manually.
The .pipe postfix converts expr.pipe into expr->, which is the standard ReScript pipe-first syntax. This is convenient when chaining operations: you can type the initial expression, add .pipe, and immediately start typing the function name.
The .log postfix wraps an expression in Console.log(...) for quick debugging. Type myValue.log and it becomes Console.log(myValue). This is the fastest way to add a debug print statement.
The .some, .ok, and .error postfix templates wrap the preceding expression in the corresponding constructor: Some(...), Ok(...), or Error(...). These are handy when you need to lift a plain value into an option or result type.
The .ignore postfix appends ->ignore to the expression, which discards the return value. This is a common pattern in ReScript when calling a function for its side effects but not using the return value.
Live templates are expanded with Tab after typing the abbreviation. Unlike postfix templates (which transform existing expressions), live templates insert new code patterns. For example, typing let followed by Tab expands into a let binding skeleton with tab stops for the name and value.
Code Generation¶
Shortcut |
Action |
|---|---|
|
Generate menu (Switch Arms, Module Type) |
Tips¶
The Generate menu (Cmd+N) provides code generation actions that create boilerplate code from context. Place your cursor inside a switch expression and choose Generate Switch Arms to automatically generate pattern match arms for all constructors of the matched variant type. This is especially useful for large variant types where manually typing all cases is tedious and error-prone.
Generate Module Type creates a module type signature from the current module’s contents. This can save time when you need to create a .resi interface file or define a module type for a functor argument.
Running¶
Shortcut |
Action |
|---|---|
|
Run current configuration |
|
Run Anything (ReScript CLI commands) |
|
Debug compiled JavaScript |
|
Expression Type (show inferred type) |
|
Open Problems panel |
Tips¶
Run current configuration (Ctrl+R or Shift+F10) executes the currently selected run configuration, which is typically a ReScript build command. The plugin automatically creates run configurations based on the rescript.json file in your project. You can also run tests directly from gutter icons next to test functions.
Run Anything (Ctrl+Ctrl) opens a universal run dialog where you can type rescript build, rescript clean, or rescript format to execute ReScript CLI commands directly without creating a run configuration.
Debug Compiled JS (Alt+Shift+D) resolves the current .res file to its compiled JavaScript output and launches a node --inspect-brk debug session. This requires the JavaScript Debugger plugin and a prior ReScript build.
Expression Type (Ctrl+Shift+P) shows the inferred type of the expression at the cursor position. This is an on-demand alternative to inlay hints — useful when you need to check a specific type without persistent annotations.
The Problems panel (Alt+6) displays all diagnostics reported by the language server: type errors, syntax errors, and warnings. Each entry shows the file, line number, and error message. Double-clicking an entry jumps to the exact location in the source file. This panel is the central place for reviewing all issues in your project at a glance.
View¶
Shortcut |
Action |
|---|---|
|
Expand all folds |
|
Collapse all folds |
|
Expand fold at cursor |
|
Collapse fold at cursor |
Tips¶
Code folding helps manage large files by collapsing regions you are not currently working on. The plugin supports folding for all top-level declarations (let, type, module, external), block comments, and custom region markers (//#region … //#endregion).
Collapse all folds (Cmd+Shift+Minus) is particularly useful when opening a large file for the first time: it gives you a high-level overview of all declarations, similar to the Structure View but inline. You can then selectively expand individual declarations with Cmd+Plus to drill into the ones you need.
Custom region markers let you define your own foldable sections. Add //#region Section Name and //#endregion comments around a group of related declarations, and the IDE treats them as a collapsible unit. This is handy for organizing utility modules or grouping related functions.