How to sort searched files in visual studio code? - visual-studio-code

When we are searching using ctrl + shift + f command in visual studio code for entire project , we are getting multiple files listing in which search values found.
Is there any way so that I can sort those search files because visual studio code not showing sorted search files.
I have gone through official website but not able to find such command.

I have checked to find similiar option to sort files as you are asking in visual studio code but not able to find any but you can see that visual code already sorting those file based on folder like account,base etc...
You can try regex to search to minify your serach criteria like a*.html, bo*.html,
[abc]*.html.
Hope above help you to sort out your problem.

You can (now?) sort results by updating user settings. Settings > Search "sort order". You'll see a few options:
Search: Sort Order - Sorting search results
Explorer: Sort Order - Sorting files in the file explorer

Related

How to get a list of all files matching search criteria in VSCode?

As per the answers in this question, there are two primary ways to search for files in VSCode:
By using CTRL/CMD + P/E to search and "go to file"
By clicking anywhere in the explorer tree and typing
Why do the above solutions not suit my needs?
I need a way to search for files and get a full list of them (in plain view) so I can easily scan them.
The 1st method returns only partial results unless I scroll down.
The 2nd method only searches the folder tree that's currently open.
I know I can use the find command in Linux to achieve this, but can I achieve something similar in the editor itself?

Modifying search or making custom search in Visual Studio Code Extension

I am currently trying to make an extension in visual studio that uses the results from the normal search and shows the results in it's own view that does not display the found results per file, but per user-defined modules.
For example the usual search gives:
4 results found in 3 files
src/extension.ts (2 results)
folder2/file1.ts (1 result)
folder2/file2.ts (1 result)
Then my extension could show:
4 results found in 2 modules
src/ (2 results)
folder2/ (2 results)
For this I looked up the Contribution points and in "contributes.menus" there is the Explorer context menu that contains the group "4_search" - Commands related to searching in the search view.
How can I use this contribution point for my extension? Is it even feasible to use the search results and show the data in a new view like the example above?
Edit:
I realised that I did not understand the contribution points at all when asking and it is not what I need. Do you know how I can execute a command whenever the user searches for something in the search view and get the search results as parameters for the command?
Thanks for your help.

possible to sort vscode Search: Find in Files by date (modified on)?

Suppose I do:
ctrl+shift+p
Search: Find in Files
<provide search term>
Can I sort the results by recent changes?
Note, all included files are also under version control, if that matters.
It isn't very accessible (not on the search side bar / panel) but there is a setting for this:
Features > Search > Sort Order
And an option to set it to modified like this in JSON:
"search.sortOrder": "modified"
That is still shown grouped by file but at last shows the most recently modified result first.

Is possible to change Visual Studio Code default explorer sort, making symbols come after?

The default sorting of Visual Studio Code shows:
rma_request_created_for_administrators.html.twig
rma_request_created.html.twig
Would be possibile to change the explorer sorting so that _ come after the .? Like this:
rma_request_created.html.twig
rma_request_created_for_administrators.html.twig
A sub-ordering of files and folders will be added to v1.57. The setting:
Explorer > Sort Order Lexicographic Options
Options: default, upper, lower and unicode
The unicode option will put the _ after the . version. I tested your example files and they switched to this order with the unicode option:
rma_request_created.html.twig
rma_request_created_for_administrators.html.twig

Reindex a source code in the VSCode

I've started to get errors Unable to open 'header.h': File not found when I try to jump to var/func definition via [Ctrl+Click] after I've deleted/renamed several files.
Is it possible to force reindex source code?
This question is a few years old now, but this is an issue I've seen a lot, and can usually be fixed with one of the following 5 options:
Reload Session
You can reload the current session, with the workbench.action.reloadWindow command:
Open the Command Palette with Ctrl + Shift + P Then type Reload Window
Filter Files being Indexed
For C/C++ projects specificially, sometimes the intellisense indexing can be really slow, and feel like it's not working. One solution for this is to limit what it indexes with something like limitSymbolsToIncludedHeaders, or reduce the amount of parsed files in c_cpp_properties.json
"browse": {
"path": [
"/usr/include/",
"/usr/local/include/",
"${workspaceRoot}/../include",
"${workspaceRoot}/dir2",
"${workspaceRoot}/dir3/src/c++"
...
]
}
Set File Associations
Sometimes the file associations are incorrect, so files are not indexed as expected.
This can be fixed by adding something similar to this into your VS Code settings (settings.json):
"intelephense.files.associations": ["*.php", "*.phtml", "*.inc", "*.module", "*.install", "*.theme", ".engine", ".profile", ".info", ".test"]
Rebuild System Index
For Windows users, VS Code uses the system search index, so rebuilding that may help.
Ensure Intellisense Enabled
Finally, it may seem obvious, but just confirm that Intellisense is actually enabled, with editor.tabCompletion in your settings.json. And if you're searching with results not displaying, ensure there aren't any filters preventing results.