In recent years, the field of AI-assisted programming has seen rapid advancements, with various software tools emerging one after another. From GitHub Copilot to ChatGPT, Claude, Cursor, and others, you might have experienced some of these tools. Recently, this field has welcomed a significant new player: the Windsurf AI Editor. Windsurf AI Editor aims to provide a magical experience, reminiscent of the awe you felt when you first used ChatGPT. This article delves into the various aspects of the Windsurf AI Editor, including its main product features, usage instructions, real-world examples, and best practices.
What is the Windsurf AI Editor, and What Can It Do?
Windsurf is a code editor integrated with AI capabilities, or as its founders describe it, the world’s first agentic IDE. Built on the open-source VS Code editor, Windsurf AI Editor supports all programming languages that VS Code supports and is compatible with the VS Code plugin ecosystem. It leverages large models like OpenAI's GPT 4o and Claude 3.5 Sonnet to provide its core AI capabilities. Additionally, they have developed their own Cascade Base and Codeium Fast models, offering users a variety of choices.
Windsurf's main features include code auto-completion, AI-driven code generation with deep context awareness, and the ability to perform automatic multi-step operations like an AI Agent to solve complex problems. The founding team hopes that Windsurf can work seamlessly with developers like Copilot, without overshadowing them, while also possessing the ability to independently solve complex problems like an AI Agent. They refer to this experience as "Flows," aiming to provide developers with a smooth and seamless experience.
Main Features
- Cascade AI Assistant: Cascade has AI Agent capabilities, automatically analyzing and breaking down your commands while scanning the project's code to complete complex tasks step by step.
- Autocomplete: Automatically predicts the code you are about to write and completes it with a single keystroke.
- Supercomplete: Provides context and intent-aware predictions that not only add new code but also offer consistent modification suggestions for existing code.
- In-editor Chat: Can be used for explaining small code snippets, refactoring, generating comments, or documentation.
- Specify Context: You can input
@
in Cascade to select specific files, directories, or code blocks as context for more precise control when chatting with AI. - Deep Context Awareness: Windsurf incorporates Codeium's years of research in this field, allowing for deep scanning and understanding of the codebase to provide more effective outputs and suggestions.
- Command-line Operation Suggestions: Automatically prompts you to execute related command-line operations. For example, if you ask Windsurf to complete a function that requires third-party dependencies, it will modify the relevant files and prompt you to execute the command to install the dependencies, requiring only a confirmation click from you.
- Multi-file Editing: Allows for simultaneous modification of multiple files while ensuring consistency across modifications.
- CodeLenses: Displays quick actions like Explain, Refactor, Add Docstring in the breadcrumb navigation at the top for easy one-click execution.
- Terminal Chat: Use the Chat feature in the command line to have AI generate ready-to-execute commands, saving you the trouble of writing them or using search engines.
In-depth Feature Overview
Cascade Overview
Cascade is the name given to Windsurf's AI assistant. It possesses deep understanding capabilities of the codebase, advanced built-in tool usage capabilities, and real-time user intent sensing capabilities. Through these combined abilities, Cascade aims to provide developers with a natural and smooth experience.
Click the Cascade icon in the upper right corner of the Windsurf editor menu bar to open the Cascade window, as shown below.
Cascade mainly operates in two modes: Chat Mode and Write Mode, as shown below:
Write Mode
Chat Mode
Click the icon above Write/Chat with Cascade to switch between the two modes. You can also click the switch button below the chat box or use shortcut keys to switch. (Ctrl + . for Windows, ⌘ + . for Mac)
In Write Mode, Cascade can perform operations such as modifying code, editing existing files, and adding new files, suitable for tasks related to actual code writing.
In Chat Mode, Cascade only responds in the chat window without attempting to modify files directly, suitable for asking questions unrelated to the code itself or when you don't want Cascade to modify the code directly.
Cascade's Deep Context Awareness
Cascade's deep context awareness capabilities stem from the years of research experience accumulated by Windsurf's founding team, Codeium, in this field. Through deep context awareness, even when faced with large codebases in production environments, Cascade can generate results and suggestions based on relevant code in the project rather than relying solely on its own knowledge base.
Below is a video example. From the example, we can see that Cascade analyzes the tasks it faces like an AI Agent and performs step-by-step operations, first identifying the content related to the current task in the project and then completing the requirements step by step.
Cascade's Automatic Command-line Operation Suggestions
During the process of writing code like an AI Agent with Cascade, if it is found that certain command-line operations need to be executed midway to continue normally, Cascade will directly prompt you with the command to execute in the chat window and request your permission. You only need to click to confirm execution to allow Cascade to continue, and Cascade will automatically read the results obtained after execution and proceed with the next step based on the results.
Cascade's Real-time Deep Intent Sensing
Generally, when we write code, we don't need AI assistance 100% of the time. More often, we might write a bit ourselves, then get some help from AI, and then complete some logic on our own. If AI-assisted programming tools are not optimized for this situation, they may not provide better results due to the lack of context. Windsurf has equipped Cascade with powerful reasoning capabilities, combining deep analysis of user intent based on current operations. Whenever you need Cascade's help, Cascade can always more accurately understand what you want to do. This can save you trouble in many cases, eliminating the need to repeatedly tell AI what you just did and what you want to do next. Of course, giving AI clearer requirements is always good, but sometimes if you can save some trouble, isn't that better?
Cascade's Multi-file Simultaneous Editing
For simple tasks, writing and modifying code in a single file is often sufficient. However, for more complex tasks, multiple files and various types of files often need to be modified. For AI-assisted programming tools, it is not only necessary to know which files to modify simultaneously but also to ensure that modifications across different files are consistent and mutually responsive. Cascade can achieve this well with its deep context awareness capabilities and the ability to complete tasks step by step like an AI Agent.
Auto-completion
The auto-completion feature can predict the code you are about to write, not only predicting single-line code but also generating large segments of predictive code. Before the birth of Windsurf, Codeium had accumulated several years of experience in this field, and now this capability is directly built into the Windsurf editor.
Super Auto-completion
Why have super auto-completion when there is already auto-completion? Because auto-completion is an "add-only" type of prediction, it only helps you predict the code you are about to add. Super auto-completion, on the other hand, can predict related code modifications while you are writing or modifying code. For example, when you change a field name, super auto-completion can automatically detect all places where this variable name is used and suggest modifications. You only need to press the Tab key to accept it. The timing of super auto-completion is intelligently predicted by Windsurf based on context and is automatically triggered when certain conditions are met. Common scenarios that trigger it include, besides the example above, modifying type definitions, correcting spelling errors, and possibly binding event handlers to forms.
In-editor Chat Assistance
You can open an inline chat window at any position in the editor directly through a shortcut key (Ctrl + I for Windows, ⌘ + I for Mac).
Alternatively, when you select a piece of code, an automatic bubble prompt will appear next to the selected code.
Command-line AI Chat
Besides using AI assistance when writing code, you can also let AI generate some forgotten command-line operations during command-line operations, saving you the trouble of looking up information. However, a friendly reminder: AI-generated commands may also have flaws, so be sure to confirm them before executing.
Code Lens
At the top of the menu bar, there are buttons for common operations, such as explaining code, refactoring, and adding document comments, which can be executed with one click.
Frequently Asked Questions
How does Windsurf differ from other AI code editors (such as Cursor, Cognition)?
They are all AI-assisted programming software, but there are differences in product form and usability.
For example, Cognition (Devin) is independent of the IDE and is more inclined to let AI independently complete complex large tasks rather than real-time collaboration with developers.
Compared with Cursor, Cursor's Composer can also perform complex tasks like an AI Agent, but Cursor has not yet had a large-scale promotion. Based on the author's experience, with Codeium's years of accumulation in deep code context understanding, Windsurf may have an advantage when dealing with complex tasks and large codebases.
Is Windsurf free?
Codeium stated on their website that they expect to allow users to use many of Cascade's features for free, but due to cost reasons, more comprehensive capabilities will only be available for a fee. However, there is a two-week free trial period for new users to experience it first.