🚀 在 VS Code 中取得

通知

通知 會顯示來自 Visual Studio Code 右下角的簡短資訊。

Example of a notification

您可以傳送三種類型的通知

務必限制傳送的通知數量,以尊重使用者的注意力。為了協助您判斷是否應該顯示通知,請遵循我們的通知決策樹

Show a multi-step quick pick if multi step user input is immediately needed. If user input is immediately needed but it is not multi-step show a modal dialog. If you need to show progress that is low priority show the progress in the status bar. If the interaction is triggered by the user find the right moment to show the notification and only then show it. If you need to show multiple notifications try to combine them into one. If the user does not really need to be notified consider to not show anything and relax.

通知範例

Information notification

此通知會在使用者執行更新版本命令後出現。請注意,沒有其他動作,且純粹是資訊性。

Warning notification

此範例重點說明需要使用者輸入的功能問題,並顯示解決問題的動作。

Error notification

此範例顯示失敗通知,並提供解決問題的動作。

✔️ 建議

  • 僅在絕對必要時才傳送通知,以尊重使用者的注意力
  • 為每個通知新增不再顯示選項
  • 一次顯示一個通知

❌ 不建議

  • 傳送重複的通知
  • 用於促銷
  • 在首次安裝時要求意見回饋
  • 如果沒有任何動作,則顯示動作

進度通知

當需要顯示不確定時間範圍的進度時 (例如,設定環境),您可以使用進度通知。這種全域進度通知應作為最後手段,因為進度最好保留在內容中 (在檢視或編輯器中)。

✔️ 建議

  • 顯示連結以查看更多詳細資訊 (例如記錄)
  • 在設定進度時顯示資訊 (正在初始化、建置等等)
  • 提供取消操作的動作 (如果適用)
  • 為逾時情境新增計時器

❌ 不建議

  • 讓通知在進度中持續執行

Progress notification

此範例使用進度通知來顯示遠端連線所涉及的設定,同時也提供輸出記錄的連結 (詳細資訊)。

當您需要使用者立即輸入以執行動作時,您可以選擇顯示強制回應對話方塊。此 UI 元素應謹慎使用,因為強制回應對話方塊會封鎖對話方塊外部的使用者互動,直到關閉為止。

Modal dialog

此對話方塊會在移動 JavaScript/TypeScript 檔案後出現,要求更新其他檔案中的匯入陳述式。

✔️ 建議

  • 僅在您需要使用者立即互動時才使用強制回應對話方塊
  • 在適當情況下,提供避免重複使用者確認的動作 (永遠/永不 動作)
  • 考慮使用核取方塊來記住使用者的選擇

❌ 不建議

  • 使用強制回應對話方塊來確認多個步驟
  • 使用強制回應對話方塊來顯示不需要使用者動作的訊息
  • 針對非使用者明確啟動的動作顯示強制回應對話方塊