现已发布!阅读关于 11 月新增功能和修复的内容。

VS Code 聊天提示示例

本文提供了 Visual Studio Code 聊天功能在不同场景和代理中的提示示例。使用这些示例作为灵感,为您的开发任务编写有效的提示。

如果您是 VS Code 聊天功能的新用户,请了解有关聊天入门的更多信息,或查看提示编写的最佳实践

一般的编码和技术问题

使用 VS Code 聊天功能来快速获取有关编码概念、技术主题和一般编程问题的答案。

What is a linked list?
Provide 3 ways to implement a search feature in React.
Explain the difference between async/await and promises.

理解和探索代码库

使用 VS Code 聊天功能来了解项目的工作原理、定位特定功能或探索代码关系。

Explain how authentication works in #codebase
Where is the database connection string configured? #codebase
How do I build this #codebase?
Which testing framework is used for #calculator.test.js?

代码生成和编辑

使用 VS Code 聊天功能来生成新代码、添加功能或修改现有功能。

Add a login button and style it based on #styles.css
Create a meal-planning web app using React and Node.js
Refactor this code to use async/await

测试和质量保证

使用 VS Code 聊天功能来生成测试或修复失败的测试。

Add unit tests for the user service.
Fix the failing tests #testFailure

调试和解决问题

使用 VS Code 聊天功能来识别和修复代码中的问题。

Fix the issues in #problems
Fix the failing tests #testFailure
Why is this function returning undefined?

使用源代码管理

使用 VS Code 聊天功能来处理待更改内容并生成发布文档。

Summarize the #changes
Generate release notes based on the #changes
Summarize the changes in #changes

使用外部资源

使用 VS Code 聊天功能来引用来自网页或 GitHub 存储库的内容。

How do I use the 'useState' hook in react 18? #fetch https://18.reactjs.ac.cn/reference/react/useState#usage
Build an API endpoint to fetch address info, use the template from #githubRepo contoso/api-templates
What are the top #extensions for this workspace?

终端和命令行任务

使用终端内联聊天功能来获取有关 Shell 命令和终端操作的帮助。

How do I install npm packages?
List the top 5 largest files in the src directory
undo the last git commit

使用 Jupyter Notebook

使用 VS Code 聊天功能来创建、编辑和使用 Jupyter Notebook。

/newNotebook use pandas and seaborn to read and visualize the titanic dataset. Show key information from the dataset.
Create a notebook to read data from #housing.csv and plot the distribution of prices
Make sure the data is cleaned before visualizing and processing it
Show the correlation between different features in the dataset

编写有效提示的技巧

  • 具体明确:包含您想要实现的目标、要使用的技术以及预期的输出格式等详细信息。
  • 添加上下文:使用 # 提及来引用文件、符号或上下文变量,例如 #codebase#changes#problems
  • 迭代:从一个简单的提示开始,根据响应进行完善。提出后续问题以改进结果。
  • 分解复杂任务:不要一次性提出所有要求,而是将大型任务分解为更小、更易于管理的步骤。

了解有关编写提示的最佳实践以及向提示添加上下文的更多信息。

© . This site is unofficial and not affiliated with Microsoft.