VSCode: find and replace, but open edited files without saving them - visual-studio-code

When I perform a find and replace across all files, edits are made, the files are saved, but they are not opened.
Can I configure vscode to open those files that it edited, and not save them until I press ctrl+shift+s? I seem to remember it working that way once.

Related

Is it possible to paste files copied to the clipboard from other applications in VS Code?

Within the explorer panel of VS Code itself, if I want to copy a file to another directory in the workspace, I can use ctrl+c and ctrl+v, but if I find a file from another application on my computer such as the native File Explorer application, first pressing the shortcut key ctrl+c and then going to the VS Code window and pressing the shortcut key ctrl+v in the Explorer panel, there is no effect.
Note that I'm not talking about copying the contents of the file and pasting into VS Code. I'm talking about copying "the file" as in the notion of the file to the desktop environment.
The workaround is the use the native file explorer, copy the file first, then open the folder opened in VS Code, and finally paste it within the native file explorer. But I find this so troublesome.
Is there an easier way to do this? Does VS Code support such functionality to paste files copied to the clipboard from a different application (not VS Code) and paste into VS Code? Is that functionality hidden behind a setting that I need to change? Or is this possible via an extension?
Vscode does dragging the filename from a native file explorer (at least on Windows) and dropping in vscode's Explorer where you want it.
You can also use your OS's Open With... functionality and then drag the tab of that editor into whichever directory you want.
You can choose Add File from File to add a file to your workspace. Or you can use New File from File to create a new file in your workspace and copy the content of the file outside to it.
At the time of this writing, this is not supported... yet!
Work to implement this is tracked under this GitHub issue: Explorer: allow to paste files from the clipboard into target folder #130036, which is a subtask of a larger issue tracking a larger effort for Better drag and drop / clipboard integration of files across applications #164.
You can give a thumbs up reaction on those issue pages to increase their prioritization (but please don't leave "me too" comments there, as such comments are considered annoying noise).
pingren (a contributor to the VS Code repository) tried to implement this and found it to be more complicated than it looks. You can read their explanation of why in their comment there. One of the difficulties stems from itegration with system keybindings and VS Code's affordance for remapping keys:
the onPaste event could only be triggered by system paste (cmd+V on macOS). Users could change filesExplorer.paste command to any keybindings. So we need to consider how to merge native paste from clipboard and VSCode explorer paste.
There's another feature-request issue (Copy paste files from native explorer to vscode #89862, created before #130036) where isidorn (another VS Code contributor) commented:
This is a fair feature request however I believe there is a Chrome limtation which is preventing us from achieving this. [...]
As for extensions that might do this, I don't know of any (but haven't tried searching intently).
Other possible workarounds:
Try dragging the file from your native file explorer application to the VS Code file explorer panel. This is confirmed to work at least on Windows and Ubuntu.
From Mark's answer (copied under CC-BY-SA):
You can also use your OS's Open With... functionality and then drag the tab of that editor into whichever directory you want.
From user103's answer (copied under CC-BY-SA), and partially mentioned in the question post already:
You can choose Add File from File to add a file to your workspace. Or you can use New File from File to create a new file in your workspace and copy the content of the file outside to it.

VScode: Show a prompt when loaded files are modified externally on disk

Which is the final outcome of the VScode [issue] #14298 (https://github.com/microsoft/vscode/issues/14298) ?
Is it: "No, we will NOT issue a warning, if an external app modifies a VScode opened file, like ALL other editors do ? (except Notepad)"
Up to now, I cannot find such a setting...
I have never seen a prompt when an open file is changed elsewhere. What I have seen is a warning when I try to save a file that has been changed elsewhere. I have seen this: preventing dirty writes
VS Code will show you an error message when you try to save a file
that cannot be saved because it has changed on disk. VS Code blocks
saving the file to prevent overwriting changes that have been made
outside of the editor.
In order to resolve the save conflict, click the Compare action in the
error message to open a diff editor that will show you the contents of
the file on disk (to the left) compared to the contents in VS Code (on
the right):
Until those issues have been resolved I believe that is as close as you are going to get.

Can I configure VSCode to auto copy my file to another file whenever I save?

I am new to VSCode. Is there a way VSCode can auto save all my saves to a sequence of files? For example, my file is named foo.c, after some editing, the first time I save the file, there is a file foo.c_1 generated, the 2nd time foo.c_2, the 3rd foo.c_3, etc.
savevers.vim is what I have been using for vim. It is super convenient, say, when I want to retrieve a version I did the day before.
[Update] Yes, thanks life888888, timeline works great, it saves the history after I close and reopen the project folder.

Don't automatically open externally changed files in VS Code

Every time I rename a component and the editor changes that name in other files, they all get opened. Is there some option to make it not to do that?

Eclipse: Two Linked Resources pointing to same physical file are opening twice in Editor

I had to create multiple linked resources pointing to a single physical file in an Eclipse project. The problem is, whenever I try to open these two files, the editor opens each file in a separate tab, it won't direct me to the already opened file.
This is different from how VisualStudio works. VisualStudio has an option to add an existing file to a project. A single file can be used in multiple projects. Whenever we open both files, VS will direct us to the already opened file, it won't open the file in a new tab.
It's possible that developers open/edit multiple files at the same time and not notice that the same physical file was opened more than once. This behavior can potentially cause a lot of problems, for example, if File 1 is modified but not saved, and later File 2 is modified then saved, all modifications previously done in File 1 will be lost.
Is there any preference to turn-off/on this behavior? If not, can I implement this hook as a plugin?