Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Halaman ini menunjukkan cara mengelola beberapa konfigurasi Cloud Functions di satu ruang kerja dan ruang kerja multi-folder, serta cara mengatur ulang Penjelajah fungsi Cloud Run dengan Cloud Code.
Sebelum memulai
Panduan ini memerlukan ruang kerja yang sudah disiapkan (file launch.json dengan setidaknya satu konfigurasi yang tercantum). Untuk memulai dengan contoh, lihat panduan memulai Membuat dan men-deploy fungsi.
Mengelola beberapa konfigurasi dalam satu ruang kerja
Untuk menambahkan konfigurasi Cloud Function baru ke file launch.json, ikuti langkah-langkah berikut:
Klik Cloud Code, lalu luaskan Penjelajah Cloud Functions.
Di Penjelajah fungsi Cloud Run,
tahan kursor di atas WORKSPACE,
lalu klik
Add new cloud function configuration.
Ikuti petunjuknya dan lakukan tindakan berikut:
Masukkan nama fungsi
Memilih lingkungan fungsi Cloud Run
Masukkan titik entri (nama metode yang akan dipanggil untuk fungsi ini)
Masukkan input pengujian
Atau, Anda dapat memasukkan nilai ini secara manual ke dalam file
launch.json:
Ruang kerja fungsi Cloud Run Anda sesuai dengan konfigurasi pertama yang tercantum dalam file launch.json. Nama ruang kerja mencerminkan
functionName konfigurasi pertama yang tercantum dalam file
launch.json Anda:
(Opsional) Untuk men-deploy konfigurasi lain dari file launch.json, pindahkan konfigurasi yang ingin di-deploy ke bagian atas file launch.json, lalu klik refreshRefresh Cloud Functions Explorer.
Mengelola ruang kerja multi-folder
Cloud Code mendukung beberapa folder di ruang kerja fungsi Cloud Run jika setiap fungsi berisi file launch.json-nya sendiri.
Setiap folder ruang kerja fungsi Cloud Run yang muncul diberi nama berdasarkan
functionName konfigurasi pertama dalam file launch.json yang sesuai.
Untuk mengatur ruang kerja multi-folder untuk project Anda, lihat
Ruang Kerja Multi-root VS Code.
Mengatur ulang Cloud Run functions Explorer ke dalam File Explorer IDE Anda
Anda dapat mengatur ulang Penjelajah fungsi Cloud Run ke dalam Penjelajah file VS Code dengan melakukan tindakan berikut:
Tarik Explorer fungsi Cloud Run ke dalam file Explorer VS Code:
Pengaturan ini menampilkan Penjelajah fungsi Cloud Run di bagian Penjelajah file sehingga Anda dapat melihat fungsi yang di-deploy dan ruang kerja fungsi Cloud Run di panel yang sama dengan file project.
(Opsional) Untuk mengurungkan pengaturan ini, klik kanan judul Penjelajah Cloud Code: Cloud Functions, lalu pilih Reset location. Tindakan ini akan memindahkan Penjelajah fungsi Cloud Run kembali ke tab Cloud Code.
Dapatkan Dukungan
Untuk mengirim masukan, laporkan masalah di
GitHub,
atau ajukan pertanyaan di
Stack Overflow.
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Sulit dipahami","hardToUnderstand","thumb-down"],["Informasi atau kode contoh salah","incorrectInformationOrSampleCode","thumb-down"],["Informasi/contoh yang saya butuhkan tidak ada","missingTheInformationSamplesINeed","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 2025-09-05 UTC."],[[["\u003cp\u003eThis guide details how to manage multiple Cloud Functions configurations within a single workspace by adding and organizing configurations in the \u003ccode\u003elaunch.json\u003c/code\u003e file, either manually or via the Cloud Code interface.\u003c/p\u003e\n"],["\u003cp\u003eYou can manage multi-folder workspaces for Cloud Run functions, where each folder contains its own \u003ccode\u003elaunch.json\u003c/code\u003e file, and each folder's name reflects the \u003ccode\u003efunctionName\u003c/code\u003e of the first configuration listed in its \u003ccode\u003elaunch.json\u003c/code\u003e file.\u003c/p\u003e\n"],["\u003cp\u003eThe Cloud Run functions Explorer can be rearranged to appear within VS Code's file Explorer, allowing you to view deployed functions alongside your project files, and this arrangement can be undone by selecting "Reset location".\u003c/p\u003e\n"],["\u003cp\u003eThe workspace name will reflect the \u003ccode\u003efunctionName\u003c/code\u003e value of the first configuration listed in the \u003ccode\u003elaunch.json\u003c/code\u003e file and if there are multiple, you can move the desired configuration to the top to set the workspace.\u003c/p\u003e\n"]]],[],null,["# Manage functions in VS Code workspace\n\nThis page shows you how to manage multiple\n[Cloud Functions](https://cloud.google.com/functions/) configurations in a\nsingle workspace and a multi-folder workspace,\nand how to rearrange your Cloud Run functions Explorer with\nCloud Code.\n\nBefore you begin\n----------------\n\nThis guide requires a workspace already setup (a `launch.json` file with at\nleast one configuration listed). To get started with a sample, see the\n[Create and deploy a function](/code/docs/vscode/create-deploy-function)\nquickstart.\n\nManage multiple configurations in a single workspace\n----------------------------------------------------\n\nTo add a new Cloud Function configuration to your `launch.json` file, follow\nthese steps:\n\n1. Click **Cloud Code** and then expand the **Cloud Functions** Explorer.\n\n2. In the Cloud Run functions Explorer,\n hold your pointer over **WORKSPACE**\n and click\n **Add new cloud function configuration**.\n\n3. Follow the prompts and perform the following actions:\n\n 1. Enter a function name\n 2. Select a Cloud Run functions environment\n 3. Enter an entry point (the name of the method to call for this function)\n 4. Enter the test input\n\n Alternatively, you can manually enter these values into your `launch.json`\n file: \n\n {\n \"configurations\": [\n {\n \"name\": \"Deploy Cloud Function\",\n \"type\": \"cloudcode.cloudfunctions\",\n \"request\": \"launch\",\n \"functionName\": \"hello-world-get\",\n \"gen\": \"GEN_2\",\n \"entryPoint\": \"helloGet\"\n }\n ]\n }\n\n Your Cloud Run functions workspace corresponds to the first\n configuration listed in your `launch.json` file. The workspace name reflects\n the `functionName` of the first configuration listed in your `launch.json`\n file: \n\n {\n \"configurations\": [\n {\n \"name\": \"Deploy Cloud Function\",\n \"type\": \"cloudcode.cloudfunctions\",\n \"request\": \"launch\",\n \"functionName\": \"hello-world-pub-sub\",\n \"gen\": \"GEN_2\",\n \"entryPoint\": \"helloPubSub\"\n },\n {\n \"name\": \"Deploy Cloud Function\",\n \"type\": \"cloudcode.cloudfunctions\",\n \"request\": \"launch\",\n \"functionName\": \"hello-world-get\",\n \"gen\": \"GEN_2\",\n \"entryPoint\": \"helloGet\"\n }\n ]\n }\n\n4. (Optional) To deploy another configuration from your `launch.json` file, move\n the configuration you want to deploy to the top of the `launch.json` file and\n click refresh\n **Refresh Cloud Functions Explorer**.\n\nManage a multi-folder workspace\n-------------------------------\n\nCloud Code supports having multiple folders in a\nCloud Run functions workspace if each function contains its own\n`launch.json` file.\n\nEach Cloud Run functions workspace folder that appears is named after the\nfirst configuration's `functionName` in its corresponding `launch.json` file.\n\nTo arrange a multi-folder workspace for your project, see VS Code's\n[Multi-root Workspaces](https://code.visualstudio.com/docs/editor/multi-root-workspaces).\n\nRearrange Cloud Run functions Explorer into your IDE's file Explorer\n--------------------------------------------------------------------\n\nYou can rearrange your Cloud Run functions Explorer into\nVS Code's file Explorer by performing the following:\n\n1. Drag your Cloud Run functions Explorer into\n VS Code's file Explorer:\n\n\n This arrangement displays your Cloud Run functions Explorer under the\n file Explorer so that you can view your deployed functions and\n Cloud Run functions workspace(s) in the same pane as your project files.\n2. (Optional) To undo this arrangement,\n right-click the **Cloud Code: Cloud Functions** Explorer's heading and select\n **Reset location** . This moves the Cloud Run functions Explorer back to the\n **Cloud Code** tab.\n\nGet Support\n-----------\n\nTo send feedback, report issues on [GitHub](https://github.com/GoogleCloudPlatform/cloud-code-vscode/issues), or ask a question on [Stack Overflow](https://stackoverflow.com/questions/ask?tags=cloud-code-vscode)."]]