Quickly creating certain files in VS Code - visual-studio-code

Is there an easy and quick way to create certain files in VS Code as in full blown Visual Studio? For example, I can create a config file or an app settings json file in Visual Studio that will not only create the file but insert the basic structure into the file.
Is this possible in VS Code?

This can't be done in bare Visual Studio Code. But there's a couple of extensions around which do what you are looking for.
Here's a non-exhaustive list of extensions:
File Templates for VSCode
File Templates
...

Related

Visual Studio Code Install Multi-User Image / School Environment [duplicate]

I've put Visual Studio Code on OneDrive, for the purpose of syncing it with its settings across my devices.
However, extensions are stored in %USERPROFILE%\.vscode\extensions on Windows.
Is it possible to change this folder's location so I can put it in the main Visual Studio Code folder?
At first I thought that copying the extensions in the resources\app\extensions of Visual Studio Code folder will be a nice workaround, but that doesn't work.
I've also searched for a solution on the documentation page and in the user settings, with no results.
What I did - after installing Visual Studio Code for the first time, I checked the documentation and added at the end of 'Target' field of editor's shortcut the following (there's a space before the two dashes):
--extensions-dir="DRIVELETTER:\VSCODE\extensions"
--user-data-dir="DRIVELETTER:\VSCODE\settings"
where DRIVERLETTER and VSCODE are the corresponding drive and directory where Visual Studio Code is installed. So mine looks like this:
"D:\Microsoft VS Code\Code.exe" --extensions-dir="D:\Microsoft VS Code\extensions"
Here is for the user data directory:
"D:\Microsoft VS Code\Code.exe" --user-data-dir="D:\Microsoft VS Code\settings"
Accessing the 'Target' field is done by right-clicking the shortcut and choosing 'Properties'
Anyway, there's a simpler solution to that problem - just use the portable version of Visual Studio Code. It works under Windows, Linux, and macOS:
Enable Portable Mode
Windows and Linux
After unzipping the Visual Studio Code download, simply create a data folder within Visual Studio Code's folder:
|- VSCode-win32-x64-1.25.0-insider
| |- Code.exe (or code executable)
| |- data
| |- ...
From then on, that folder will be used to contain all Visual Studio Code data, including session state, preferences, extensions, etc.
The data folder can be moved to other Visual Studio Code installations. This is useful for updating your portable Visual Studio Code version: simply move the data folder to a newer extracted version of Visual Studio Code.
macOS
On macOS, you need to place the data folder as a sibling of the application itself. Since the folder will be alongside the application, you need to name it specifically so that Code can find it. The default folder name is code-portable-data:
|- Visual Studio Code.app
|- code-portable-data
Portable mode won't work if your application is in quarantine, which happens by default if you just downloaded Visual Studio Code. Make sure you remove the quarantine attribute, if portable mode doesn't seem to work:
xattr -dr com.apple.quarantine Visual\ Studio\ Code.app
Note: On Insiders, the folder should be named code-insiders-portable-data.
UPDATE 14.12.2021
From Visual Studio Docs
Note: Do not attempt to configure portable mode on an installation from the Windows User or System installers. Portable mode is only supported on the Windows ZIP (.zip) archive. Note as well that the Windows ZIP archive does not support auto update.
A little hack:
Create a symbolic link to the folder %USERPROFILE%\.vscode\extensions under the Visual Studio Code install path.
https://code.visualstudio.com/docs/editor/extension-gallery
code --extensions-dir 'new_directory_to_set'
Set the root path for extensions.
Follow the below steps for changing the extension path in VS.
Set "code" path in environment variable.
path = VS_CODE_INSTALL_DIRECTORY/bin;
Open VS , in VS terminal execute the below command.
code --extensions-dir "new_directory_path"
Install the required extension.
All Done.
Note:Dont forget to vote the answer
According to this page, after installing VS Code we should make a language profilers folder like this:
mkdir code_profiles
cd code_profiles
mkdir code-ruby
cd code-ruby
mkdir exts
mkdir data
For Windows, I prepared a batch file (.bat) for each language I work on, it contains this line:
Start "" "D:\programs\VSCode\code.exe" --extensions-dir D:\programs\VSCode\code_profiles\code-python\exts --user-data-dir D:\programs\VSCode\code_profiles\code-python\data .
This is for Python. If I work on PHP, I will make code-php folder, then make exts and data folders in it and prepare another batch file for PHP, just like the one I made for python.
I put this batch file on the main project folder then double click on it to run VS Code with the preferred profile.

Visual Studio Code icons like `tree` in terminal?

Does anyone know of any VS Code extension for visualizing the folder and files structure with a similar format to the terminal tree command? See the image as an example:

Unreal Engine 4 problems with intelliSence

I am new to unreal Engine 4, and I am trying to create c++ class. It creates files sucsessfully, but InteliSence does not work, even if I type in, there is not int suggestion. All i found was this question, but I do not have similar patch in my Engine folder.
I use the lastest eigne version.
Assuming you are using Visual Studio and not Visual Studio Code:
When I create a new class from within the Unreal Editor, IntelliSense won't properly read the code and will generate errors such as not finding include files.
Either reopening Visual Studio, or a refresh from within the Unreal Editor ( Files > Refresh Visual Studio Project ) usually does the trick.
If that will not help, there's an error within Unreal 4.25 that will make the boilerplate code generate the wrong directory at #include "folder/myclass.h". IntelliSense might not read any further than that.
Typing the correct directory and refreshing with the methods mentioned above fixes that for me.

VsCode - Update .njsproj

While working for a js project on vs code and vs 2019 synchronously. Is there any way to update .njsproj automaticly file when adding a new folder and file on vs code? Thus, those files can be include solution explorer for vs 2019 without manuel selecting files.
Update:
I created an extension to sync .njsproj file on vs code automatically.
Vs Code .njsproj Extension
VS Code does not have built-in support for synchronizing Visual Studio project files.
You could try:
An extension could provided this feature. This one claims it can, but I have not tested it
Write a simple script that updates your njsproj based on current folder contents.
If you are only using the project to open a set of files in VS, switch to use open folder as workspace instead.

Visual Studio Code language extension not highlighting syntax

Followed this piece of instruction to create a language extension for .abcd files.
During yeoman generator I used this as a reference.
Everything went well and the new extension was created. Then I open the generated folder as a Visual Studio project and hit F5 to run VS Code with my newly created extension, but nothing gets highlighted as if there is no support for that language.
I have not done any changes to the generated files, but since I am using Ada.plist as a starting point, shouldn't it at least highlight .abcd file as Ada file?
You need package.json file to register the language. It's described in the same document.
You may be interested in this repo also:
https://github.com/Entomy/Ada-vscode