Yuav ua li cas tshem tawm cov khoom siv tsis siv hauv IntelliJ?
Yuav ua li cas tshem tawm cov khoom siv tsis siv hauv IntelliJ?

Video: Yuav ua li cas tshem tawm cov khoom siv tsis siv hauv IntelliJ?

Video: Yuav ua li cas tshem tawm cov khoom siv tsis siv hauv IntelliJ?
Video: Tsis Muaj Peev Xwm Yuav Ua Li Cas 2024, Hlis ntuj nqeg
Anonim

Hmoov zoo, koj tuaj yeem ua tiav tshem tawm tus tsis siv ntshuam nqe lus. Los ntawm cov ntsiab lus ua haujlwm (alt + enter), xaiv "Optimize Ntshuam "thiab IntelliJ IDEA yuav tshem tawm tag nrho cov tsis siv ntshuam los ntawm kod!

Yog li ntawd, yuav ua li cas kuv thiaj li tshem tawm cov khoom tsis xav tau hauv IntelliJ?

Nias Ctrl + Alt + O., thiab xaiv Tshem tawm cov khoom siv tsis siv . Qhib Reformat File Dialog Ctrl + Ua haujlwm + Alt + L thiab xaiv qhov Optimize imports checkbox.

Ib tug kuj yuav nug, kuv yuav ua li cas tshem tawm cov khoom siv tsis siv nyob rau hauv dab noj hnub? Txhawm rau tshem tawm cov khoom siv tsis siv hauv Eclipse IDE:

  1. Nyem Source Menu –> Organize Imports.
  2. Tom qab npaj cov khoom siv tsis siv.
  3. Kev xaiv 2: nyem CTRL + SHIFT + O ib txhij. Ob peb yam tsis siv imports hauv cov chav kawm Java hauv qab no.
  4. Nyem CTRL + SHIFT + O.
  5. Thaum twg nws yuav tsum tau? Thaum pib, peb xav tias ArrayList haum rau peb cov laj thawj los khaws cov pab pawg ntawm cov txiaj ntsig zoo sib xws.

Cov lus nug tseem yog, Kuv yuav ua li cas thiaj li tshem tau cov khoom siv tsis siv hauv IntelliJ shortcuts?

Rau IntelliJ IDEA, yog tias koj nias CTRL + ALT + O Optimize Ntshuam ”, nws tsuas yog tshem tawm qee qhov tsis siv ntshuam , yeej tsis imports tej pob.

Kuv yuav txheeb xyuas cov khoom siv hauv IntelliJ li cas?

Qhib 'Settings' (lossis 'Preferences' hauv mac) qhov rai thiab mus rau Editor> Code Style> Java. Nyem rau ' Ntshuam 'tab. Hauv ' Ntshuam Layout' cheeb tsam, koj ua tau npaj tus kev txiav txim import los ntawm xaiv cov ntshuam ntaus thiab nyem rau ntawm xub (saib duab hauv qab).

Pom zoo: