Steps to Reproduce:
Reproduces without extensions: Yes
Have you tried any other editors? Do they show results?
Maybe related to https://github.com/Microsoft/vscode/issues/27285
Can you check for errors in the developer tools (Help > Toggle developer tools) and the Search output pane:

I have exactly the same problem on
When I open folder C:\Users\<USER>\OneDrive\Documents\<FOLDER> then Search (Ctrl+Shift+F) and also Go to File (Ctrl+P) don't work.
When I open C:\Users\<USER>\Downloads everything works as expected.
Only ASCII characters are used in my <USER> and <FOLDER> names.
I haven't find anything relevant in Developer Tools Console.
EDIT!: In Search output pane I found:
c:\Users\<USER>\OneDrive\Documents\<FOLDER>: Access is denied. (os error 5)
Any special permissions on the Onedrive folder? Are you running Code as administrator? Are the Onedrive files actually on disk?
Thanks for hints. Finally I resolved the problem by turning off _Files On-Demand_ OneDrive feature.
It seems that ripgrep doesn't work with _Files On-Demand_ feature even if all folders are selected in OneDrive Settings and _Always keep on this device_ is checked in File Explorer.
In this case directories and files still have special link mode (reparse point attribute with no target) which ripgrep isn't able to process.
Thanks for great editor!
Glad you found a workaround. Do you know whether other editors work with this?
I tried Notepad++ and NetBeans and both are able to search OneDrive files when _Files On-Demand_ feature is turned on.
I also tried to add file which was only available online (using OneDrive web app) and after successful search in Notepad++ file had status _Available on this device_ (was downloaded during the search).
Ok, I'll have to find out how they prompt windows to download those files.
I don't think these editors do anything special for OneDrive files. I would guess they just open the file as usual and Windows downloads it.
I think we could try to ask ripgrep to support _Files On-Demand_. It has special handling for links so it could also handle these special "links" too.
The original report from @ericdching said that this happened even when all files are on the local device. I haven't had a response from him on questions above, and there are multiple reports of this behavior for off-device files, so continuing to use this issue for OneDrive issues in general.
Ticking 'always keep on this device' downloads all the files yet Visual Studio Code still cannot search the contents.
I tried closing OneDrive and putting the same files/folder in 'C:\Users\aaron\OneDrive' and 'C:\Users\aaron'. The search works in both locations but, when you reopen OneDrive, the search stops working on the OneDrive location even though the files are still there.
Windows indexes and searches within the files fine so the issue is with the way Visual Studio Code is searching within the file contents in conjunction with OneDrive. As I say, the files are definitely still on the hard drive so there is a problem with Visual Studio Code.
Are there any errors in the search output pane?

Unsuccessful search:
rg --hidden --heading --line-number --color 'ansi' --colors 'path:none' --colors 'line:none' --colors 'match:fg:red' --colors 'match:style:nobold' --ignore-case --max-filesize '17179869184' --no-ignore --follow --fixed-strings -- 'test' 'c:\Users\aaron\OneDrive\MultiPoolMiner' 'c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\parts\welcome\page\electron-browser\vs_code_welcome_page'
- cwd: c:/
- Sibling clauses: {}
c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\parts\welcome\page\electron-browser\vs_code_welcome_page: The system cannot find the path specified. (os error 3)
No files were searched, which means ripgrep probably applied a filter you didn't expect. Try running again with --debug.
Successful search:
rg --hidden --heading --line-number --color 'ansi' --colors 'path:none' --colors 'line:none' --colors 'match:fg:red' --colors 'match:style:nobold' --ignore-case --max-filesize '17179869184' --no-ignore --follow --fixed-strings -- 'test' 'c:\Users\aaron\MultiPoolMiner'
- cwd: c:/
- Sibling clauses: {}
but, when you reopen OneDrive, the search stops working on the OneDrive location even though the files are still there.
Strange. I haven't been able to repro this. Will keep trying...
Same issue here. Identical symptoms to above. Is there anything I can provide/do to help track this down?
Search output:
c:\Users\me\OneDrive\Documents\Visual Studio 2017\Projects\test: Access is denied. (os error 5)
Should note that the entire directory is already on-disk.
Did some further digging on this. When ripgrep is pointed at a directory that is in OneDrive with Files on Demand turned on, it fails as though the directory doesn't exist. If pointed at a specific file within that same directory, it's able to work just fine. This is exactly the same behaviour as here:
https://github.com/Microsoft/vscode/issues/27285
This will have to be fixed by ripgrep. I'll open a ticket up there soon.
@kevbry Great, I hope this gets fixed soon; OneDrive is an integral part of Windows these days.
I can repro it now after installing another Windows update. I was already on the latest Windows release, but I didn't have the latest OneDrive update for some reason.
Hi @roblourens I have a live repro of this. All of the files in my "OneDrive - Microsoft" folder are downloaded locally to my machine. I can search my directory using Sublime. When I search using code, the Search Output Window shows this:
rg --hidden --heading --line-number --color 'ansi' --colors 'path:none' --colors 'line:none' --colors 'match:fg:red' --colors 'match:style:nobold' --ignore-case -g '!/Users/jschwarz/OneDrive - Microsoft/workingdirs//.git' -g '!/Users/jschwarz/OneDrive - Microsoft/workingdirs//.svn' -g '!/Users/jschwarz/OneDrive - Microsoft/workingdirs//.hg' -g '!/Users/jschwarz/OneDrive - Microsoft/workingdirs//CVS' -g '!/Users/jschwarz/OneDrive - Microsoft/workingdirs//.DS_Store' -g '!/Users/jschwarz/OneDrive - Microsoft/workingdirs/.dmp' -g '!/Users/jschwarz/OneDrive - Microsoft/workingdirs/.dll' -g '!/Users/jschwarz/OneDrive - Microsoft/workingdirs/.obf' -g '!/Users/jschwarz/OneDrive - Microsoft/workingdirs/.mp4' -g '!/Users/jschwarz/OneDrive - Microsoft/workingdirs//node_modules' -g '!/Users/jschwarz/OneDrive - Microsoft/workingdirs/**/bower_components' --max-filesize '17179869184' --no-ignore --follow --fixed-strings -- 'test' 'c:\Users\jschwarz\OneDrive - Microsoft\workingdirs'
This is still very much an issue in the current version of VS Code. Has there been any progress on it? It looks like there hasn't been much activity on the upstream bugs...
FYI, got the latest stable version of VSCode, still repros 100% for me. Would be great to please get an update on when this might be fixed so that I can start using VSCode again.
Version 1.19.2
Commit 490ef761b76b3f3b3832eff7a588aac891e5fe80
Date 2018-01-10T15:55:03.538Z
Shell 1.7.9
Renderer 58.0.3029.110
Node 7.9.0
Architecture x64
The upstream Rust issue is not seeing any progress, so I hope to come up with a workaround by the end of the month.
I don't think it's been called out in this issue yet, but this can be worked around by disabling ripgrep with "search.useRipgrep": false.
Thank you @roblourens - That seems to have done the trick for me :-)
This will be fixed when we start building Insiders again.
I updated VS Code to v1.21 and the most important feature of every editor (search) still doesn't work. Even after 9 months no one can search and work properly on projects backed up by OneDrive :(
This was actually pulled from the 1.21 release.
Going into 1.22
I verified that the following works:
Most helpful comment
The upstream Rust issue is not seeing any progress, so I hope to come up with a workaround by the end of the month.
I don't think it's been called out in this issue yet, but this can be worked around by disabling ripgrep with
"search.useRipgrep": false.