1. Autocompletion (Tab)
Intellij IDEA-neun Kotlin eoneoreul mandeun hoesa-wa gateun hoesa(JetBrains)ga mandeun gaebal hwangyeongimnida. Geuraeseo IDEA-ga segye-eseo Kotlin-eul gajang jal ihaehaneun geosi nollapji anhseumnida.
Intellij IDEA-eneun autocompletioniraneun jeongmal meotjin gineung-i itseumnida. I gineung-eun peurojekteu-ui modeun paeil, yeongyeoldoen modeun raibeureori-reul bunseokhae, eotteon keullaeseu, hamso, byeonsuga inneunji ihaehabnida. Geurigo geu jeongbo-reul sayonghae kodeu jagsseong-eul dounida.
Danji dan-eoreul sseugi sijakhamyeon, got바로 hinto-reul jepgyehabnida. Jung-yo han kiji jung hana-neun tab key, 즉 «Tab» imnida.
Yereul deureo, konsol-e tekseuteu-reul chulryeokhago sipseumnida. Kotlin-eseoneun i ttae hamso println()eul sayonghabnida. prireul sseugi sijakhago «Tab»eul nureumyeon: IDEA-ga seuseuro dan-eoreul wanseonghago gwalhoreul butyeo jumnida.
Gaekche ireum dwie jeom(.)eul jjeok-eumyeon, IDEA-ga geu gaekche-e daehae sayong ganeunghan hamsowa sokseong moglog-eul jepgyehabnida. Modeun methodeureul amgihaji anado doeeo aju pyeonrihabnida.
Yereul deureo tekseuteu byeonsu-reul mandeuldeossdago haebosyeo. Tekseuteu-reul dae-munjaro bakkuneun hamso ireum-eul kkog gieokhal piryoneun eopseumnida. Danji byeonsu ireum-eul sseugo jeom-eul jjeok-euseyo:
fun main() {
val text = "Hello Kotlin"
text. // <-- I sungan, jeom dwie-seo IDEA-ga myeongnyeong moglog-eul boyeojumnida
}
Jungyohan jeom: meonjeo byeonsu ireum(text)eul sseugo, geu da-eum-e jeom-eul jjeokseumnida. Deullak moglog-eseo sokseong(ye: length — giri)gwa hamso(ye: uppercase(), replace())reul bol su itseumnida.
CamelHumps
Gajeonghaebopsida. gineun keullaeseu ireum, ye: InputStreamReaderreul sseugo sipseumnida. IntelliJ IDEA-neun sigan-eul jeollyakhal su itge haejubnida: daemunja-man ISR (InputStreamReader)reul chigo Tabeul nureumyeon, IDEA-ga i yakja-reul keullaeseuui jeonche ireum-euro byeonhwanhae jumnida. geoui magie gatjyo.
2. Live Templates
IntelliJ IDEA-eneun Live Templatesra go bulrineun kodeu yeje ga yeolsumani itseumnida. Kotlin-eseo gajang manhi sseuneun geosdeul-eun daeum-gwa gateumnida:
main hamso
Peurogeuraem-eul sirhaengharyeomyeon fun main() hamso-ga piryohabnida. Igeol mae beon son-euro sseuneun geon neomu geollimnida.
Danji 4geulja maineul sseugo Tab(ttoneun Enter)eul nureuseyo.
IDEA-ga jeokseokeseo daeum cheoreom pyeolchyeo jumnida:
fun main() {
}
Chamgo-ro, yejeon Java tempeullit psvmdo Kotlin paeil-eseo dongjak hajiman, maine iksukhage doeeoseyo.
Loop (fori)
Bbalri loop-eul sseuryeomyeon fori + Tabeul sayonghal su itseumnida. IDEA-ga loop-ui teul-eul mandeureo jumnida:
for (i in 0..index) {
}
Nam-eun geon kakeun gaekkaji kaunteo-ga gage halji jeonghaneun geotppunimnida.
soutv (System.out Variable) — byeonsu gap chulryeok.
age byeonsu-ga itdamyeon, soutvreul sseugo Tab-eul nureuseyo. IDEA-ga gajang gakkaun byeonsu-reul chaj-a daeum kodeu-reul saengseonghabnida:
println("age = $age")
soutm (System.out Method) — methodeu ireum chulryeok.
Peurogeuraem-i methodeu-e deureogasseonneunji aninji hwaginhal ttae yuyonghabnida. daeum-eul saengseonghabnida:
println("Main.main") // dangsin-ui keullaeseu-wa methodeu ireum
iter (Iterate) — collection sunhoe.
element moglog(ye: users)i itdamyeon, i tempeullit-eun for-each loop-eul mandeureo jumnida:
for (user in users) {
}
todo — hu-il-eul wihan memo.
IDEA-eseo hwaryeohan saek-euro gangjo doego, hal-il moglog(keu a-lae TODO tab)-e-do deureoganeun teukbyeolhan comment-reul namgimnida:
// TODO: implement this method later
fixme — chungdae pyo-si.
TODO-wa yusa hajiman, kodeu-ga jalmos dongjak-hageona geuphi sujeong-i piryohan buwi-e sayonghabnida:
// FIXME: an error occurs here, needs to be fixed!
3. Postfix Completion
이미 sseo duneun pyohyeon-e jeom(.)eul majimak-e butineun geotmaneuro, dareun kodeu-ro byeonhwanhal su itge haejubnida.
Byeonsu-reul gwalho-ro gamssageona, jogeonmun-euro gamssagi wihae jul cheoeum-euro dor-a gal piryoga eopseumnida. Saenggak-ui heureum-eul kkeutji anko oenjjog-eseo oreunjjog-euro kodeu-reul sseumyeon doemnida.
Yese:
- .sout — pyohyeon-eul
println(...)euro gamssabnida - .var — pyohyeon-eul gibon-euro byeonsu-reul mandeubnida.
- .not — boolean gap-eul banjeonhamnida(pyohyeon ap-e
!reul butim).
Eotteohge boyeoneunji:
| Dangsin-i sseuneun geot | Tab-eul nureumyeon — eokge doeneun geot |
|---|---|
"Hello".sout |
println("Hello") |
10 + 5.var |
val i = 10 + 5 |
isValid.not |
!isValid |
4. Gamssa-gi: Ctrl+Alt+T
Gakkeumeun 이미 sseo duneun kodeu-reul if jogeonmun, loop, ttoneun yewoe cheori 블록 try-catch an-e neoeoya hal ttaega itseumnida.
Gwalho-reul son-euro sseugo kodeu-reul boksa haneun dae신, «Surround With» 명령-eul sayonghaseyo:
- Kodeu jull-eul seontaekhaseyo.
- Ctrl+Alt+T(Windows/Linux) ttoneun Cmd+Opt+T(macOS)reul nureuseyo.
- Moglog-eseo piryohan gujo(if, while, try/catch deung)reul seontaekhaseyo.
IDEA menu yese:
5. Anjeonhan ireum byeongyeong: Shift+F6
Byeonsu, hamso, keullaeseu-reul tekseuteu-reul jiwogo daechehaneun sig-euro jeoldaero ireum-eul bakkugi maseyo! Byeonsu-ga 10gun데서 sseigo itdamyeon, geu modeun goseul chaja son-euro 고쳐야 하고, geugeos-eun silsu-reul bosejanghabnida.
Rename Refactoringeul sayonghaseyo:
- Byeonsu ireum-wi-e keoseo-reul olun.
- Shift + F6reul nureuseyo.
- Saeroun ireum-eul ipryeokhago Enter-reul nureuseyo.
IntelliJ IDEA-ga peurojekteu jeonche-eseo i byeonsu-ui modeun sayong cheo-reul chaja, kkalkkeumhage ireum-eul ilgwal byeongyeonghae jumnida.
6. Eodideun geomsaek: Shift + Shift
Paeil-eul ileobeoryeosseona, keullaeseu wi-chi-reul ijeobeoryeosseona, menu-eseo piryohan seoljeong-eul chajji mothagetseumyeon — danghwanghaji maseyo.
Danji Shift key-reul yeonseok-euro du beon nureuseyo.
Search Everywhere(eodideun geomsaek) chang-i yeollimnida. Paeil ireum, keullaeseu ireum, ttoneun seoljeong myeong(ye: "Font size") kkaji ipryeokhagi sijakhamyeon, IDEA-ga 즉시 chaj-abnida.
7. Local History
Ireohge sangsanghaeboseyo: 30bun 동안 kodeu-reul sseuda-ga, modu jiwogo 새로 sseugiro haetsseumnida. Jiwotseumnida. Geurigo jalmothanda-neun geol arasseumnida. Ctrl+Z-reul nureuneundeyo, silsu-ro paeil-eul 닫아 beoryeosseumnida... Geuraeseo undo-ga deo isang andoemnida. Panik?
Animnida! IntelliJ IDEA-eneun jaesin-ui “time machine” — Local Historyga naejangdoeeo itseumnida.
Git-eul sayonghaji anado, myeot bun mada kodeu beojeon-eul jeojanghabnida. Gwa거-ui kodeu-ro dolligi wihaeseoneun:
- Kodeu pyeonjipgi eodideun (ttoneun peurojekteu teuri-eseo paeil) o-reun chuk mausu beoteun-eul nureuseyo.
- Local History -> Show Historyreul seontaekhaseyo.
- Yeollin chang-eseo 왼쪽-eseo paeil beojeon-eul seontaekhan hue, bokgwi beoteun(Revert)eul nureuseyo.
8. Code style: Ctrl+Alt+L
Kodeu-reul boksa-hageona ppalli sseuneun gwajeong-eseo format-i mang가지는 gyeongu-ga aju maneumnida: deungseon-i crooked, bulpil-yo han gongbaek, gwalho wi-chi-ga eogeul린 deung.
Kodeu-ga gong-in Kotlin Style Guidee matchdorok haryeomyeon, Ctrl+Alt+L(Windows/Linux) ttoneun Cmd+Opt+L(macOS)reul nureuseyo.
IDEA-ga jadong-euro gongbaek-gwa 줄 바꿈-eul jeongrihae jumnida.
Yese:
| Jeon | Hu |
|---|---|
|
|
Style seoljeong-eun Settings - Editor - Code Styleeseo chaj-eul su itseumnida:

GO TO FULL VERSION