1

I am searching for a way to create a certain file in a certain directory in my vscode project.
Preferred with a VScode command.
For example: A pre-configured default directory that automatically insert the created files with one command.

I found this previous post: VS Code - Add a new file under the selected working directory
But it does not address to create a file in a specific directory.

1
  • @user This command is related to the referred SO post. It creates a new file in the select working directory. Commented May 15, 2023 at 20:15

2 Answers 2

0

with the extension File Templates you can create an empty template with a given file path.

Create a template with the given content:

##@@## ~w/src/mylib/${input:File name:} 

With Ctrl+N you can select the template, enter the filename and the file will be created.

You have to create a separate template for each type of file extension.

Or you can create a template named: placed-file-mylib.txt

And as filename type: mylib.cpp

The file created is: mylib.cpp.txt

In the explorer edit the file name: Ctrl+0 F2

Sign up to request clarification or add additional context in comments.

Comments

0

This VSCode extension works well: https://marketplace.visualstudio.com/items?itemName=patbenatar.advanced-new-file

enter image description here

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.