Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Cursor Chat and Composer

Cursor Chat and Composer

The Cursor AI chat window has two features, Chat and Composer, which are two different AI-assisted programming modes:

Simply put, Chat is suitable for quick Q&A and simple tasks, while Composer is suitable for complex code generation and cross-file operations. In daily development, we can first use Composer to generate code, then use Chat to explain or optimize the code.

Whether to choose Chat or Composer depends on the task requirements:


Introduction to Cursor Chat

Cursor Chat is a chat tool integrated into the code editor that allows developers to communicate with team members in real time while writing code. With Cursor Chat, developers can discuss code issues, share code snippets, or seek help without leaving the editor.

Main Function

Example

export default function AboutPage

(

)

{

   

return

<

h1

About us, RUNOOB.

COM

<

/h1

;

}

Next, in the Chat dialog window, let the AI add comments.

Then click the Apply button to apply it to the code file:


Introduction to Composer

Based on natural language descriptions, Composer can generate complete code snippets or files, and even build entire applications. It also supports editing multiple files simultaneously and understands the call relationships between files, making it suitable for complex project development.

Composer can understand the entire project structure and existing code, generating more logical and higher-quality code.

After Composer generates code, users can further optimize it with additional instructions.

For example, we can create a directory and write a requirements document:

In the Composer dialog window, we can ask it to generate code based on the requirements document: