Identifying and understanding code editor elements

The editor provides some elements that can facilitate navigation through the code and help identify problems in it. In the following screenshot, you can see how the editor is divided:

Identifying and understanding code editor elements
  1. The editor area, as you probably know, is where you edit your source code.
  2. The gutter area is where different types of information about the code is shown, simply using icons or special marks like breakpoints and ranges. The indicators used here aren't used to just display information; you can perform some actions depending on the indicator, such as reverting changes or navigating through the code.
  3. The smart completion popup, as you've already seen, provides assistance to the developer in accordance with the current context.
  4. The document tabs area is where the tabs of each opened document are available. The type of document is identified by an icon and the color in the name of the file shows its status in version control: blue stands for "modified", green for "new", red for "not in VCS", and black for "not changed". This component has a context menu that provides some other facilities as well.
  5. The marker bar is positioned to the right-hand side of the IDE and its goal is to show the current status of the code. At the top, the square mark can be green for when your code is OK, yellow for warnings that are not critical, and red for compilation errors, respectively. Below the square situated on top of the IDE this element can have other colored marks used to help the developer go directly to the desired part of the code.

Sometimes, while you are coding, you may notice a small icon floating near the cursor; this icon represents that there are some intentions available that could help you:

Identifying and understanding code editor elements indicates that IntelliJ proposes a code modification that isn't totally necessary. It covers warning corrections to code improvement.

Identifying and understanding code editor elements indicates an intention action that can be used but doesn't provide any improvement or code correction.

Identifying and understanding code editor elements indicates there is a quick fix available to correct an eminent code error.

Identifying and understanding code editor elements indicates that the alert for the intention is disabled but the intention is still available.

The following figure shows the working intention:

Identifying and understanding code editor elements

Intention actions can be grouped in four categories listed as follows:

  1. Create from usage is the kind of intention action that proposes the creation of code depending on the context. For example, if you enter a method name that doesn't exist, this intention will recognize it and propose the creation of the method.
  2. Quick fixes is the type of intention that responds to code mistakes, such as wrong type usage or missing resources.
  3. Micro refactoring is the kind of intention that is shown when the code is syntactically correct; however, it could be improved (for readability for example).
  4. Fragment action is the type of intention used when there are string literals of an injected language; this type of injection can be used to permit you to edit the corresponding sentence in another editor.

    Intention actions can be enabled or disabled on-the-fly or in the Intention section in the configuration dialog; by default, all intentions come activated. Adding intentions is possible only after installing plugins for them or creating your own plugin. If you prefer, you can use the Alt + Enter shortcut to invoke the intentions popup.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.135.216.75