با مجموعهها، منظم بمانید
ذخیره و طبقهبندی محتوا براساس اولویتهای شما.
از Prompt Library برای ذخیره و مدیریت درخواستهای پرکاربرد خود استفاده کنید و در صورت نیاز به سرعت آنها را فراخوانی کنید. اگر درخواستی وجود دارد که اغلب برای فایلهای مختلف یا بخشهای مختلف کد استفاده میکنید، میتوانید از یک متغیر الگوی درخواستی استفاده کنید که به طور خودکار با کد یا فایل انتخابی در حین اجرای دستور جایگزین میشود. این گردش کار ساده نیاز به تایپ مجدد دستورات رایج را از بین می برد و در زمان و تلاش شما صرفه جویی می کند.
برای باز کردن Prompt Library، به File ( Android Studio در macOS) Settings > Tools > Gemini > Prompt Library بروید.
یک درخواست را ذخیره کنید
برای افزودن یک اعلان، این مراحل را دنبال کنید:
با کلیک روی File ( Android Studio در macOS) > Settings > Tools > Gemini > Prompt Library، Prompt Library را باز کنید.
برای تنظیم محدوده اعلان، از منوی کشویی Scope استفاده کنید:
قوانین سطح IDE برای شما خصوصی هستند و می توانند در چندین پروژه استفاده شوند.
برای افزودن یک درخواست جدید، روی افزودن کلیک کنید .
نامی به فرمان بدهید. اگر میخواهید دستور ویرایشگر را اعمال کنید، این نام در منوی Prompt Library ظاهر میشود.
درخواست را در فیلد ارائه شده وارد کنید. اگر درخواست شامل ارجاع کد خاصی باشد، میتوانید کد مربوطه را در حین اجرای دستور با استفاده از متغیرهای زیر در دستور خود اضافه کنید:
$SELECTION - نشان دهنده متن انتخاب شده یا متنی است که مکان نما را احاطه می کند اگر متنی انتخاب نشده باشد.
$CURRENT_FILE - نشان دهنده تمام متن موجود در فایلی است که در حال حاضر در ویرایشگر فعال است.
اختیاری: اگر نمیخواهید درخواست در منوی Prompt Library نمایش داده شود، علامت Show in Prompt Library را بردارید.
برای اعمال تغییرات و ادامه پیکربندی تنظیمات دیگر، روی اعمال کلیک کنید. برای اعمال تغییرات و خروج فوری از گفتگوی تنظیمات، روی Ok کلیک کنید.
همچنین میتوانید روی یک درخواست در چت کلیک راست کنید تا آن را برای استفاده بعدی ذخیره کنید. برای اعمال یک درخواست ذخیره شده، در ویرایشگر کلیک راست کرده و به Gemini > Prompt Library بروید تا درخواست اعمال شود.
از یک اعلان ذخیره شده استفاده کنید
برای استفاده از درخواست از Prompt Library، این مراحل را دنبال کنید:
اگر برای درخواستی که قصد استفاده از آن را دارید، کد مربوطه را برجسته کنید. اگر اعلان به کد خاصی اشاره نمی کند، فرقی نمی کند مکان نما شما در کجای فایل باشد.
برای دریافت لیست درخواستها، روی ویرایشگر کلیک راست کرده و به Gemini > Prompt Library بروید.
برای ارسال درخواست به Gemini، درخواست را از منو انتخاب کنید.
درخواستهای سطح پروژه را به اشتراک بگذارید و مدیریت کنید
میتوانید درخواستهای سطح پروژه را با هم تیمیهایی که روی همان پروژه کار میکنند به اشتراک بگذارید و مدیریت کنید. وقتی درخواستی را در سطح پروژه در Prompt Library ذخیره میکنید، درخواست در <project-root>/.idea/project.prompts.xml ذخیره میشود. برای اشتراکگذاری و مدیریت درخواستهای سطح پروژه، پوشه .idea را به سیستم کنترل نسخه خود اضافه کنید.
محتوا و نمونه کدها در این صفحه مشمول پروانههای توصیفشده در پروانه محتوا هستند. جاوا و OpenJDK علامتهای تجاری یا علامتهای تجاری ثبتشده Oracle و/یا وابستههای آن هستند.
تاریخ آخرین بهروزرسانی 2025-07-31 بهوقت ساعت هماهنگ جهانی.
[[["درک آسان","easyToUnderstand","thumb-up"],["مشکلم را برطرف کرد","solvedMyProblem","thumb-up"],["غیره","otherUp","thumb-up"]],[["اطلاعاتی که نیاز دارم وجود ندارد","missingTheInformationINeed","thumb-down"],["بیشازحد پیچیده/ مراحل بسیار زیاد","tooComplicatedTooManySteps","thumb-down"],["قدیمی","outOfDate","thumb-down"],["مشکل ترجمه","translationIssue","thumb-down"],["مشکل کد / نمونهها","samplesCodeIssue","thumb-down"],["غیره","otherDown","thumb-down"]],["تاریخ آخرین بهروزرسانی 2025-07-31 بهوقت ساعت هماهنگ جهانی."],[],[],null,["# Save and manage prompts with the Prompt Library\n\nUse the Prompt Library to save and manage your frequently used prompts and\nquickly recall them when needed. If there's a prompt that you use often for\ndifferent files or different sections of code, you can use a prompt template\nvariable that is automatically replaced with the selected code or file during\nprompt execution. This streamlined workflow eliminates the need to retype\ncommonly used prompts, saving you time and effort.\n\nTo open the Prompt Library, go to **File** (**Android Studio** on macOS)\n**Settings \\\u003e Tools \\\u003e Gemini \\\u003e Prompt Library**.\n\nSave a prompt\n-------------\n\nTo add a prompt, follow these steps:\n\n1. Open the Prompt Library by clicking **File** (**Android Studio** on macOS) **\\\u003e Settings \\\u003e Tools \\\u003e Gemini \\\u003e Prompt Library**.\n2. To set the scope of the prompt, use the **Scope** drop-down:\n - IDE-level rules are private to yourself and can be used across multiple projects.\n - Project-level rules can be [shared among teammates](#share-project-prompts) working on the same project.\n3. To add a new prompt, click **Add** .\n4. Give the prompt a name. This name is what appears in the [Prompt Library menu](#use-saved-prompt) if you want to apply the prompt from the editor.\n5. Enter the prompt in the field provided. If the prompt involves referencing specific code, you can add the relevant code during prompt execution by using the following variables in your prompt:\n - `$SELECTION` - Represents the selected text, or text surrounding the cursor if no text is selected.\n - `$CURRENT_FILE` - Represents all the text in the file that's currently active in the editor.\n6. Optional: If you don't want the prompt to show up in the [Prompt Library menu](#use-saved-prompt), un-check **Show in Prompt Library menu**.\n7. To apply the changes and continue configuring other settings, click **Apply** . To apply the changes and immediately exit the settings dialog, click **Ok**.\n\nYou can also right-click on a prompt in chat to save it for later use. To apply\na saved prompt, right-click in the Editor and navigate to **Gemini \\\u003e Prompt\nLibrary** to apply the prompt.\n\nUse a saved prompt\n------------------\n\nTo use a prompt from the Prompt Library, follow these steps:\n\n1. Highlight the relevant code, if applicable to the prompt that you're planning to use. If the prompt doesn't reference specific code, it doesn't matter where your cursor is in the file.\n2. To get your list of prompts, right-click in the editor and go to **Gemini \\\u003e Prompt Library**.\n3. To submit the prompt to Gemini, select the prompt from the menu.\n\nShare and manage project-level prompts\n--------------------------------------\n\nYou can share and manage project-level prompts with teammates working on the\nsame project. When you save a prompt at the project level in the Prompt Library,\nthe prompt is stored at `\u003cproject-root\u003e/.idea/project.prompts.xml`. To share and\nmanage project-level prompts, add the `.idea` folder to your version control\nsystem."]]