您现在的位置是:热点 >>正文
写代码效率不高?放过Ctrl C 和 V,让AI来能帮你写代码吧
热点6484人已围观
简介...
做为程序员,不知道你有没有想像过,如果某天,不再需要面向Google、Stackoverflow编程,不再需要Ctrl + C 和 Ctrl + V,你在IDE里敲出某个编程语言的关键词时,像导航一样,下一步的代码就已经展现出来;
做为程序员,不知道你有没有想像过,如果某天,简单说几句话,或者简短写几句,就能够实现你的需求,完成代码开发。谈笑间,bug 灰飞烟灭。一切尽在弹指一挥间;
做为程序员,不知道你有没有想像过,如果某天,写程序也能有个智能的助手,像出行、购物一样,告诉你哪个API调用的人更多,他们是怎么用的。
那样就会空出大量的时间,去做代码之外,其它你想做的事情。当然,你也可以接更多的需求,写更多的代码嘛 :-)
这样的情况你有没写代有想过?
关于程序员,有个调侃的笑话,大意是这样的:
一个程序员,技术水平一般,经常写代码到很晚,bug 还多。他的女朋友很是心疼。后来一段时间,这哥们发现,前一天晚上遗留bug的代码,第二天在公司运行一切正常。太惊讶了。某天半夜醒来忽然发现,他女朋友在电脑上帮他改bug...
看到能写代码改bug的女朋友,是不是让前面的想法更强烈了?
梦想还是要有的,万一实现了呢?
这不,说着说着它就来了。迎面走来的就是我们今天要说的「写代码小助手」,「AI代码小能手」,无所谓怎么称呼了,你开心叫它大黄也行。
进入视线的就是它 Codota:
1. 安装
在IDEA的插件列表里搜索一下,你一定会注意到开头介绍里的那句「AI code completions」。
当然码效,在其它的IDE里也大概类似,毕竟人家的口号是「AI Code Autocomplete for All Languages and IDEs」,划重点,所有的语言和IDE。
具体有什么本领,就让它来让两步,出来溜溜吧。
插件安装之后,在编写代码时的提示列表里会多出来许多浅绿色的,这是 Codota的内容。
2. 使用
官方功能介绍的视频里,是以JDBC为例,
除了这种API的调用提示外,还有常用代码片段自动生成,要不人家口号也不敢喊那么响。
比如你在IDE里刚写了个 File ,他会询问你想干啥。
比如常用的文件拷贝、内容压缩等等。如果选择了copyFile这个,下面的这一段代码就生成好了
try (FileInputStream fi率不s = new FileInputStream(srcFile); FileOutputStream fos = new FileOutputStream(dstFile)) { int len; &nb高?sp; byte[] buffer = new byte[4096]; while ((len = fis.read(buffer)) > 0) { &nb放过sp; fos.write(buffer, 0, len); } } catch (IOException e) { &nCtbsp; // ... handle IO exception }
这下知道为啥人家口号喊的响的原因了吧。
另外,你有没有注意到,在提示的列表里,FileOutputStream 和 FileWriter 这两项后面的数字。这也是除了自动补全之外称为AI的能力,毕竟还大数据分析了嘛。
特别是对于多个外部项目依赖时,如果重名了,该用哪个,大数据告诉你,更多人的选择是谁。
比如要通过Http请求个资源,除了要用Get/Post,构造rlEntity,拼接URL,还要干啥来着,摸了一把日渐稀少的头发,写下了HttpClient,一回头,IDE里早提示了
那就Post吧,随着下方向键和一声Enter的大力敲击,这段代码就出现了:
try { HttpPost httpPost = new HttpPost("https://example.com");   C; httpPost.setEntity(new StringEntity("{"key": "value"}", ContentType.APPLICATION_JSON)); String responseBody = httpClient.execute(httpPost, httpResponse -> 和123; int status = httpResponse.getStatusLine().getStatusCode(); if (status < 200&n Vbsp;|| status >= 300) { // ... handle unsuccessful request &n,让bsp; } HttpEntity entity = httpResponse.getEntity(); return entity != nAIull ? EntityUtils.toString(entity) : null; }); // ... do something with response  来能; } catch (IOException e) { // ... handle IO exception  帮你;}
我想为了提升代码的开发效率,许多人曾经会记录一些常用的代码片段,一般称之为代码的Snippet,一些编辑器里也有这种管理小工具。
这一下子,连 Snippet 也省了,还少了Ctrl C +V 的过程。
3. 查看更多
如果提示列表里没有感兴趣的,还想看更多的示例怎么办?
好办!
在某个关键词右击对应的类名,在弹出的菜单里选择【Get relevant examples】,会在IDE的右侧看到更多关于该类的使用Demo。
右侧的显示
4. 再多
如果还不够,点击这个链接,在浏览器里一次看个痛快吧。
Tags:
相关文章
Nous Research 发布 Hermes 4 AI 模型,超越 ChatGPT 并无内容限制
热点Nous Research 是一家低调的人工智能初创公司,近日推出了 Hermes4系列大型语言模型。该公司声称,Hermes4的性能与当前领先的商业系统相当,甚至在数学基准测试中表现更佳,同时用户的...
【热点】
阅读更多标签: 盈合机器人 熊猫资本 李论 盈峰集团
热点云梦级6月10日云梦级消息,据AIPress报道,近日,熊猫资本创始合伙人李论连发数条视频,以盈合机器人股东兼董事身份,隔空喊话“美的大公子”、盈峰集团创始人何剑锋,要求就盈合机器人“融超6亿却濒临死...
【热点】
阅读更多谷歌云试图抢占SAP软件云市场 但击败微软和亚马逊并不易
热点新浪科技讯 北京时间9月17日早间消息,据报道,由于全球领先的企业软件供应商SAP(译者注:中文译名思爱普)为许多公司的业务运营和客户关系维护提供了至关重要的软件,亚马逊、谷歌和微软这样的企业技术公司...
【热点】
阅读更多
热门文章
最新文章
友情链接
- 标签: 康师傅
- https://www.remit.co.jp/id/?s=谷歌站群软件【tg:seogoogle987】,7yU
- https://www.livehindustan.com/tags/谷歌站群软件【tg:seogoogle987】,I1V
- https://www.ng-slo.si/si/iskanje?cat=114&q=谷歌站群软件【tg:seogoogle987】,jRA
- https://www.seforall.org/search?keywords=谷歌站群软件【tg:seogoogle987】,t9E
- https://xehay.vn/tim-kiem/=谷歌站群软件【tg:seogoogle987】,UqW
- https://www.symatoys.com/search.html?ID=UyMD6aO58bPrJvQAB1I0N69KzJBZeNPC&keyword=谷歌站群软件【tg:seogoogle987】,Yie
- https://www.manga-news.com/index.php/recherche/?q=谷歌站群软件【tg:seogoogle987】,u9Q
- https://zhidao.baidu.com/index/?action=QUERY&word=谷歌站群软件【tg:seogoogle987】,ipR
- https://www.pearson.com/en-us/search.html?aq=谷歌站群软件【tg:seogoogle987】,4ND
- https://www.paspaley.com/catalogsearch/result/?action=QUERY&q=谷歌站群软件【tg:seogoogle987】,Ara
- https://www.navymwr.org/search/?query=谷歌站群软件【tg:seogoogle987】,OMX
- https://www.whiterock2008.com.tw/search?q=谷歌站群软件【tg:seogoogle987】,ukK
- https://www.monroecounty.gov/search/?q=谷歌站群软件【tg:seogoogle987】,2AD
- https://www.tiktok.com/tag/谷歌站群软件【tg:seogoogle987】,kB8
- https://www.kaliastyle.com/catalogsearch/result/?q=GOOGLE谷歌站群软件【tg:seogoogle987】,Pw6
- https://www.parriscues.com/catalogsearch/result/?q=谷歌站群软件【tg:seogoogle987】,Wvo
- https://www.searcychamber.com/list/search?AsfnA=DtkTQzs&q=谷歌站群软件【tg:seogoogle987】,Z58
- https://www.lee.com/search?q=谷歌站群软件【tg:seogoogle987】,MHW
- https://www.sebson.de/en/search?query=谷歌站群软件【tg:seogoogle987】,gsx
- https://www.teamlab.art/fr/?submit=谷歌站群软件【tg:seogoogle987】,tSa
- https://www2.ual.es/ProyectoLates/?s=谷歌站群软件【tg:seogoogle987】,hHH
- https://www.yli.ro/catalogsearch/result/?q=谷歌站群软件【tg:seogoogle987】,Gxm
- https://www.mintos.org/?s=谷歌站群软件【tg:seogoogle987】,GS0
- https://www.sogou.com/web?query=谷歌站群软件【tg:seogoogle987】,zb0
- https://www.nslcleaders.org/?s=谷歌站群软件【tg:seogoogle987】,IHv
- https://www.msrenewal.com/search/谷歌站群软件【tg:seogoogle987】,SsK
- https://www.target.com/s?searchTerm=谷歌站群软件【tg:seogoogle987】,kAP
- https://www.revere.org/search?action=SEARCH&q=谷歌站群软件【tg:seogoogle987】,Rcw
- https://www.resopal.de/catalogsearch/result/?action=SEARCH&q=谷歌站群软件【tg:seogoogle987】,6Au
- https://www.resilienz-akademie.com/?cat=71&s=谷歌站群软件【tg:seogoogle987】,cRw
- https://www.duksung.ac.kr/search/front/Search.jsp?qt=谷歌站群软件【tg:seogoogle987】fOl
- https://www.toy-people.com/?s=谷歌站群软件【tg:seogoogle987】,eOu
- https://www.swecobelgium.be/?page=9&s=谷歌站群软件【tg:seogoogle987】,UE7
- https://www.shopping.com/search.html?keyword=谷歌站群软件【tg:seogoogle987】,zm1
- https://www.scivee.tv/?s=谷歌站群软件【tg:seogoogle987】,l6P
- https://www.roberthalf.com/us/en/jobs/all/谷歌站群软件【tg:seogoogle987】dLW
- https://store.line.me/search/sticker/ja?q=谷歌站群软件【tg:seogoogle987】qyu
- https://www.remit.co.jp/ne/?s=谷歌站群软件【tg:seogoogle987】,2S4
- https://www.vfw.org/search-results?q=谷歌站群软件【tg:seogoogle987】,r1L
- https://www.teacherspayteachers.com/Browse/Search:谷歌站群软件【tg:seogoogle987】,pRE
- https://www.paulaschoice.hk/zh_hant/catalogsearch/result/?q=谷歌站群软件【tg:seogoogle987】,WFC
- https://www.roberthalf.com/us/en/jobs/all/谷歌站群软件【tg:seogoogle987】xoi
- https://www.pmindia.gov.in/en/?s=谷歌站群软件【tg:seogoogle987】,0Fr
- https://jihoon471.cafe24.com/product/search.html?banner_action=&keyword=谷歌站群软件【tg:seogoogle987】xlA
- https://www.wuv.edu/?s=谷歌站群软件【tg:seogoogle987】,bPT
- https://www.lifesciencesweden.se/search?q=谷歌站群软件【tg:seogoogle987】,6Ih
- https://www.navylookout.com/?ID=nSBR6Ivdu6lZg1yr2SDs30Lo5sTs76yJ&s=谷歌站群软件【tg:seogoogle987】,8r6
- https://www.writingforward.com/?action=SEARCH&s=谷歌站群软件【tg:seogoogle987】,ZFw
- https://www.tumblr.com/tagged/谷歌站群软件【tg:seogoogle987】,rG2
- https://www.partilerdunyasi.com/index.php?route=product/search&tag=谷歌站群软件【tg:seogoogle987】,fLo