Guides for SE student projects »

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

VS Code - Using Windsurf

Windsurf is an AI assistant that integrates smoothly with Visual Studio Code 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
    • Click on the extension link above.
    • Click the Install button on the page that opens.
    • It should prompt you with Open Visual Studio Code? and click Open Visual Studio Code.
    • You will be redirected to the extension page in Visual Studio Code.
    • Click on Install to install the extension.
  • 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 sidebar and then click Login.
    • A browser pop-up will appear asking you to sign in. Click AllowOpen.
    • Log in to your Windsurf account if needed.
    • It should prompt you with Open Visual Studio Code? and click Open Visual Studio Code.
    • You will be redirected to VS Code. When asked "Allow 'Windsurf Plugin (formerly Codeium): AI Coding Autocomplete and Chat for Python, JavaScript, TypeScript, and more' extension to open this URI?", click Open.
    • If you see the pop-up "Welcome back to Windsurf, ...", you have successfully logged in.

Using Windsurf in VS Code

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 Windsurf chat. Click the copy icon in the top right corner to copy any code that might be relevant.
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 )