包搜索功能 EAP 版本發佈服務器
Introducing Package Search EAPapp
Hadi Hariri 發佈於 2019 年 10 月 22 日ide
_Posted on October 22, 2019 by Hadi Hariri_ 工具
咱們很高興宣佈 IntelliJ IDEA 的一個新插件,它將在您的 JVM 項目中發現和管理依賴項時爲您提供更好的體驗。若是你是 Kotlin 開發者,你還會獲得額外的功能!post
We’re happy to announce a new plugin for IntelliJ IDEA that will provide you a better experience when it comes to finding and managing dependencies in your JVM projects. And if you’re a Kotlin developer, you’ll be getting an additional bonus! ui
找到合適的包this
Finding the right packagelua
當你正在啓動一個新的項目,或者在現有的項目上工做,你想作一些HTTP 調用…插件
You’re starting a new project, or working on an existing one, and you want to make some HTTP calls… code
嗯。哪一個庫是大多數人使用的?讓我谷歌一下。好吧,有不少。
Hmm. Which library is the one that most folks are using? Let me Google it. Well there’s a bunch of them.
Stackoverflow 告訴我這是最好的。不知道它是否還有人維護。讓我看看 Star 和 Fork 數字。
StackOverflow tells me this is the best and greatest. Wonder if it’s still maintained. Let me look at the Stars and Forks.
好吧,我就用這個了。讓我在 Maven Central 找找看。
OK, I’m going with this one. Right. Let me find it on Maven Central.
複製/粘貼。
Copy/Paste.
搞定
Done
咱們之前都這麼幹。即便咱們知道咱們要使用的庫,咱們仍然會查找並在項目中引用最新版本。
We’ve all been there. Even if we know the library we want to use, we still go through the process of finding the latest version and referencing it in our project.
歡迎使用包搜索
Welcome to Package Search
有了包搜索,如今就簡單多了。您能夠直接在 IDE 中搜索、評估和管理全部的依賴。
With Package Search this is now much simpler. From within the IDE, you can search, evaluate and manage all your dependencies.
打開 Packages 工具窗口,或者調用 Package dependency 操做來搜索新的包。
Pull up the Packages tool window or simply invoke the Package dependency action to search for new packages.
Package Manager 窗口提供了諸如源代碼連接、StackOverflow 活動、GitHub 等信息,而且全部這些信息均可以經過條目中的連接直接訪問。此外,它還提供了當前安裝的全部軟件包的列表。您能夠直接在列表中添加、刪除和更新包。
The Package Manager Window provides information such as the source code links, activity on StackOverflow, GitHub, and all accessible directly with links from the entry. In addition it provides a list of all currently installed packages. From here you can add, remove, and update packages.
咱們目前只支持 Maven 和 Gradle,可是系統是徹底插件化的,咱們將在將來增長對其餘構建工具的支持。
We currently support Maven and Gradle, although the system is completely pluggable and we’ll be adding support for other build tools in the future.
代碼補全功能
Code Completion Functionality
若是您喜歡直接在構建文件中添加依賴項,那麼您將很高興地知道,從 2019.2 開始,您已經在使用包搜索了。IntelliJ IDEA 最新版本的代碼補全功能就是基於包搜索服務器的,這使得它不只更加完整,並且在速度更快。
If you prefer adding dependencies directly yourself in your build files, you’ll be pleased to know that for starting with the 2019.2 IDE, you’ve already been using Package Search. The code completion that IntelliJ IDEA provides since the latest version is based on the Package Search Server, making it not only more complete but faster in terms of performance also. Code Completion
Kotlin 和多平臺包查找
Kotlin and Multiplatform discovery
若是您是 Kotlin 用戶,您可能遇到過一個特定的場景,您正在尋找一個庫,但不肯定它支持哪些平臺。或者在開發多平臺應用程序的狀況下,須要一個支持全部目標平臺的庫。
If you’re a Kotlin user, you may have come across a certain scenario where you’re looking for a library and not sure which platforms it supports. Or in the case of developing multiplatform applications, you’d want something that supports all your target platforms.
包搜索經過提供有關庫的目標平臺的附加信息來知足這一需求。下面的示例顯示了 assertk 的狀況,這是一個支持多種目標平臺的跨平臺庫。在右側窗格中,您能夠看到特定的標記。
Package Search caters to this need by providing you additional information about target platforms for libraries. The example below shows the case of assertk, a multiplatform library with support for a variety of targets. On the right pane you can see the specific ones as tags.
試試看
Trying it out
要得到 Package Window 和可視化界面,您須要安裝市場上提供的包搜索插件。
To get the Package Window and visual interface, you need to install the Package Search plugin that is available on the marketplace.
若是您在使用 IntelliJ IDEA 2019.2 或更高版本,那麼您已經在依賴包信息補全上用過這個功能了。
If you’re using IntelliJ IDEA 2019.2 or later, you’re already using this functionality when it comes to code completion for packages.
還有哪些功能
What’s in store
咱們爲包搜索計劃了大量的功能,其中包括
We have a ton of functionality planned for Package Search, amongst other things
對於那些有使用 nuget 經驗並正在使用咱們的 .NET IDE Rider 的用戶來講,這些都是很熟悉的功能。可是,在以前的基礎上,咱們如今還增長了本身的包索引和附加的元數據。
For those of you who have experience with NuGet and are using our .NET IDE Rider, this will definitely be familiar to you. The enhancements however are that we now have our own package index with additional metadata.
可是包搜索的目的是使發現和依賴關係管理更容易,避免您花費時間搜索、收集信息和複製/粘貼代碼。你的時間是寶貴的,因此咱們最不但願你讀長篇博客文章。
But Package Search is all about making discovery and dependency management easier, avoiding you having to spend time searching, collecting information and copy/pasting code. Your time is valuable, so that last thing we want is for you to read long blog posts.
試試看,若是你有任何反饋,請告訴咱們。
Try it out and and let us know if you have any feedback.