-
Notifications
You must be signed in to change notification settings - Fork 29.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pasting file in the explorer no longer opens that file in the editor #120882
Comments
I think the gist of the above is: If that is inded the gist we have changed this on purpose after numerous users complaining about this behaviour. And I agree with them, especially since no other Explorer does this. Correct me if I wrongly understood the above issue. |
It depends on how you use the explorer tho, what I personally do with copy-pasting a file is to clone a file and start editing it; and I think this should be the main use of copy-pasting files for the majority of people. this behavior cost me hours of headache today since I was modifying old files like 10 times just in the last couple of hours and had to revert and copy the changes to the new file each time. So if this is about people complaining, consider this my complaint against this change, if for no other reason except the fact that this was the behavior for a long time and many of us already have this in muscle memory. However, regardless of my personal "complain", please make sure that the focus stays on the old file in the tree view if we are staying with this change since it is confusing as hell that we have a file open in the editor but the focus is on the newly cloned file in the tree view |
This way of working has been in place for years, and many people use it. If other people are complaining, then you give them the option via settings to the workflow that suits their needs, you don't just break tried and well worn workflow. Even now that I know about the issue, I am still copy/pasting and then editing the wrong file because you can't tell that that you are on the wrong file. And even if I could tell
It would still add an extra step to the workflow because now I would have to copy the file and then use my mouse to go and open it as well. |
Is there any fix to this behavior? I am also stuck to this issue and seems broke my coding |
I'd happily accept that the previous behavior was wrong, but it stood like this for years for people to train themselves on it. The result is pure frustration for those who have adapted to it.
Fully agreed. This change seems to ignore all the people who didn't complain about the status quo 😄
When you open Windows Explorer and copy/paste a file, the pasted (duplicated) file will be focused. |
Well we focus the duplicated file. We just no longer open it. |
Indeed. I was unclear in what I was seeing. Specifically, if you have the preview panel enabled in Windows Explorer, it will "open" the new file. I can see that it's not quite the same as opening a document in an editor, but I still feel like it serves as an example of why the old VS Code duplication behavior wasn't completely unexpected. Similary, when you copy layers in an application like Photoshop or Paint.NET, you will be editing the duplicated layer right after completing the action. From a user experience point of view, this could be argued either way to be "correct". I would really like to have an option to control this behavior. |
I screw this up every single time. This caused me at least 100 GPU hours wasted last week. Even though I noticed what's happening pretty early, I still can't remember to click the copied file, because it is so counter-intuitive that my brain just can't handle it. Wouldn't it be possible to create an option for configuring it? |
Just train yourself to hit Enter twice after renaming. It will surely have no negative side effects 😄 |
The double |
That is precisely the problem. Focusing on the duplicated file is what misleading about what you're actually editing. What explorer are you referring to when the selected file or directory in the tree on the left panel is NOT the one you're seeing on the right? I too have wasted numerous hours in the past couple weeks editing the original without realizing it after this change was made. |
I very rarely add to already discussed topics, but this one is pretty annoying. The double "ENTER" may help, but the copied file should not be shown as selected in the editor tree. Thanks for rolling back the new feature and making this a setting ;-) |
I write many test cases in a single day. In the hundreds to thousands. They're all plain text files with a certain boilerplate format and it's convenient to copy-paste them and tweak a few lines to test potentially troubling edge cases. At some point, after updating recently, the behaviour changed. I have found many files where the test case does not match the file name describing it, I've been trying to train myself to work around the issue by double checking the name of the editor tab that's focused...
[Edit] Okay, I just paid more attention and in VS 2019, the pasted file is not selected the tree view. In VS Code, the pasted file is selected in the tree view. Clicking the pasted file to select it in the tree view (even though it's already selected), does open and focus it in the editor. |
@isidorn actually I think the title should be "after copying and pasting a file, it looks like the copy is open, when the original is still open in the editor" It's a more neutral title because the crux of the problem is that the pasted file looks like it's open, regardless of whether or not VSCode should open the pasted file (I'm aware that they stopped opening pasted files due to annoyance when multiple files were pasted). In Atom for example, if you paste a file, the copy appears but the original remains highlighted, so it doesn't confuse your brain.
Actually the highlight color seems to indicate selection, not focus. When you click on a file and then use the arrow keys to navigate, the file focused by arrow keys is highlighted with a secondary color (and indeed if you hit In contrast, after you paste, the pasted file is highlighted with the primary color and the original is not even highlighted, misrepresenting the current state of the editor: This is why it continuously fools all of us into thinking the pasted file is open. If VSCode is not going to open the pasted file, then it should look like this after pasting instead (ignoring git status colors): |
I would love to see any option to change this behavior like reverting this like before |
This behaviour is extremely confusing. The focus in the Explorer is on the new copy, but the focus in the edit pane is on the old file. That is so counter intuitive I cannot believe this was an intentional change. IMO one of these two options needs to be made default
What is the purpose of even having a focus highlight on the Explorer pane, if it isn't to display what file is open?! |
The new behavior is frustrating. There should at least be a setting to control the behavior, at least when copying and pasting a single file. |
Based on the conversation above it seems that putting behavior behind a setting should resolve most peoples issues. As I mentioned in my duplicate issue, the earlier behavior seems to be controlled by just a few lines of code (e2c5ff9), and I'd assume re-implementing it behind a setting should be a relatively small task. I haven't worked in the VS Code code base before, but I could probably raise a PR if the VS Code team decides to approve the feature. |
@scriptcoded but the other thing we should fix in a PR is making the pasted file get the secondary focus color while the file that's open in the editor retains the primary selection color, in the case that the pasted file doesn't get opened. |
@scriptcoded Thanks for linking in this commit. This lead me to the complaint that ultimately caused this change: #117967 After reading that, the new behavior makes more sense to me. If I copy a file from an external location or another instance of VS Code and paste it into the instance of VS Code I'm working in, I wouldn't expect the file to be opened to be honest. Why that would be undesireable might become clearer when copying a very large binary file between workspaces. I still can't help being confused by the new behavior when duplicating files inside a single VS Code instance though. |
@oliversalzburg I think the confusion is primarily due to the file that's being copied is being opened in preview, and is left open when the file is pasted. This ties in to what @jedwards1211 was saying about the different selection colors. If I'm not mistaken the colors actually refer to the state of the selection, which makes the whole thing a bit more complicated. In the case when a file is pasted, why would the source file remain selected? What happens when you paste a file from an external source, should there be no files highlighted? Suddenly which file is selected in the explorer is dependent on the users preference for whether or not to open the pasted file in a new tab. That seems a bit odd to me. |
Will revert back to the old behavior probably. Assigning to April to investigate. |
@isidorn the old behavior was changed primarily because people were getting annoyed when they would paste dozens of files and VSCode would open all of them, right? I guess the rule could be only open if one file is pasted, but I think most of the complaints would die down if just the selection colors after paste are fixed, since it seems like it's uncommon for other IDEs to open a pasted file. |
@jedwards1211 Only opening when pasting one file actually seemed to be the old behavior. Also, while I think the selection colors might help, VS Code still has the preview file-feature which makes things confusing. Therefore I think it's important that the setting is there at least. |
@scriptcoded you know, we should make a separate selection color issue anyway, because if you copy and paste multiple files, you end up with just one of the copies selected in the navigator but not open in the editor, so there's confusion there too |
Okay I opened #122586 |
Fixed via ed5d4a1 |
I appreciate this has now been resolved, but most of the discussion I've seen has been dogmatic rather than oriented around workflows. So I wanted to offer a use case (similar to OP) for consideration. Generally I agree that if there's a setting for this the problem should be resolved for all. I work with C#/.NET in VS Code, as a Mac user. This means when creating new .cs files I don't benefit from the fantastic "New File" experience of full-fat VS, but also don't want to spend time typing up my namespace and imports. CMD+N may also try to create files in the wrong directory based on my currently open file. So my common workflow has been:
Since the (now reverted) change came in I've found myself constantly editing the original file instead of the new file, and later having to switch round the content once I realise my mistake. It's not lost on me that my use case is basically the embodiment of this XKCD, but given this has been a feature since the early days of VS Code I would definitely like to at least have a setting to return this behaviour for single files! |
Issue Type: Bug
When I clone a file, the focus for the file has always been the cloned file and so I can start editing that file and straight away.
This behaviour has changed in the last couple of weeks, I have nearly lost valuable code multiple times recently because of this behaviour change and had thought I was doing something wrong, but I have reproduction steps listed below.
I have tested this without extensions turned on
code --disable-extensions
to rule out issues there.The following keystrokes (on mac) is a flow that I have been using for years to work on the next (new) class or file in vscode, this flow has recently stopped working as expected.
I have a file opened, I'll call it
original.rb
and it is finished and I am ready to move onto my next class/file.Here are the keystrokes and mouse clicks that I do.
Clone the current
original.rb
fileAt this point, the focus in the explorer window is the cloned file 'original copy.rb' and up until recently the focus in the editor has also been the cloned file 'original copy.rb'
BUG: This is not the case any more, the original file has the focus in the editor, even though the cloned file has focus in the explorer .
What has happened time-after-time in the last week or two is that I click into the editor with the assumption that I am working on the cloned file, I update it, delete irrelevant methods, add new methods, save my code and then go to run and my build is failing because I was not altering the cloned file, instead I have been destroying the original file.
AutoReveal Settings
I've checked the autoReveal settings to see if there was an issue there, but I can't see any issues.
VS Code version: Code 1.55.0 (c185983, 2021-03-30T16:01:05.981Z)
OS version: Darwin x64 19.6.0
System Info
gpu_compositing: enabled
metal: disabled_off
multiple_raster_threads: enabled_on
oop_rasterization: enabled
opengl: enabled_on
protected_video_decode: unavailable_off
rasterization: enabled
skia_renderer: disabled_off_ok
video_decode: enabled
webgl: enabled
webgl2: enabled
Extensions (19)
A/B Experiments
The text was updated successfully, but these errors were encountered: