I have several folders in a workspace, each folder with its launch.json file and its own large configuration. I am trying to run all launch.json files one after another in visual studio code.
Any help?
Related
I have a project that has hundreds of .c .h and .cpp files. I'd like to start using vscode with this project; however, I need to be able to tell vscode what files to actually include in the project (because depending on the build, many files are not included). Is there a way to force a file list into vscode without using the GUI/Add-File mechanism?
The launch.json file should be inside the .vscode folder, but it is not present there.
How can I get this file so that I can modify the configurations?
As described in the Launch Configurations section of the Visual Studio Code documentation:
VS Code keeps debugging configuration information in a launch.json
file located in a .vscode folder in your workspace (project root
folder) or in your user settings or workspace settings.
To create a launch.json file, click the create a launch.json file link
in the Run start view.
As of Visual Studio Code 1.56:
Once that's created, it should now be available under your workspace's .vscode folder.
Click on the debug side bar to open the debugging options. Then either the cog icon at the top, or the create a launch.json file link below the big blue button. If the launch.json file is present, it will open it otherwise it will generate one.
Warning: if you try to create an empty one (or one with an invalid content), trying to get to that file through the "Create a launch.json file" would not do anything.
See issue 133327.
That will be fixed with VSCode 1.61 (Sept. 2021): at least, that existing file will be opened when you click on "Create a launch.json file".
I have created a new custom theme using the Yoeman theme generated and now when I pressed on F5 to open a new Host Extension window of the custom theme it is actually showing me to select environment?
I have managed to open a new Extension development window by the following step which is not the ideal way to do it but helped me to run it.
I have selected the chrome (preview) option which will create a .vscode folder in your workspace and will have one file launch.json.
In your project directory, you will also have a .vscode folder and launch.json file inside it. So, I have copied the content of launch.json and pasted it in the workspace launch.json file.
I don't know the reason how it is get solved with that but happily, I managed to open the new Extension Development Host window.
The reason for not showing up the Extension Development Host window by pressing F5 in the first place is because my VS code workspace is not inside the project directory. The project directory contains the setup for launching the Extension Development Host window in launch.json. So, If I want to suggest then I would say that VS code workspace needs to be inside the project folder directory.
You must open the project root directory not the directory that wraps project root.
In my case, test1 was the root directory.
DO NOT
DO
I am a new programmer that started learning Python, but there's something bothering me which I'd like to change.
As I've seen that it is possible to remove the unwanted path from the terminal when executing code, I cannot figure out how to access the Visual Studio Code launch.json file and all of the explanations on Google are quite confusing.
Note that if Visual Studio Code hasn't created a launch.json file for your project yet, do the following:
Click the Run | Add Configuration menu option, and one will automatically be generated for you, and opened in the editor.
NOTE: You have to have a "Folder" open, for this to work. File | Open Folder...
In Visual Studio Code, use shortcut Ctrl + Shift + P to open the Command Palette and type Open launch.json. And it will open the launch.json file for you. If you also can't open launch.json then try the way below.
Check if the .vscode folder exists in the root folder. If not, then create a new one and create file launch.json in that. Now you have launch.json for your workspace and you can configure your project.
Is there a way to debug multiple files from a single folder? I had expected that I could create multiple launch files in the .settings folder and pick the one I want to execute, but that did not seem to work. It seems to insist on only 'launch.json'.
VSCode supports only one launch.json, but you can have multiple launch configurations inside one launch.json. The example at https://code.visualstudio.com/Docs/debugging has 3 different launch configurations. You can specify any amount, and choose the active one using a drop down in the debug view.
Visual studio code allows to launch multiple configurations at once.
check out the Compound Launch Configurations in Visual Studio Code Website
NOTE: switch the Java Debug console from Integrated Terminal to Integrated Console so that all launch configurations will be displayed & will work correct acoordinglt to your expectations
Although the question is about multiple configurations for a single folder, just want to mention the alternative: multiple folders in a single workspace, each with their own launch.json.
One way is to just copy the .vscode/launch.json file to the other folder and edit it. The desired configuration can be picked up or edited from the drop-down to the right of the "Start Debugging" (Green "play") button.
use Multi-root workspaces
Multi-root workspaces are an advanced capability of VS Code that allows you to configure multiple distinct folders to be part of the workspace. Instead of opening a folder as workspace, you will open a .code-workspace JSON file that lists the folders of the workspace. For example:
{
"folders": [
{
"path": "my-folder-a"
},
{
"path": "my-folder-b"
}
]
}
https://code.visualstudio.com/docs/editor/workspaces#_multiroot-workspaces
so you can use multiple launch.json
Here are steps what I do to have 2 projects(A and B) and I can switch between them when I need to build or run
Create an empty Workspace
Add the Project A by choosing Add Folder to Workspace
Add tasks.json and launch.json to the project. Basically VS Code will help you to do that correctly. If there is something wrong, just delete .vscode folder and do again
Remove the folder of project A out of the Workspace
Do step 2,3 for Project B
Add project A again to the Workspace. Now, we will have 2 project A and B in the Workspace with their own .vscode
When you press Ctrl + Shift + B, VS Code will ask you which one you want to build
To debug or start without debug, you press Ctrl + Shift + D then on the left top selector, you select which project you want to run