使用交互參照
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
您可以透過交叉參照,探索程式碼庫中符號之間的連線。
如果已設定,交叉參照會由 kythe 提供。如要判斷特定存放區是否已設定交叉參照,請查看專案頁面的交叉參照欄。如果顯示勾號,表示該存放區中至少有一種語言的參照。請注意,並非所有有勾號的存放區,都具有相同語言組合的交互參照。
跳至定義
啟用交叉參考後,符號會變成連結。按一下符號用法,即可前往程式碼中定義符號的位置。如要瞭解如何為可點選的符號啟用底線,請參閱「交互參照設定」。
尋找用法及使用交互參照面板
按一下定義符號的位置,即可開啟交互參照面板,其中會顯示符號的使用位置清單。按一下參照會跳至該用法,方法是開啟預覽面板或在主視窗中顯示用法。如要瞭解如何切換這項行為,請參閱「交互參照設定」。點選交互參照面板中的連結時,程式碼瀏覽器會跳至建構交互參照的檔案版本。
使用呼叫階層
您可以在交叉參照面板的呼叫階層部分,探索參照的內容。在呼叫階層部分,按一下行號旁的扭曲箭頭,即可查看該參照的呼叫者。這可讓您向上探索呼叫階層。
查看產生的檔案
在具有交叉參照的存放區中,您可以看到從建構作業產生的構件,但這些構件並不存在於存放區中,例如從 proto 檔案建立的 .cc
和 .h
檔案。您也可以看到在建構程序中下載的部分檔案。
交叉參照面板中的部分連結會將您帶往產生的檔案。您可以從目錄面板檢視畫面,前往這些產生的檔案。
交叉參照設定
您可以切換交叉參考資料預覽視窗。預覽面板開啟時,點選交叉參考面板會開啟檔案預覽畫面,顯示在交叉參考面板旁。如果預覽面板已關閉,在交叉參考面板中按一下,系統會在主要程式碼視窗中開啟參考資料。
您也可以開啟或關閉交叉參考資料的底線。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-07-26 (世界標準時間)。
[null,null,["上次更新時間:2025-07-26 (世界標準時間)。"],[[["\u003cp\u003eCross-references allow exploring connections between symbols, letting you jump to definitions and find usages.\u003c/p\u003e\n"],["\u003cp\u003eClicking a symbol usage navigates to its definition, while clicking a definition opens a panel showing all usages.\u003c/p\u003e\n"],["\u003cp\u003eThe call hierarchy feature enables exploring the context of references by showing the caller of a specific line.\u003c/p\u003e\n"],["\u003cp\u003eGenerated files, such as those created from proto files, are visible and navigable through cross-references.\u003c/p\u003e\n"],["\u003cp\u003eCustomize your experience by toggling the cross-reference preview window and underlining of clickable symbols.\u003c/p\u003e\n"]]],[],null,["# Working with cross-references\n\nCross-references allow you to explore connections between symbols in the code\nbase.\n\nWhere configured, cross references are supplied by [kythe](https://kythe.io). To\ndetermine if a particular repository has cross references configured, look at the\ncross-references column on the project page. If there is a checkmark, there are\ncross-references for at least one language in that repository. Note that not all\nrepositories with checkmarks have cross-references for the same set of\nlanguages.\n\nJumping to a definition\n-----------------------\n\nWhere cross-references are enabled, symbols become links. Clicking a symbol\nusage navigates to the place in the code where the symbol is\ndefined. See [Cross-reference settings](#cross-reference_settings) for\ninformation on enabling underlining for clickable symbols.\n\nFinding usages and using the cross-references panel\n---------------------------------------------------\n\nClicking the place where a symbol is defined opens the cross-reference panel\nthat shows you a list of places where the symbol is used. Clicking a\nreference jumps to that usage by opening a preview panel or by showing the usage\nin the main window. See [Cross-reference settings](#cross-reference_settings)\nfor information on toggling this behavior. When a link in the\ncross-reference panel is clicked, the code browser jumps to the version of the\nfile at which cross-references were built.\n\nUsing the call hierarchy\n------------------------\n\nThe call hierarchy section of the cross reference panel allows you to explore\nthe context of references. In the call hierarchy section, clicking the twistie\nnext to the line number shows you the caller of that reference. This allows you\nto explore the call hierarchy upward.\n\nViewing generated files\n-----------------------\n\nIn repositories with cross-references, you can see artifacts generated from the\nbuild that are not present in the repository; for example, `.cc` and `.h`\nfiles created from proto files. Some files downloaded as part of the build\nprocess are also visible.\n\nSome links from the cross-references panel take you into generated files. You\ncan navigate to these generated files from the directory panel view.\n\nCross-reference settings\n------------------------\n\nYou can toggle the cross-references preview window. When the preview panel is\non, clicking in the cross-reference panel opens a preview of the file next to\nthe cross reference panel. When the preview panel is off, clicking in the\ncross-reference panel opens the reference in the main code window.\n\nYou can also turn underlining of cross references on and off."]]