מסמנים את הקוד שרוצים ש-Gemini ישנה, לוחצים לחיצה ימנית בעורך הקוד ובוחרים באפשרות Gemini > שינוי קוד בתפריט ההקשר.
מקישים על Ctrl+\ (Command+\ ב-macOS).
מזינים הנחיה ל-Gemini שמתארת איך רוצים לשנות את הקוד או להוסיף לו, ולוחצים על Enter. אחרי ש-Gemini יעבד את הבקשה, יוצג לכם קוד השוואה. באמצעות השוואת הקוד, אפשר לבדוק ולקבל רק את ההצעות שרוצים.
בודקים את ההבדלים בקוד ומבצעים אחת מהפעולות הבאות:
כדי לשנות עוד את הקוד המוצע, לוחצים על צמצום ומזינים הנחיה חדשה.
כדי להוסיף את השינויים המוצעים לקוד, לוחצים על אישור השינויים.
דברים שכדאי לנסות:
"Simplify this code" (פישוט הקוד הזה)
"Make this code idiomatic" (הפוך את הקוד הזה לאידיומטי)
"Generate a new function that does <description>"
"Add documentation for this code" (הוספת תיעוד לקוד הזה)
דוגמאות התוכן והקוד שבדף הזה כפופות לרישיונות המפורטים בקטע רישיון לתוכן. Java ו-OpenJDK הם סימנים מסחריים או סימנים מסחריים רשומים של חברת Oracle ו/או של השותפים העצמאיים שלה.
עדכון אחרון: 2025-07-31 (שעון UTC).
[[["התוכן קל להבנה","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 (שעון UTC)."],[],[],null,["# Transform code\n\nYou can prompt Gemini from the code editor for code suggestions to modify,\noptimize, or add code to your app as follows:\n\n1. To get the prompt input field, do one of the following from the code editor:\n - Right-click in the code editor and select **Gemini \\\u003e Generate code** from the context menu.\n - Highlight code that you want Gemini to modify, right-click in the code editor, and select **Gemini \\\u003e Transform code** from the context menu.\n - Press \u003ckbd\u003eCTRL+\\\u003c/kbd\u003e (\u003ckbd\u003eCommand+\\\u003c/kbd\u003e on macOS).\n2. Prompt Gemini by describing how you want to modify or add to your code and press \u003ckbd\u003eEnter\u003c/kbd\u003e. After Gemini processes your request, you should see a code diff. With the code diff, you can review and accept only the suggestions you want.\n3. Review the code diff and do one of the following:\n\n - Further modify the suggested code by clicking **Refine** and entering a new prompt.\n - Click **Accept Changes** to add the suggested changes to your code.\n\nThings to try:\n\n- \"Simplify this code\"\n- \"Make this code idiomatic\"\n- \"Generate a new function that does \\\u003cdescription\\\u003e\"\n- \"Add documentation for this code\""]]