I am writing a code snippet in Visual Studio Code, and I need that the snippet will import libraries if they are not already imported.
A simple example: I want to create a snippet in Java that will create a new Scanner
and close it:
"Scanner": {
"prefix": "scanner",
"body": [
"Scanner scanner = new Scanner(System.in);",
"scanner.close();"]
}
I need that if the code doesn't contain an import for java.util.Scanner
it will be imported (as part of the snippet).
How can I do it?