AI assistants in coding: Difference between revisions

From LemonWiki共筆
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
Line 12: Line 12:


== Prompt for Generate Unit Tests ==
== Prompt for Generate Unit Tests ==
JetBrain 推出 AI Assistant 外掛功能,目前付費客戶可以免費試用 7 天。它下的 prompt,供大家參考
JetBrain 推出 [https://plugins.jetbrains.com/plugin/22282-ai-assistant AI Assistant 外掛]功能,目前付費客戶可以免費試用 7 天。它下的 prompt,供大家參考


=== 翻譯版 ===
=== 翻譯版 ===
Line 48: Line 48:
== 相關網頁 ==
== 相關網頁 ==


* AI Assistant - IntelliJ IDEs Plugin | Marketplace
* [https://plugins.jetbrains.com/plugin/22282-ai-assistant AI Assistant - IntelliJ IDEs Plugin | Marketplace]
https://plugins.jetbrains.com/plugin/22282-ai-assistant
 





Revision as of 17:00, 18 December 2023

AI Assistants in Coding


Usages

  • Write documentation (or Generate Docs)
  • Convert file to another language
  • Refactor the following code (or simplify this)
  • Explain the following code
  • Generate Unit Tests (or generate tests)
  • Generate Code
  • Find Problems (or fix this)

Prompt for Generate Unit Tests

JetBrain 推出 AI Assistant 外掛功能,目前付費客戶可以免費試用 7 天。它下的 prompt,供大家參考

翻譯版

為 "XXXClass" 類別中的 "xxx" 方法撰寫 "XXXClassTest" 測試。 指南:

- 撰寫類別和方法的測試描述。
- 測試檔案應該是完整且可編譯的,不需要進一步的操作。
- 確保每個測試專注於單一用例,以保持清晰和可讀性。
- PHP 測試檔案必須以 PHP 開頭標籤 ?php 開始
- 生成的測試類別應該在命名空間 XXX
- 檔案:XXXClass.php

```php
附上程式碼
```

英文版

Write "XXXClassTest' tests for the
'xxx' method in the
"XXXClass' class. Guideline: '*' 
- Write a description of the class and the method being tested. 
- Test file should be complete and compilable, without need for further actions. 
- Ensure that each test focuses on a single use case to maintain clarity and readability. 
- PHP test file MUST starts with php opening tag ?php 
- Generated test class should be in namespace XXX''* File: XXXClass.php 

'''php ?php class
XXXClass {  ... 
'''

相關網頁