How to search in files in Visual Studio Code - visual-studio-code

I am coming from Sublime Text 2, where I can open a workspace (a directory with all the source files). There is an option "find in files" (ctrl+shift+f) that searches for an expression in all the files from that directory and subdirectories. Now, in Visual Studio Code, there is such an option with the same shortcut as Sublime, but it only searches in the files that are opened in a tab, not all actual files in the directory currently opened. Is there a way to do this with Visual Studio Code?

"CTRL+SHIFT+F" does only search on open files. What you need to do is open up the explorer "CTRL+SHIFT+E", right click on the folder you're attempting to search under, and select "Find in Folder...".
https://stackoverflow.com/a/43651677/6395820

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.

Directory hidden in visual studio code explorer

I have a problem that has been bugging me for months. I have a software directory structure which when viewed in visual studio code explorer is missing a directory called 'install' all other directories are visible. If I delete the 'install' directory and recreate it with visual studio code explorer (right click and select new folder) it does not appear in the explorer but does appear in the file system.
Somehow visual studio explorer seems to be filtering out any directory call 'install' anywhere in the directory structure or on any other filesystem.
The same thing happens if I try and create an 'install' directory on any filesystem, local filesystem, local git repo, remote folder, etc.
Any suggestions about how this is happening and what to do about it?
make sure you don't have by accident a setting like this in your settings.json file:
"files.exclude": {
"install": true
},
If you use the gui for your settings instead of the json file, search for "Files: Exclude" and you will see the files or folders that are told not to display.

Open folder in Explorer from VS Code

Say I have a project/folder open in VS Code and I want to open the folder in Windows Explorer, is there keyboard shortcut or a VS Code Extension for that? Sometimes I also need to go to the project folder in command prompt.
In Visual Studio 2017, there's a menu option to open the folder and an extension for quickly getting to the project folder in command prompt -- see below:
How do I handle these in VS Code?
Right click on a file or folder from the left side explorer of VSCode, then select "Reveal in Explorer". Now you can see the folder in windows explorer.

Visual Studio Code in Explorer's context menu

I want to be Visual Studio Code my default editor for all text-based file types in Windows. For Notepad++ there is an extension in the Windows Explorer to provide "Edit in Notepad++" for each file.
How can I achieve this for "Edit with Visual Studio Code"?
Do I have to "program" such extension on my own or are there any ready-to-use solutions available?
According to this blog post you can set this option during the installation process. If you want to add this option afterwards you either can follow the instructions of the rest of the post or (as recommended) reinstall vscode and then select that option during reinstalling.
When I faced the same issue, for me it was more comfortable to simply reinstall vscode.
It is east !
step 1 -->
Right click the file you want to always open with VS code
example - if you want to always open .txt files in VS code then Right click on any .txt file that is in you system
see this
step 2 -->
click on 'open with'
see this
step 3 -->
click on 'choose another app'
see this
step 4 -->
a new window will open, it will show all the applications on you system that are capable to open that file
click on VS code
and check the box at the bottom that says 'always use this app to open .txt files'
see this
and then click on open
THATS IT
NOW ON .txt FILES WILL BE OPENED IN VS CODE
.txt file extension is just an example, you can do this to any file example .py, .html, .pdf etc.

VSCODE find content in any folder

Is there a means in VSCODE for 'find in files' to work from a specific folder? It seems it only works in the current folder open in Visual Studio.
I currently have to open Notepad++ and use it's find in files to search for specific content within a given folder.
thanks.