I'm trying to create a command that simply prints out a boilerplate for python, so i'm doing this:
"command": "multiCommand.pythonBoilerPlate",
"sequence": [
{
"command": "type",
"args": {
"text": "#!/usr/bin/env python3\n\"\"\"\nModule Docstring\n\"\"\"\n\n__author__ = \"Your Name\"\n__version__ = \"0.1.0\"\n__license__ = \"MIT\"\n\ndef main():\n\"\"\" Main entry point of the app \"\"\"\n\tprint(\"hello world\")\n\nif __name__ == \"__main__\":\n\t\"\"\" This is executed when run from the command line \"\"\"\n\tmain()"
}
}
]
and it's printing it, but i think vscode's auto-indent is messing it up, because it's printing the following:
#!/usr/bin/env python3
"""
Module Docstring
"""
__author__ = "Your Name"
__version__ = "0.1.0"
__license__ = "MIT"
def main():
""" Main entry point of the app """
print("hello world")
if __name__ == "__main__":
""" This is executed when run from the command line """
main()
After printing out the "print" statement, it's auto-indenting the rest... is there a solution for this? I already tried backspacing it with \b but that doesn't help.
It sounds like you have some sort of auto formatter running perhaps? If you have a solid Python formatter maye just run it directly after the text is injected and let it handle getting those tabs in place correctly.
Hello,
I'm trying to create a command that simply prints out a boilerplate for python, so i'm doing this:
and it's printing it, but i think vscode's auto-indent is messing it up, because it's printing the following:
After printing out the "print" statement, it's auto-indenting the rest... is there a solution for this? I already tried backspacing it with
\b
but that doesn't help.Thanks!