Guides for SE student projects »

This is a WIP community resource, containing contribution from community members.

Intellij IDEA: Using Windsurf

Windsurf is an AI assistant that integrates smoothly with IntelliJ IDEA and serves as a practical alternative to GitHub Copilot, especially for users seeking a free, non-Microsoft solution.

Pre-requisites

If you have not signed up for a Windsurf account, follow the guide in the panel below:

Signing Up for Windsurf

Windsurf is an AI code assistant that integrates with your development environment. To use Windsurf, you need to sign up for an account and activate the service. Follow the steps below to get started:

  • Create a Windsurf account, if you don't have one yet.
    • Go to the Windsurf registration page.
    • Sign up using your email, Google account, or GitHub account.
    • Verify your account through the email sent to your inbox.

Contributors: Norbert Loh (@NorbertLoh )


Setting Up

  • Install the Extension Pack for Windsurf
    • Open IntelliJ.
    • Go to FileSettingsPluginsMarketplace.
    • Search for Windsurf.
    • Click Install on the plugin developed by Windsurf.
    • Restart IntelliJ by clicking Restart IDERestart.
  • Sign in to Windsurf
    • Click on the pop-up to log in to Windsurf. If there is no pop-up, click the Windsurf icon on the right sidebar and then click Login.
    • A browser pop-up will appear asking you to sign in.
    • Log in to your Windsurf account if needed.
    • You can close the web page and proceed back to IntelliJ IDEA.
    • Windsurf will now be signed in within IntelliJ IDEA.

Using Windsurf in Intellij IDEA

Basic Code Completion

  • In a Java file, type a comment like // print Hello World! inside the main method.
  • Press Tab to autocomplete the suggestion.
    The more descriptive your method name or comment, the better Windsurf’s suggestion will be.

Windsurf Chat

  • Open the Windsurf chat by clicking the Windsurf icon.
  • Ask something like: Write a main method that calculates the factorial of N.
  • Windsurf will respond in the chat and suggest the changes in the current active file. You can accept or decline the changes with the buttons below.
    Free Windsurf Chat has a limited prompt rate.

Windsurf Inline Chat

  • Go to the line or section where you want to ask Windsurf for assistance.
  • Use the inline chat feature using the shortcut / Ctrl+I | Cmd+I.
  • Type your request such as "Add a print log here" and press Enter.
  • The generated lines of code will be highlighted in yellow, and you can insert them by clicking on Accept.

Windsurf Default Commands

  • Windsurf comes with built-in commands that can help you. Above each code block, you'll see available shortcuts.
  • Refactor command
    • Click Windsurf: Refactor to open a menu with refactoring options.
    • Choose a command, then click Accept (// Alt+A) or Reject (// Alt+R) to confirm or dismiss the generated code.
  • Explain command
    • Click the Explain button above a code block to have Windsurf explain it.
    • Windsurf will explain the related code chunk through the chat.

Contributors: Norbert Loh (@NorbertLoh )