Skip to main content

Settings

There are many options in RunJS that can be modified via the preferences window. This can be accessed through the app menu: RunJS > Settings. On Windows/Linux - File > Settings.

The settings are split across a number of tabs, starting with the general settings.

Settings - General

From the General tab, you can control a variety of options that change the behaviour of RunJS.

Auto-Run - Your code will execute as you type it. If this option is disabled, a button labelled Run will be visible in the editor pane. Your code will then be executed when the button is clicked.

Line Wrap - Lines that are longer than the width of the pane will be wrapped.

Vim Keys - Use Vim key bindings for editing and traversing your code.

Close Brackets - Closing brackets will be automatically inserted when an opening bracket is typed.

Match Lines - The results of your code will be displayed on the same line within the output pane as the corresponding source line.

Scrolling - This controls the scrolling behaviour. There are three options to choose from Standard, Synchronous and Automatic. When the Synchronous option is selected, the editor and output panes will be scrolled together. When the Automatic option is selected, the output pane will automatically scroll down as the output results are displayed.

Confirm close - When closing a tab, a confirmation dialog will appear. The tab will only be closed upon confirmation.

Autocomplete - Code suggestions will be displayed while typing.

Linting - A TypeScript language service will analyze your coding for problems and report errors and warnings.

Hover info - Hover over a symbol to quickly see its type information and relevant documentation.

Signatures - As you write a function call, information about the function signature will be displayed in a tooltip.

Build

Settings - Build

The Build tab provides options for how your code is built each time it is run. It's split into two section, Transform and Proposals.

Transform

  • TypeScript: Toggle support for TypeScript, allowing you to compile your TypeScript code into JavaScript before execution.
  • JSX: If you're working with React or similar libraries, enable support for transforming JSX syntax into standard JavaScript.

Proposals

In this section, you can enable experimental JavaScript features that are not yet part of the official standard (ECMAScript) but are available as proposals. These include:

  • Optional Chaining: Adds support for optional chaining (?.), allowing you to access deeply nested properties without worrying about null or undefined values.
  • Regexp modifiers: Enable experimental regular expression features, like the s (dotAll) flag, which allows the dot (.) in regular expressions to match newline characters as well.
  • Do expressions: This proposal allows using blocks as expressions, meaning you can execute multiple statements in a block and return a value from it. It's useful when you want more control over block-level evaluation within an expression context.
  • Function sent: Adds a new feature for generators, introducing the function.sent expression, which provides the value passed to the generator when its iterator's next() method is invoked.
  • Pipeline operator: Adds a new operator |>, which allows for more readable function composition. It lets you pipe the result of one expression as input into another function, improving readability for chains of function calls.
  • Partial application: Enables the use of partial functions by allowing placeholders (?) for arguments that will be supplied later. This is useful when you want to pre-define part of a function and complete it later.
  • Throw expressions: This proposal allows throwing exceptions directly within expressions, providing a shorthand for throwing errors in contexts where statements wouldn't be valid, such as in ternary operations.
  • Decorators: This enables support for decorators, which allow you to attach behavior to classes and class methods. It's commonly used for meta-programming tasks, like annotating or modifying class definitions or method behavior.

Formatting

Settings - Formatting

RunJS provides the ability to format your code via Prettier. Formatting can be triggered via the Action menu: Action > Format Code. Formatting can also be triggered automatically when Auto-format is enabled. Triggering each time your code is run manually.

For more information about the formatting options available here, please see the Prettier documentation.

Appearance

Settings - Appearance

From the Appearance tab, you can control various visual aspects of RunJS. The following options are available:

Theme - A selection of themes are available that have been inspired by popular color palettes and themes from other editors.

Font - A number of popular fonts that work well with code are available pre-loaded. You can also select fonts from your computer.

Font Size - The size of the font in pixels.

Line Numbers - Each line in the editor and output panes will be numbered.

Invisibles - Space characters will appear visible.

Active Line - The line that the cursor is currently on will appear highlighted.

Tab Bar - The tab bar will remain visible even if only one tab is present.

Output Highlighting - Output results will have syntax highlighting.

Activity Bar - This controls the visibility of the activity bar.

AI

Settings - AI

The AI tab provides options to connecting to the Open AI API. This is used by the AI chat feature.

Advanced

Settings - Advanced

The Advanced tab provides a set of options that can change the behaviour of RunJS in intricate ways. The following options are available:

Expression Results - With this option enabled, RunJS will display the result of each top-level expression.

Show Undefined - In JavaScript, any statement that doesn't return a value or is not itself a literal value will result in an undefined value. As many statements are likely to result in an undefined value, it is recommended to keep this option disabled to reduce the amount of noise this would create in the output pane.

Loop Protection - With this option enabled, execution will be halted when the iterations of a loop reach 2000. The aim of this is to guard against unintentionally running an infinite loop.