智能代碼補全

智能代碼補全[1]是一種編程環境中,有上下文感知的的代碼自動完成功能。它可以通過減少打字錯誤和其他常見錯誤,使編寫應用的速度得到提升。智能代碼補全通常在鍵入、查詢函數參數以及與語法錯誤相關的查詢提示時,會彈出自動完成窗口。智能代碼補全和相關工具使用反射式編程產生變量名稱、函數方法的文檔以及消除歧義。[2]

Qt Creator 5.0-Autocomplete

該功能出現在許多編程環境中。[3][4]其實現包括Atom中的 「autocomplete +」和Visual Studio Code中的 IntelliSense。該術語最初被命名為「選擇列表」,一些實現仍然這樣稱呼它。[5]

概述 編輯

與其他自動完成系統相似,智能代碼補全可以便捷地訪問函數的定義,尤其是參數列表。這項功能因為減少鍵盤輸入和不需要記憶名稱,加速了軟件開發。它同時允許用戶更少地查閱外部文檔,由於許多在當前範圍的符號的交互式文檔會以提示框的形式動態顯現。[6] 智能代碼補全使用內存里的自動生成數據庫,其中有類,變量名,和代碼中定義或提及的其他概念。典型的智能感知功能的實現,靠的是檢測「標記符」,例如句號(或者其他分隔符,由語言決定)。當用戶輸入有可訪問成員(比如成員變量或函數)的實體,緊接輸入此類字符時,立刻就彈出一個智能感知建議的彈窗。用戶可以通過鍵入一個完成語句的符號(Tab ↹,↵ Enter,或者在C++中的分號)接受建議,也可以繼續輸入。久而久之,智能感知會決定用戶最可能需要的變量或函數。智能感知還會憑藉函數的源代碼中的文檔,在彈窗內顯示函數的簡介。 在支持面向對象編程的語言中,這項功能也讓用戶從一系列重載的函數中選擇。一些代碼編輯軟件以語言服務器的方式提供智能代碼補全功能。

參考來源 編輯

  1. ^ Bruch, Marcel; Monperrus, Martin; Mezini, Mira. Learning from examples to improve code completion systems. Proceedings of the 7th joint meeting of the European software engineering conference and the ACM SIGSOFT symposium on the foundations of software engineering on European software engineering conference and foundations of software engineering symposium - ESEC/FSE '09 (PDF). 2009: 213 [2022-12-13]. ISBN 9781605580012. S2CID 18621745. doi:10.1145/1595696.1595728. (原始內容存檔 (PDF)於2022-12-13). 
  2. ^ Definition of autocomplete | Dictionary.com. www.dictionary.com. [2022-12-13]. (原始內容存檔於2023-03-06) (英語). 
  3. ^ FAQ - Code::Blocks. wiki.codeblocks.org. [2022-12-13]. (原始內容存檔於2020-09-18). 
  4. ^ Qt Documentation - Completing Code頁面存檔備份,存於網際網路檔案館). Retrieved on 2015-07-07.
  5. ^ Salesforce. Working with Picklists in Apex and Lightning Web Components. developer.salesforce.com. 2008-12-09 [2022-12-13]. (原始內容存檔於2022-12-13) (美國英語). 
  6. ^ Murach. C# 2005. : 56. 
  7. ^ Earnest, Les. The First Three Spelling Checkers (PDF). Stanford University. [2011-10-10]. (原始內容 (PDF)存檔於2012-10-22). 
  8. ^ Peterson, James. Computer Programs for Detecting and Correcting Spelling Errors (PDF). December 1980 [2011-02-18]. (原始內容存檔 (PDF)於2018-06-25). 
  9. ^ Earnest, Les. Visible Legacies for Y3K (PDF). [2011-02-18]. (原始內容 (PDF)存檔於2011-07-20). 
  10. ^ Using IntelliSense頁面存檔備份,存於網際網路檔案館). Msdn.microsoft.com. Retrieved on 2014-04-04.
  11. ^ Visual Studio IntelliCode. [2022-12-13]. (原始內容存檔於2023-04-08). 
  12. ^ Eclipse Corner Article: Unleashing the Power of Refactoring | the Eclipse Foundation. [2022-12-13]. (原始內容存檔於2023-04-15). 
  13. ^ Technologies. [2022-12-13]. (原始內容存檔於2017-07-08). 
  14. ^ Eclipse Code Recommenders: It’s all about intelligent code completion頁面存檔備份,存於網際網路檔案館). Code-recommenders.blogspot.com (2010-05-03). Retrieved on 2014-04-04.
  15. ^ 542689 - Don't include Code Recommenders for 2018-12. [2022-12-13]. (原始內容存檔於2022-12-13). 
  16. ^ cross-project-issues-dev Withdrawing Code Recommenders from SimRel. [2022-12-13]. (原始內容存檔於2022-12-13). 
  17. ^ Archived Projects | The Eclipse Foundation. [2022-12-13]. (原始內容存檔於2023-04-22). 
  18. ^ Vim Intellisense頁面存檔備份,存於網際網路檔案館). Insenvim.sourceforge.net. Retrieved on 2014-04-04.

外部連結 編輯