VS Code - search for two different things in two files - visual-studio-code

In VS Code how do I search for one thing in one file, while at the same time searching for a different thing in a different file?
Using the normal Find when I try to search for something in a second file it overwrites any find I am doing in a previous file.
I see that the Search functionality enables me to open a search in an editor, but this functionality doesn't seem at all useful to me.
There is no obvious way to run a search on a specific file short of manually copy/pasting the file path into the advanced search options.
The editor that the search results open in contains adjacent context lines, which if you have a large number of results makes it useless as a simple list of search hits.
The editor that the search results open in is not editable, making it useless as an editor.
I need a list of results for each of two searches on two files.

Item 1 can be handled with an extension I wrote: Find and Transform. You could make a keybinding that opens the Search Panel with the current filename (or any file/folder/etc.) added to the files to include input. Actually I added a context menu command to the editor, or any editor tab or an editor in the Explorer to do just this.
Item 2. The search editor number of context lines is configurable and will remember your last setting.
Item 3. There is an extension, Search Editor: Apply Changes which can apply any changes you make in a search editor to those files.

Related

is there a way to filter files by name in vs code?

Is there a way to filter files by name in VS Code? The search icon in the left nav pane provides the ability to do a global text search within the directory context but I haven't seen a way offhand to search for specific files. For example, let's say I want to search for "Chart.component.tsx" or find all test files in the project by searching for ".test.tsx". Is there any way to go about doing this in VS Code?
Type ctrl-P then start typing the file name. VSCode will search the directories for you.

Fast way to find Javascript source file in debugger?

RStudio uses Chrome Devtools for debugging support in its Viewer pane. (It is labelled as "RStudio Devtools", but I'm not sure to what extent it is customized besides that). You can open its window using Right-click "Inspect Element".
When developing a display that uses Javascript, the source pane in Devtools is very useful for setting breakpoints, single stepping, etc.
One thing that is fairly inconvenient is finding the line where I want to set a breakpoint. Once I have the source file open searching it is easy, but getting to the right source file is hard. Typically after I go to the source pane, I see something like this:
I know the name of the file I want to debug, but it's buried several levels below index.html in the list of files on the left. Is there a way to quickly search this hierarchy of files for a filename, so that I don't need to open all the levels down to the file I want? For example, I might want to debug htmlwidgets.js:
You'll note in the "sources" pane that, if you have no open files, you'll see a message in the middle that indicates you can type Command + P (or Ctrl + P on Windows/Linux) to open a file. When clicked, this will open a text box that will fuzzy search across the names of all source files. Type the filename there and it should be in the first results. You can navigate to it with the keyboard and select it with <Enter>/<return>, or simply clicked with the mouse.

VS Code: Open Files as Last Tab instead of Next to Current

In VS Code, when I open another file, or create a new one (ctrl+n), said file open next to the currently selected tab. I would like this to behave the way browsers do. Well, at least the way firefox/chrome do for me.
I find I am dragging tabs around a lot because my file look ups end up inserted between my order of other files. I want it to instead always open the files as the last tab, the same way all my browsers do.
Ideally I would still like definitions to open in the next tab instead of the last, i.e., again, the way browsers do it.
I can't seem to find any settings for this, and I didn't find useful search results, just a bunch of stuff around not having the quick view tabs that get updated.

Zoom/focus on a region/part of file in vscode?

Let's say I have a giant markdown file and want to edit one section, or a giant python file and want to edit one function. Is there any way to bring out that region of the file into a separate editor?
Desiderata:
Find (⌘F) and "add selection to next find match" (⌘D) should only go over focused contents.
Changes should appear in original file in the filesystem for version control purposes.
No text outside of focused section is visible anywhere.
Bad solutions:
'Fold all & unfold one' works ok in markdown, but e.g. if there is section text at a parent section, then there is no way to hide it. And ⌘F goes outside of it.
A temp file clutters the git logs if I commit as I go.
Extension keywords (no results):
File window
File region
Zoom to part of file
(Iterm2 has a feature like this for focusing on the last command output.)
It seems there is no good solution as of May 2021.

Multiple editor windows with multiple tabs

Very often I work with multiple projects in MATLAB and have a group of files for each project that I access at one time. Having all files of all projects open causes a lot of clutter in the workspace. One can do this for one single set of files by docking which is well known.
Is there a way to tab projects, or have multiple MATLAB editors (for each project) open with multiple tabs in each (with the projects files). The question can be found here too. In the same vein, are there other code editors which can be used to perform the same?
Project1
file 1.m
file 2.m
file 3.m
file 4.m
Project2
file 1.m
file 2.m
file 3.m
file 4.m
Either in the same window, or in different windows.
Unfortunately I don't believe MATLAB can do that kind of project/file management for you, which is why I use Sublime Text 2. It's perfect for that kind of project/file management... and not to mention the awesome shortcuts and quick editing tools to help you code faster.
Check them out: http://www.sublimetext.com/. The one drawback is that it's nagware. It is free to use, provided you can bare the popups to buy a copy of the software every now and then. Once you buy it, the popups go away. Give it a try and see how it goes!
If someone still need a solution for that-
You can just drag a tab of one file to the side, or bottom of the space of the editor, like that:
And the result will be:
Now you can drag in the same way other tabs to the new tabs group, and you have two separate tabs groups (but one Editor window..). You can of course drag the middle edge line to the right-end, and work fully only with the first group, or drag it to the left-end and work fully with the second one.
Note for one drawback here- if the line is in one of the ends, you don't see the tabs status and files names of the hidden group, and if you forget that you opened some file there and try to open it again, you will not see it opened, or any change in the IDE, because the control goes to the already opened tab but you not see it.