Prevent VS Code from opening all files in a folder recursively - visual-studio-code

I am currently using VS Code on a folder mounted through an SSHFS. The folder has subfolders with many jpg and other image files.
Logging all the files VS Code tries to open reveals it recursively touches all the files (doesn't read the content, just STATs them). This takes very, very long over an SSHfs mount and I can not cancel it without killing the editor (it won't even respond to regular closing).
During this, no files or directories can be opened (inside VSCode) and will show a loading spinner until VS Code has finally had it's way and checked all the files.
This behaviour only recently emerged, I can't pinpoint if any version beyond the current stable version has this behaviour.
I am thinking it might be the new searching engine, but I can't find out which part of the editor is doing it.

It looks like they just posted a fix for your situation:
Slow startup opening a large workspace over the network
you will need vscode v1.32.3

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.

How to prevent VS Code remembering files outside work folder?

My workflow with VS Code is to always use project folders on projects. This works great, but there's one thing that's messing things up right now;
When opening just a single file from another project while working in another project, lets's say webpack.config.js, I use Windows Explorer rightclick to open that file in VS Code. However, this always opens the file in the currently open VS Code instance.
This adds the file from that other folder now to the memory of the previously opened files in the open project while it has nothing to do with that project.
When using the quick file open of VS Code now it happens a lot VS Code opens a file from that other folder, only because that outside file has been opened once while I was working on this project.
This is error prone as now it happens a lot, especially when working fast, that the wrong, for instance, package.json or webpack.config.js file gets opened, because VS Code now also suggests files that are outside this project. That's pretty frustrating and causes changes to be made in the wrong files pretty quickly.
I know we can clear the editor history and have to do it a lot now. But to me that's the other way around, doesn't solve the real problem and when not done often the issue remains.
So I want to get rid of this issue and have the following questions:
1) How can we change the 'Open with Code' rightclick menuitem in Explorer to open files always in a new instance of VS Code?
2) Is there a config settings to disable the behaviour that VS Code remembers files that are outside of the current work folder?
Thanks in advance, this thing is bothering me for quite some time now!
How can we change the 'Open with Code' rightclick menuitem in Explorer to open files always in a new instance of VS Code?
I assume you are a Windows user. You can edit the context menu behavior from Regedit.
Follow the below steps:
Press Windows + R
Type regedit and press OK
Go to Computer\HKEY_CLASSES_ROOT\*\shell\VSCode\command in regedit
Add -n parameter to the command like below
It will help you to open every file in a new window when you use Open with Code.
For your second question, Is there a config settings to disable the behavior that VS Code remembers files that are outside of the current work folder?
Open VS Code settings
Search window.openFilesInNewWindow
Make it off to on like below
With this configuration, you can't open new files in the current workspace therefore technically you prevent VS Code remember outside files. Not directly but it helps.
I don't like how "recently opened" files are shown in VS Code Quick Open (Ctrl+P). I think OP is describing this behavior...
The behavior to remember "recently opened" files causes me problems when I mistakenly open a temporary/copy of my file, i.e.
C:/users/temp/code.js
... instead of the true file (i.e. located inside the currently-open VS Code project)
C:/git/source-control/code.js
...my confusion happens because because both files are listed among the options when I use Quick Open Ctrl+P and type "code"
For me , the Quick Open list also has the answer, any "recently-open" files should have an "X" icon on the right side. You may need to hover your mouse over the file you want to remove.
Click the "X" icon to "Remove from recently open". Quick Open will always be able to find files in your current project, even if you remove them from recently-open:
Please note I don't have access to regedit as suggested in the accepted answer; my answer here does not require regedit

Keeping files in cache VSCode/Prevent erase after closing

I recently moved to VSCode from Notepad++, and I just found an annoying difference.
When I had for example n files opened in Notepad++ and I closed it(also if restarting computer), when re-opening it I used to find those files again, also if they were deleted from folder or edited.
In VSCode, just some files are keeping opened(it depends if you have got them locally or download once and then delete or refresh them), and that's an annoying thing for me.
I guess this function is related to cache system, so I am wondering: Is there any method to make the VSCode cache work like Notepad++'s does in VSCode? Are there any extensions to do it?
I mean: to keep files always in cache, except when I close them.
Thank you in advance

VSCode slow to open and highlight large log files

VSCode slow to open and highlight large log files
I use VSCode to open large log files with the log highlighter syntax. These log files are very large, often a couple hundred megabytes. I switched from Notepad++ to VSCode for all the features. Notepad++ usually opened the files okay but lacked the highlighting benefits.
The new VSCode updates asked me to increase memory size which I quadrupled.
However some logs either take a while to highlight or never do at all.
Is there anyway to either speed this up or get this to work a bit better? Should I open a github issue?
I would really like to use VSCode for these logs but it is annoying...
Resources on PC are not an issue.

Ignore backup files in chrome debugger source tab

I am using Chrome DevTools and have mapped my local source tree. As a result, when I look in the Filesystem tab in the Sources tab, I can see all of my source files and all of my backup files.
The backup files are pure clutter: is there a way to hide them from the view?
I am not talking about black boxing: that prevents me from stepping into files that are actually used. I want to not see files that are not used in the list of files.
I want model.jsx.~1~ to not show up in this case. In general, any file matching *~ should be hidden.
As reported in the comments, this is not currently possible. I created an issue to request the ability.
https://bugs.chromium.org/p/chromium/issues/detail?id=883325