how to use code from github with visual studio? - github

I need the following code https://github.com/reo7sp/tgbot-cpp
I downloaded the zip file, now I want to include tgbot.h.
I tried to paste the tgbot folder (/include/tgbot) in the project folder but to no use.
Any solutions?

This problem is not related to GitHub. You can open the project folder with Visual Studio. I think no need to paste tgbot folder.
check the solution explorer
If you want to open separetly include/tbbot folder then just right click on the folder and select open with visual studio.

Related

How can we add existing file to VS code solution, I am not getting 'Add existing item' option

Can we add existing file or folder to VS code solution from explorer itself ?
One way is to add from file explorer but can this be done from VS code explorer itself like other Visual studio IDE solution explorer ?
We can't add it like Visual Studio IDE as how you will always have a link to it.
However, you can "Open" a file temporarily via Cntrl+O or can open a new Window with that other folder opened.
On Linux, the existing file can be inserted by copying to system's clipboard then paste from VSC.
To copy to system's clipboard:
xclip <filename>
Then paste to VSC as usual using Ctrl-V.

Visual Studio Code has imported all folders associated with primary user of laptop,

I recently made VScode my primary IDE and it has since imported ALL of the folders associated with the primary user of my laptop. So folders associated with Dropbox, Applications, Creative Cloud, etc..etc.. are now showing up in the Explorer, under my name.
How do I remove these folders so that I can choose which folders I would like to open for my coding projects?
I can't find answers to this anywhere.
I've included a screenshot so that you can see what I am talking about.
Thank you in advance for any help you can offer.
enter image description here
vs code can be opened from a directory. it show all directory and file in pwd.
to open vs code in a directory you can execute code <path/to/where/you/want> in your terminal
As I understood, you are concerned that VSCode is showing all the folders you have when you open it up.
Let me clarify things for you:
Vscode is not an IDE, it's an advanced text editor.
Vscode does not import any files anywhere. It just works as a file browser;
it lists the files and folders of the folder that was opened in.
In your case, I think when you open up VScode, it's showing you the content of the /home directory (you are using linux or mac). If you want to open a specific folder, go to "Files" and then "Open Folder" and select the folder you want to open.

How to import zip file into visual studio code

I have a whole flutter project and want to import in visual studio code, but the file is in zip file.How to import whole zip file into visual studio code.
Unzip your file in a new folder (let's say my_awesome_project)
Open VS Code and choose "Open Folder"
It's done
Make sure you have the Flutter extension installed in VS Code to enjoy your coding time.
Create a new folder on your Desktop.
Right-click on the zip file and click on the option "Extract file with a specified folder.
Select the Folder that you just made.
Open that folder with VS-Code.
Done. Enjoy Your Day:)
You will have to unzip your files and then open that folder in vs code.

How can I cleanly remove Workspaces in Visual Studio Code?

I'm on a MAC and remove workspaces with the terminal in the folder ~/Library/Application Support/Code/User/workspaceStorage, but i don't think it's the clean way.
Can someone explain me how I can remove cleanly a workspace and all its files from my mac?
I miss this feature. I can add many workspaces, but where is the "delete button"?
I use Visual Studio Code V.1.28.2 on macOS Mojave 10.14.
You can use the command palette:
Menu: View > Command Palette... (or F1)
Search: "Workspaces: Remove Folder from Workspace..." and select the folder you want to remove.
Hope this may help you
Visual Studio Code 1.32.3. Windows 10.
Here's the answer from the Twitter account of Visual studio code:
You have just to go to the Explorer section and remove any folder or file in it see the image below:
right click in the workspace you'd like to remove and select the "Remove Folder from Workspace" item; the name of the workspace will become: "NO FOLDER OPENED" that is the one you'll get when you installed the very first time Visual Studio Code.
If none of the above solutions works ...you can go to file -> close folder.
It will close the workspace folder and you can add any new folder to the explorer, like the first time you install visual code
find workspace.json, it will be inside the workspace you had created workspaces->[unique number]->workspace.json . you can edit the workspace directories in it.
The only other relevant answer is this .
The Workspaces is stored at %userprofile%\AppData\Roaming\Code\User\workspaceStorage (Windows) , none of the mentioned actions will delete them .
There also can be a .code-workspace Workspace File or "Workspace Config", which can be moved anywhere . And .vscode Workspace Folder/-s in the folder/-s which was added to the workspace .
Deleting all existing of these 3, and the relevant items from : %userprofile%\AppData\Roaming\Code\storage.json and all %userprofile%\AppData\Roaming\logs<< .. >> . Will be a workspace deletion .
It seems that workspaces are either open or closed, you can close them from the main menu. To cleanly delete a workspace, just remove the workspace file from disk also.

Open multiple Projects/Folders in Visual Studio Code

How do I open multiple projects/folders in a single Visual Studio Code instance, and open multiple files in single view? Does it has any option for future change request?
Not sure why the simplest solution is not mentioned. You can simply do File>New Window and open the other project in the new window.
Update
This is now available out of the box as of October 2017. From the blog post:
This was our #1 feature request - it's been a while coming but it's here now.
The complete documentation is here.
You can work with multiple project folders in Visual Studio Code with multi-root workspaces. This can be very helpful when you are working on several related projects at one time. For example, you might have a repository with a product's documentation which you like to keep current when you update the product source code.
Original answer
Currently the Insider channel of VSCode gives us this out of the box.
Read more from the blog post.
Update
As mentioned in several other answers here, this 'accepted' answer is outdated and is no longer correct. VS Code now has the concept of a 'workspace' which lets you add several 'root' folders to VS Code in the same window.
For instance, when working on a project in one folder that utilizes shared code held in a different folder, you can now open both the project folder and the shared folder in the same window.
To do this you use the Add folder to Workspace... command. VS Code then saves this configuration in a new file with a .code-workspace extension. If you double-click that file, VS Code will re-open with both folders present.
Original Accepted Answer (Outdated)
As described in The Basics of Visual Studio Code article:
"VSCode is file and folder based - you can get started immediately by opening a file or folder in VSCode."
This means the concept of solution and project files, like the .sln and .csproj, have no real function in VSCode other than that it uses these only to target and identify which language to support for Intellisense and such.
Simply put, the folder you open is the root you work with. But of course there is nothing from stopping you to open multiple windows.
As for the request features options, navigate to Help > Request Features which will redirect you to the UserVoice page of VSCode.
Support for multi-root workspaces is now enabled by default in the latest stable release [November 2017 release].
The File > Add Folder to Workspace command brings up an Open Folder dialog to select the new folder.
If you are using unix like OS, you can create a soft link to your target folder.
E.g. I want to see golang source while I am using VSCode. So, I create a soft link to go/src under my project folder.
ln -s /usr/local/go/src gosrc
Hope this helps!
Update: 11/28, 2017
Multi Root Workspaces[0] landed in the stable build, finally.
https://code.visualstudio.com/updates/v1_18#_support-for-multi-root-workspaces
[0] https://github.com/Microsoft/vscode/issues/396
You can open any folder, so if your projects are in the same tree, just open the folder beneath them.
Otherwise you can open 2 instances of Code as another option
On Windows it's possible to use mklink to create directory symbolic links to the needed folders. Then keep them together in a folder, and VSCode will list the content of these.
c:\>mklink /D c:\dev\MyWork\scripts c:\ProjA\scripts
symbolic link created for c:\dev\MyWork\scripts <<===>> c:\ProjA\scripts
c:\>mklink /D c:\dev\MyWork\styles c:\ProjB\styles
symbolic link created for c:\dev\MyWork\styles <<===>> c:\dev\ProjB\styles
This is very similar to #NeilShen's idea, I guess.
Multiple Folders in VS
Click ->File ->Add Folder to Workplace.
Step 1.
Choose which project to work ->Add(press)
Step 2.
October 2017 (version 1.18):
Support for multi-root workspaces is now enabled by default in the Stable release: https://code.visualstudio.com/updates/v1_18#_support-for-multi-root-workspaces
Now we can open multiple folders in one instance, Visual studio code has named as Workspace ("Area de Trabajo"). Take a look at the images, it´s very simple.
Or you can just select multiple folders and then click open.
Go to File> Open Folder, then select multiple folders you want to open and click Select Folder
Just put your projects in the same folder and simply open that folder in vscode.
Now your projects will appear like:
GROUP OF PROJECTS
PROJECT 1
Contents
Contents
PROJECT 2
Contents
Contents
It's not possible to open a new instance of Visual Studio Code normally, neither it works if you open the new one as Administrator.
Solution: simply right click on VS Code .exe file, and click "New Window"
you can open as many new windows as you want. :)
You can install the Open Folder Context Menus for VS Code extension from Chris Dias
https://marketplace.visualstudio.com/items?itemName=chrisdias.vscode-opennewinstance
Restart Visual Studio Code
Right click a folder and select "Open New Workbench Here"
Open New Workbench Here
You can open up to 3 files in the same view by pressing [CTRL] + [^]
What I suggest for now is to create symlinks in a folder, since VSCode isn't supporting that feature.
First, make a folder called whatever you'd like it to be.
$ mkdir random_project_folder
$ cd random_project_folder
$ ln -s /path/to/folder1/you/want/to/open folder1
$ ln -s /path/to/folder2/you/want/to/open folder2
$ ln -s /path/to/folder3/you/want/to/open folder3
$ code .
And you'll see your folders in the same VSCode window.
you can create a workspace and put folders in that :
File > save workspace as
and drag and drop your folders in saved workspace
You can use this extension known as Project Manager
In this the projects are saved in a file projects.json, just save the project and by pressing Shift + Alt + P you can see the list of all your saved projects, from there you can easily switch your projects.
To run one project at a time in same solution
Open Solution explorer window -> Open Solution for Project -> Right click on it -> Select Properties from drop down list (Alt+Enter)-> Common Properties -> select Startup Project you will see "current selection,single selection and multiple selection from that select "Current Selection" this will help you to run one project at a time in same solution workspace having different coding.
You can simply add folders (as many you want) in your workspace as shown in this image:
Image
And use them unhesitatingly.