您现在的位置是:热点 >>正文
写代码效率不高?放过Ctrl C 和 V,让AI来能帮你写代码吧
热点31226623人已围观
简介...
做为程序员,不知道你有没有想像过,如果某天,不再需要面向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 率不fis = new FileInputStream(srcFile); FileOutputStream fos = new FileOutputStream(dstFile)) { int len; 高? byte[] buffer = new byte[4096]; while ((len = fis.read(buffer)) > 0) { &nb放过sp; fos.write(buffer, 0, len); } } catch (IOException e) { &nbCtsp; // ... handle IO exception }
这下知道为啥人家口号喊的响的原因了吧。
另外,你有没有注意到,在提示的列表里,FileOutputStream 和 FileWriter 这两项后面的数字。这也是除了自动补全之外称为AI的能力,毕竟还大数据分析了嘛。
特别是对于多个外部项目依赖时,如果重名了,该用哪个,大数据告诉你,更多人的选择是谁。
比如要通过Http请求个资源,除了要用Get/Postrl,构造Entity,拼接URL,还要干啥来着,摸了一把日渐稀少的头发,写下了HttpClient,一回头,IDE里早提示了
那就Post吧,随着下方向键和一声Enter的大力敲击,这段代码就出现了:
try { HttpPost httpPost = new HttpPost("https://example.com"); &nb Csp; httpPost.setEntity(new StringEntity("{"key": "value"}", ContentType.APPLICATION_JSON)); String responseBody = httpClient.execute(httpPost, httpResponse ->&n 和bsp;{ int status = httpResponse.getStatusLine().getStatusCode(); if (status <  V;200 || status >= 300) { // ... handle unsuccessful request &n,让bsp; } HttpEntity entity = httpResponse.getEntity(); return entity !=AI null ? EntityUtils.toString(entity) : null; }); // ... do something with response &nb来能sp; } catch (IOException e) { // ... handle IO exception &帮你nbsp;}
我想为了提升代码的开发效率,许多人曾经会记录一些常用的代码片段,一般称之为代码的Snippet,一些编辑器里也有这种管理小工具。
这一下子,连 Snippet 也省了,还少了Ctrl C +V 的过程。
3. 查看更多
如果提示列表里没有感兴趣的,还想看更多的示例怎么办?
好办!
在某个关键词右击对应的类名,在弹出的菜单里选择【Get relevant examples】,会在IDE的右侧看到更多关于该类的使用Demo。
右侧的显示
4. 再多
如果还不够,点击这个链接,在浏览器里一次看个痛快吧。
Tags:
相关文章
微软推出全新AI形象 Mico,Clippy 回归“变身”人工智能好友
热点在周四举行的 Copilot 秋季发布会上,微软正式推出了一款全新人工智能形象—— Mico ,这是该公司在消费者端推进 AI 拟人化的重要一步。Mico 的名字源自 “Microsoft Copil...
【热点】
阅读更多AI“戏精”上身!一张照片变身电影大片,Gaga AI颠覆影视创作
热点全球首个专注于人物对话的影视级音画同步模型——Gaga AI正式亮相。这款由Gaga AI团队推出的创新工具,不再是简单的图像动画或唇形匹配,而是真正赋予AI“演员”的灵魂:通过一张静态照片和一段提示...
【热点】
阅读更多标签: 欢聚 BIGO Ads 直播业务 价值标的
热点云梦级11月20日云梦级消息,北京时间周四早间,欢聚 (JOYY.US)公布2025年第三季度业绩。公司总收入5.4亿美元,环比增长6.4%。其中,直播业务收入3.88亿美元,环比增3.5%,连续两个...
【热点】
阅读更多
热门文章
最新文章
友情链接
- 标签: 康师傅
- https://www.tombow.com/en/search/谷歌留痕外推【tg:seogoogle987】,cV2
- https://www.remit.co.jp/vi/?s=谷歌留痕外推【tg:seogoogle987】q4E
- https://www.wikiart.org/pt/Search/谷歌留痕外推【tg:seogoogle987】,Ux8
- https://www.lyrics.com/lyrics/kkk3谷歌留痕外推【tg:seogoogle987】,w0i
- https://www.openspaceinstitute.org/search?q=谷歌留痕外推【tg:seogoogle987】,XIn
- https://www.lifesciencesweden.se/search?q=谷歌留痕外推【tg:seogoogle987】,BI7
- https://www.quarterjacksurgery.co.uk/?AT=3rBy&s=谷歌留痕外推【tg:seogoogle987】,JFR
- https://www.swecobelgium.be/?page=9&s=谷歌留痕外推【tg:seogoogle987】,InR
- https://www.goodreads.com/quotes/tag/谷歌留痕外推【tg:seogoogle987】jiZ
- https://www.lindseymedicalsupply.com/search/谷歌留痕外推【tg:seogoogle987】,u6L
- https://www.whatsonstage.com/search?cat=64&term=谷歌留痕外推【tg:seogoogle987】,9QT
- https://www.zutari.com/?s=谷歌留痕外推【tg:seogoogle987】,7SK
- https://www.rockngem.com/?action=CHECK&s=谷歌留痕外推【tg:seogoogle987】,58L
- https://www.resilienz-akademie.com/?cat=71&s=谷歌留痕外推【tg:seogoogle987】,GJO
- https://www.roberthalf.com/us/en/jobs/all/谷歌留痕外推【tg:seogoogle987】PEi
- https://www.youm7.com/Home/Search?allwords=谷歌留痕外推【tg:seogoogle987】,BU4
- https://www.wellbees.com/index.php/catalogsearch/result/index/?q=谷歌留痕外推【tg:seogoogle987】,Es6
- https://www.woorden.org/spreekwoord.php?woord=谷歌留痕外推【tg:seogoogle987】,2OZ
- https://www.swanagerailway.co.uk/search?q=谷歌留痕外推【tg:seogoogle987】,RHu
- https://www.paxnet.co.kr/search/jongmok?kwd=谷歌留痕外推【tg:seogoogle987】3mH
- https://www.spoiledsweetboutique.com/search/谷歌留痕外推【tg:seogoogle987】,5qM
- https://www.nctsn.org/search?cat=191&query=谷歌留痕外推【tg:seogoogle987】,1QJ
- https://www.kingston.gov.uk/site-search/results/?q=谷歌留痕外推【tg:seogoogle987】,mih
- https://www.lee.com/search?q=谷歌留痕外推【tg:seogoogle987】,Ki1
- https://www.ons.gov.uk/search?q=谷歌留痕外推【tg:seogoogle987】,3h9
- https://5gaa.org/?token=6e2l7hjt2i26gzgctgwdrv7v0j6nxorq&s=谷歌留痕外推【tg:seogoogle987】ak9
- https://www.impactpool.org/search/?type=79&q=谷歌留痕外推【tg:seogoogle987】kAN
- https://www.unclefossil.com/search/谷歌留痕外推【tg:seogoogle987】,Oa5
- https://5gaa.org/?token=6e2l7hjt2i26gzgctgwdrv7v0j6nxorq&s=谷歌留痕外推【tg:seogoogle987】rjU
- https://www.teamlab.art/ko/?submit=谷歌留痕外推【tg:seogoogle987】,ZOQ
- https://www.nextavenue.org/?action=QUERY&s=谷歌留痕外推【tg:seogoogle987】,kgc
- https://www.theaerogroup.net/?cat=28&s=谷歌留痕外推【tg:seogoogle987】,lMz
- https://www.parriscues.com/catalogsearch/result/?q=谷歌留痕外推【tg:seogoogle987】,9MG
- https://www.luxurysociety.com/en/search?q=谷歌留痕外推【tg:seogoogle987】,8cL
- https://www.ussalabama.com/?action=CHECK&s=谷歌留痕外推【tg:seogoogle987】,eDd
- https://www.rookwinkel.nl/catalogsearch/result/index/?q=谷歌留痕外推【tg:seogoogle987】,5km
- https://www.yidian51.com/taobao/谷歌留痕外推【tg:seogoogle987】,qRF
- https://www.tumblr.com/tagged/谷歌留痕外推【tg:seogoogle987】,1SN
- https://www.ng-slo.si/si/iskanje?cat=114&q=谷歌留痕外推【tg:seogoogle987】,ISr
- https://www.youtube.com/hashtag/谷歌留痕外推【tg:seogoogle987】,aTF
- https://www.vet-direct.com/search?cat=72&term=谷歌留痕外推【tg:seogoogle987】,S0q
- https://www.sic-info.org/vi/?s=谷歌留痕外推【tg:seogoogle987】,f61
- https://www.tiktok.com/tag/谷歌留痕外推【tg:seogoogle987】,GtT
- https://www.mintos.org/?s=谷歌留痕外推【tg:seogoogle987】,3Ma
- https://store.line.me/search/sticker/ja?q=谷歌留痕外推【tg:seogoogle987】PNc
- https://www.roberthalf.com/us/en/jobs/all/谷歌留痕外推【tg:seogoogle987】qPm
- https://hsmoa.com/search?query=谷歌留痕外推【tg:seogoogle987】bJu
- https://zhidao.baidu.com/index/?action=QUERY&word=谷歌留痕外推【tg:seogoogle987】,qxA
- https://www.kawainter.com/catalogsearch/result/?q=谷歌留痕外推【tg:seogoogle987】,mGl
- https://www.schenckprocess.com/search?q=谷歌留痕外推【tg:seogoogle987】,eFu