-
Notifications
You must be signed in to change notification settings - Fork 64
Code Generation
Note: the features on this page all require Haxe 4.0.0-preview.4 or newer.
Whenever you select an unimported type from completion, an import is added to the top of the file automatically:
If you'd prefer the fully qualified path to be inserted instead, you can disable auto-imports like this:
"haxe.codeGeneration": {
"imports": {
"enableAutoImports": false
}
}
Expected type completion can be used in places where a certain type is expected. Use the regular completion shortcut (Ctrl+Space) to trigger it.
For generating object literals, there are two choices: generate an object literal with all fields, or just the ones that are required / non-optional.
Expected type completion can also be used in places where a function type is expected:
After typing the override
keyword, you are offered a list of functions you can currently override. Selecting one of them will generate the code for it, complete with imports.
When selecting an enum constructor from completion inside a pattern (after a case
in a switch
), capture variables for the arguments are auto-inserted:
There's a number of ways to customize how generated functions should look like. The following are the default settings, which apply to both Expected Type Completion and Override Completion.
"haxe.codeGeneration": {
"functions": {
"anonymous": {
"argumentTypeHints": false,
"explicitNull": false,
"returnTypeHint": "non-void",
"useArrowSyntax": true
},
"field": {
"argumentTypeHints": true,
"explicitNull": false,
"explicitPrivate": false,
"explicitPublic": false,
"placeOpenBraceOnNewLine": false,
"returnTypeHint": "always"
}
}
}
Setup
Features
- Tasks
- Debugging
- Commands
- Dependency Explorer
- Auto Indentation
- Completion
- Postfix Completion
- Snippets
- Code Generation
- Signature Help
- Hover Hints
- Go to Definition
- Go to Type Definition
- Go to Implementations
- Peek Definition
- Find All References
- Rename Symbol
- Document Symbols
- Workspace Symbols
- Outline
- Folding
- Diagnostics
- Code Actions
- Code Lens
- Formatting
- Extension API
- Inlay Hints
- Refactoring
- Inline Values
Noteworthy Releases