VSCode find multiple files by name [duplicate] - visual-studio-code

This question already has answers here:
How to filter files shown in Visual Studio Code?
(5 answers)
Closed 7 months ago.
I want to see a filtered list of all the files in my project that have a specific extension.
As Im using a Scala language the files have the extension ".scala", so i would like to see a filtered list of all the files with a ".scala" extension.
The following post shows some techniques but nothing showing how to achieve what I require.
How do I search for files in Visual Studio Code?

Based on #Mark response I enhanced my knowledge a bit further.
Here is the link to the Visual Studio Code website that explains it in more detail
https://code.visualstudio.com/docs/getstarted/userinterface#_filtering-the-document-tree
Summary
Click on the "Explorer" icon in Visual Studio Code.
Click on the "Explorer" panel background and type what you want to filter.
In my case i typed ".scala" and all other that did not have the scala extension were removed from view.
To remove the filter, simply click the cross next to the red text that represents what you typed as a filter.
The cross appears when you hover your mouse over the text.

As VonC mentioned in the comment, see also his answer at How to filter files shown in Visual Studio Code? in vscode v1.70 you should be able to filter the Explorer to show only files with a particular extension by typing .json for example into the new Find Widget for lists (the Explorer files is a list).
Demo:
Note that there is a json.txt file that is not shown if you begin the filter with the ..

Related

How to LIST all occurrences of a string in VSCode?

Some text editors and IDEs have this feature that LISTS all the occurrences of a string and displays them as a list.
I have Googled this feature for VSCode, but what I got was mostly 'how to SELECT all occurrences'.
What I want is something like this (Notepad++):
One way to get this is to use the bundled ripgrep that comes with VS Code. You can find it under this path inside the folder your VS Code is installed to:
/resources/app/node_modules.asar.unpacked/#vscode/ripgrep/bin/rg
Just open a terminal pane in VS Code with a console of your choice and invoke that ripgrep executable with whatever query is appropriate for the search you want to perform.
You can read more about ripgrep and how to use it on its GitHub page: https://github.com/BurntSushi/ripgrep.

In Visual Studio Code how do you 'Configure default editor for...' so it's available for 'Select editor for...'?

I have the same question as reddit post "Adding a 'default editor'?" The question surfaces in multiple contexts where Visual Studio Code (VS Code) prompts Select editor for... Perhaps the easiest illustration is when, in the VS Code Explorer, you right click a file and choose Open With... VS Code responds with a dialog that prompts Select editor for... and below that text is a list of editors to choose from. Question is, how do you add editors to that list?
Searching for answers is difficult because the associated terms result in many 'hits' that have nothing to do with this specific question.

How to keep open file input in Visual Studio Code when I change of window?

I would like to know if it is possible to keep this search engine (Ctrl-P) open if I change the window, in Visual Studio Code.
It is a not very relevant functionality but it would help me when I forget part of the name of the file I want to search for or I have to change the window to solve another situation, however, when returning to Visual Studio Code the file browser closed itself and I must return to write part of the file path from the start.
Is there a configuration or extension with this functionality?
Thank you very much!
No, you cannot keep that open when you change windows. Since the search engine provides compilers or lints for various languages that you are editing in the ide space. So when you open a new window by default VS code provides a different configuration for the script, so the search engine cannot be kept open.
A detailed description can be found here https://code.visualstudio.com/docs/getstarted/settings

How do you get the python colour scheme while using sage on VS code?

Currently, I name my files as .py while working on them, and then change them to .sage when I need to execute. Is there a way to get the python colour scheme for sage files on VS code?
There is an extension called SAGE enterprise management that claims to do it, but the instructions are a bit unclear:
It says:
Create a x3-code named folder inside your ~/.vscode/extensions/;
Copy all files in yours recent created folder;
Reload VS Code and enjoy;
I tried both copying my sage files into the folder, and the contents of the x3-extension into the folder, both of which didn't work.
The instructions referred to in the question are for Sage the
accounting software, not for SageMath the Sage mathematics
software system.
In the case of SageMath, we need to tell VS Code to apply Python
formatting not only to files ending in .py, but also to files
ending in .sage. One way to do that is to use the "file to
language association" setting:
https://code.visualstudio.com/updates/vMarch#_file-to-language-association
One would add associations from "*.sage" to "python".
This related question has answers explaining where Visual
Studio Code's language extension files are located on macOS
and Windows:
Stack Overflow question 42498117
Following the first link provided in the prior answer, I got it worked. In details,
go to Settings, type "files.associations" in the search box for Search settings.
It shows you a list of (item, value) in which you can add a new item (*.sage, python). See my screenshot below
Hope it works for you!

Visual Studio Code extension for saving and reusing my own custom code snippets / boilerplate?

I am looking for VSC extensions that will let me save my own code snippets and reuse them in any future projects with shortcuts like when I type html I am able to pick an option that generates whole document example that I can then continue modifying.
Ideally it should also have an option to export all custom settings so I can move them to another machine or back them up if I need to format the system.
I realized this was one of my major efficiency issues when I kept copying code from old projects to be reused in my latest work. I did check the extension search in VSC but so far only found such that already include existing snippet shortcuts.
I found 1 viable method so far with native VSC but post if you know of an even better way.
Press Ctrl + P and > then type Preferences: Configure user snippets and then selecting a language. To generate json fast I used: https://snippet-generator.app/
It saves snippets in AppData\Roaming\Code\User\snippets folder so that is good for backuping or exporting.
To reorder snippets to have custom ones at the top of the suggestions box for faster use go to: Workspace Settings > Text Editor > Suggestions > Snippet Suggestions and set it to top.