

You can create syntactically correct code constructs by using statement completion. The Type-Matching completion suggests you a pointer to struct initializer in auto-completion and also compatible types in assertions and type switch cases. The following animation shows the difference between basic and type-matching completion. Alternatively, select Code | Code Completion | Type-Matching from the main menu. To invoke type-matching completion, start typing your code and press Ctrl+Shift+Space. Smart type-matching code completion filters the suggestions list and shows only the types applicable to the current context. Type-matching completion Invoke type-matching completion

When you type t., hold Ctrl and press Space twice, you see a list of functions that accept the string type as the first argument. To view and complete functions that are suitable for a value of the certain type, hold Ctrl and press Space twice.įor example, you have the t variable of the string type. Alternatively, you can press Ctrl+Space or select Code | Code Completion | Basic from the main menu.Ĭode completion for functions Invoke completion for functions Invoke basic completionīy default, GoLand displays the code completion popup automatically as you type. If basic code completion is applied to a part of a field, parameter, or variable declaration, GoLand suggests a list of possible names depending on the item type.

However, GoLand does not recognize the structure of such files, and suggests options regardless of whether they are appropriate in the current context.īasic completion is also available for a non-English keyboard layout. When you invoke code completion, GoLand analyses the context and suggests the choices that are reachable from the current caret position (suggestions also include Live templates).Ĭode completion is available for custom file types. Basic completionīasic code completion helps you complete names of types, interfaces, methods, and keywords within the visibility scope. This section covers various techniques of context-aware code completion that allow you to speed up your coding process.
