JetBrains Fleet 1.35 Help

Getting started with JavaScript and TypeScript

This tutorial gets you up to speed with JavaScript development in JetBrains Fleet. It covers the installation, project setup, and working with code. The steps show vanilla JavaScript and Node.js, however you can use them for TypeScript as well.


Download and install Fleet

  1. Download and install JetBrains Toolbox.

  2. In JetBrains Toolbox, click Install near the JetBrains Fleet icon.

    Download and install Fleet

Set up a workspace

Workspace is the directory where your project resides. It contains the project files and settings. You can open an existing project or start a new project by opening an empty directory.

Open a workspace

  1. Press ⌘ O or select File | Open from the menu.

  2. In the file browser, navigate to an empty folder where you want to store your code and click Open.

When you open a directory, it becomes the root of a workspace. You can view its contents in the Files view.

The Files view in the left panel

Configure a Node.js interpreter

  1. Press ⌘ , and switch to the tab with the workspace settings.

    Workspace settings tab
  2. From the Node.js list, select the path to your Node.js installation. To use the system Node.js, select node.

    If you followed the standard installation procedure, Fleet detects your Node.js and adds the path to it to the list.

    To use a custom Node.js installation, select Add Node.js Interpreter and select the relevant path in the dialog that opens.

Create project files

  1. In the Files view, right-click the root folder, then select New File. Give the new file a name, for example, app.js.

  2. Paste the following code in the editor:

    const http = require('http'); const hostname = ''; const port = 3000; const server = http.createServer((req, res) => { res.statusCode = 200; res.setHeader('Content-Type', 'text/plain'); res.end('Hello World'); }); server.listen(port, hostname, () => { console.log(`Server running at http://${hostname}:${port}/`); });
  3. In the Files view, right-click the root folder, then select New File. Name the file package.json.

  4. Paste the following code in the editor:

    { "name": "server", "version": "1.0.0", "scripts": { "start": "node app.js" } }

Smart mode

You can use JetBrains Fleet as a smart text editor, rather than a full-fledged code editor. However, if you need code intelligence features, you can enable them by turning the Smart Mode on.

Enable smart mode

  • In the top-right corner of the window, click Smart Mode, then Enable.

    After you click the Enable button, you may have to wait for some time, while the backend is being prepared.

    Smart mode popup

Here's what you can do in Smart Mode. The below is not an exhaustive list of Smart Mode features, rather a couple of examples that'll help you to get the feel of how it works in Fleet.

Use quick-fixes and intention actions

  • Press ⌥ ⏎ to access actions that Fleet suggests in the current context.

    Solve problems using quick-fixes:

    The popup showing the available quick fixes for the code at the caret

    Improve your code using intention actions:

    The popup showing the available intention actions for the code at the caret

Refactor code

  • Place the caret at a symbol you want to rename. Press ⌃ R and give it a new name.

    Entering the new name for the symbol at the caret

    The symbol gets the new name and all its usages are updated.

  • Navigate to the declaration of a symbol with ⌘ B.

  • Use code interlines to navigate to usages.

    An interline showing the usages count for the symbol at the caret
  • Skim over the errors with ⌘ E and ⌘ ⇧ E.

    Navigating between errors

Run code

You can run server-side JavaScript code right from Fleet provided that you have installed and configured Node.js on your computer as described in Configure a Node.js interpreter. For more information, refer to Run JavaScript code

  • Navigate to your package.json file and click the Run icon in the gutter next to the start script and select Run 'start'.

    A menu appears after clicking Run in the gutter

    The application output is shown in the console:

    The application output is shown in the console

Reformat code with Prettier

Prettier is a tool to format .js, .ts, .css, .less, .scss, .vue, and .json code. With JetBrains Fleet, you can format selected code fragments as well as entire files.

  1. To install Prettier, open the built-in Terminal (View | Terminal) and type one of the following commands:

    • npm install --save-dev --save-exact prettier

    • npm install --global prettier

    Learn more about installation modes from the Prettier official website.

  2. To reformat a file, select Reformat Code from its context menu.

    Reformat a file with Prettier

    To reformat a code fragment, select it and then select Reformat Code from its context menu.

    Reformat a code selection with Prettier
Last modified: 11 February 2024