Cursor Tutorial 0 - Why Leave GitHub Copilot Behind?
A comparison of Cursor and GitHub Copilot capabilities. More developers are switching from GitHub Copilot to Cursor. But why is Cursor gaining such popularity? Many Cursor advocates haven't clearly explained its advantages over GitHub Copilot. Essentially, Cursor's main strengths lie in two key areas.
Author: 鸟飞鱼跃 | Original Article
An increasing number of developers are transitioning from GitHub Copilot to Cursor. But what makes Cursor so appealing? When it comes to AI-assisted coding, what capabilities truly matter? Many Cursor proponents haven't clearly articulated why Cursor outperforms GitHub Copilot.
At its core, Cursor's main advantages are twofold:
- Code modification capabilities
- Contextual reference abilities
Code Modification: Cursor's Core Strength
Imagine you're writing an article. "Insertion" is like adding new content at the end, while "modification" involves adjusting and improving existing parts. The same applies to programming:
- "Inserting code" is akin to adding new functionality at the end of a program
- "Modifying code" involves optimizing or correcting existing code
These two operations result in vastly different coding experiences. With modification capabilities, it's like having a programming assistant on standby, ready to help you quickly adjust and refine your code, rather than just appending new content.
This core advantage not only makes Cursor more powerful but also enhances the overall coding experience, making it smoother and more efficient.
GitHub Copilot's Limitations
GitHub Copilot primarily focuses on inserting code based on context. While helpful, its functionality is limited to appending new code.
In GitHub Copilot's official example:
You need to input a function header in a JavaScript file:
function calculateDaysBetweenDates(begin, end) {
GitHub Copilot then automatically suggests the rest of the function. This operation merely appends a code snippet without modifying the existing code.
Cursor's Comprehensive Editing Capabilities
In contrast, Cursor can not only insert new code but also directly modify existing code.
This capability is evident in several aspects:
-
Multi-line Editing: Cursor can suggest modifications for multiple lines of code based on the current context. All you need to do is press the Tab key to let Cursor make the changes.
This smooth experience truly feels like having someone coding alongside you.
-
Inline Editing: Using the
Ctrl/Cmd K
shortcut, you can select a code block to edit and then input modification instructions in the prompt bar. Cursor intelligently modifies the selected code based on your instructions.If Cursor's modifications meet your expectations, you can simply click Accept. This interaction method is why many find Cursor so user-friendly. (Mainly because GitHub Copilot doesn't support modifications, it can't provide this experience)
-
Intelligent Prediction: Cursor can intelligently predict your next coding intention and provide relevant suggestions.
In this example, when you change the variable name from 'updates' to 'updatesToServer', Cursor predicts that the 'updates' variable below should also be updated to 'updatesToServer'.
So after you modify code in one place, Cursor automatically suggests synchronizing changes in other places, allowing you to simply press Tab repeatedly to apply changes, which feels incredibly satisfying.
-
Composer Feature: Although still in Beta, Cursor's Composer feature already demonstrates the ability to edit and generate multiple files simultaneously, which is particularly useful in complex projects.
These comprehensive editing capabilities make Cursor far superior to GitHub Copilot in terms of user experience, giving developers a true sense of coding "taking off"!
Contextual Reference Ability: More Intuitive, More Powerful
In AI-assisted coding, accurately understanding and utilizing contextual information is crucial. Cursor excels in this area, providing more intuitive and powerful contextual reference capabilities.
Cursor's @ Symbol Reference
In Cursor's AI input box (such as Cmd K, Cmd L, or Terminal Cmd K), you only need to type the @
symbol to bring up a suggestion list displaying referenceable contextual information. This list automatically filters based on your input, showing only the most relevant suggestions.
The available contextual options are clear and concise, allowing users to immediately understand what kind of contextual information each option represents. These options cover virtually all contextual information you might need in daily development.
The @Codebase option even provides global code search capabilities. Cursor pre-indexes your project code and stores the relevant index information locally (whereas Copilot relies on GitHub's API for remote searches).
GitHub Copilot's Complex Reference Method
In comparison, GitHub Copilot offers two types of contextual references: Chat participants and Chat variables, using the @
and #
symbols respectively. This design not only increases complexity but also lacks intuitive and clear naming conventions.
Compared to Cursor, the range of contextual choices GitHub Copilot can provide is also relatively limited, unable to achieve the comprehensive coverage that Cursor offers.
Chat participants:
Chat variables:
It's worth noting that GitHub Copilot only introduced multi-file context referencing earlier this year. From GitHub's changelog, it's clear they still have much to learn and borrow from Cursor in this aspect.
Conclusion
Through its powerful code modification capabilities and intuitive contextual reference functions, Cursor provides developers with a more efficient and intelligent AI coding assistant compared to GitHub Copilot. If you're looking for a tool that can truly enhance your coding efficiency and quality, give Cursor a try. It might give you an unprecedented sense of coding "taking off"!
Have you used Cursor or GitHub Copilot? Feel free to share your experiences and thoughts!