Keyboard Shortcuts You Cannot Miss. IntelliJ IDEA, as a keyboard-centric IDE, suggests keyboard shortcuts for most of its actions. In this topic, you can find a short list of the most indispensable of them, to make your first steps with IntelliJ IDEA easy. ![]() Basic completion Basic code completion helps you complete the names of classes, methods, fields, and keywords within the visibility scope. When you invoke code completion, IntelliJ IDEA analyses the context and suggests the choices that are reachable from the current caret position (suggestions also include ). Code completion is available for. However, IntelliJ IDEA does not recognize the structure of such files, and suggests options regardless of whether they are appropriate in the current context. If basic code completion is applied to a part of a field, parameter, or variable declaration, IntelliJ IDEA suggests a list of possible names depending on the item type. Invoking basic code completion for the second time shows inaccessible classes and members (these can be made public by ). When invoked for the third time in a row, IntelliJ IDEA will look for suggestions for classes and interface names in the entire project, regardless of dependencies. ![]() If the necessary class is not yet, it will be imported automatically. Invoke basic completion • Start typing a name. • Press Ctrl+Space or choose Code| Completion| Basic from the main menu. • If necessary, press Ctrl+Space for the second time (or press Ctrl+Alt+Space). This shows inaccessible classes and members as well as static fields and methods. • When invoked for the third time, basic code completion expands the suggestion list to all classes throughout the project, regardless of the dependencies. Basic completion is also available for a non-English keyboard layout. Completion in the Stream API chains is aware of type casts, so the list will not only contain items based on the existing call filter(String.class::isInstance), but also automatically typecasted suggestions. Smart completion Smart code completion filters the suggestions list and shows only the types applicable to the current context. Smart completion is useful in situations when it is possible to determine the appropriate type: • In the right part of assignment statements • In variable initializers • In return statements • In the list of arguments of a method call • After the new keyword in an object declaration • In chained expressions • Start typing. • Press Ctrl+Shift+Space or choose Code| Completion| SmartType from the main menu. The most suitable suggestion for the current context is highlighted. For chained expressions, suggestions are sorted by how frequently they are used in the project. When any of the suggested method calls takes an argument that is not yet available in the context, after you select it the IDE defines a local variable of the required type. • If necessary, press Ctrl+Shift+Space once again. This lets you complete: • Collections, lists and arrays. IntelliJ IDEA scans for static methods and fields, and suggests the ones suitable in the current context. Completion for chained expressions is only available for Java and requires the project to be built with the IntelliJ IDEA compiler (not the Gradle compiler). Hippie completion Hippie completion is a completion engine that analyses your text in the visible scope and generates suggestions from the current context. It helps you complete any word from any of the currently opened files. Expand a string at caret to an existing word • Type the initial string and do one of the following: • Press Alt+/ or choose Code| Completion| Cyclic Expand Word to search for matching words before the caret. • Press Shift+Alt+/ or choose Code| Completion| Cyclic Expand Word (Backward) to search for matching words after the caret and in other open files. The first suggested value appears, and the prototype is highlighted in the source code.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |