microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
160.51k stars 28.1k forks source link

Find in files suddenly broken #45200

Closed severak closed 6 years ago

severak commented 6 years ago

Issue Type

Bug

Description

  1. open editor with files
  2. search for «something» in these files
  3. close all editors
  4. try to «something» find it again
  5. have headache, because «something» was not found now

Probably related to #22704.

BTW - is there any way how to destroy find in files search index? To me it looks like the search index is broken.

VS Code Info

VS Code version: Code 1.20.1 (f88bbf9137d24d36d968ea6b2911786bfe103002, 2018-02-13T15:34:36.336Z) OS version: Windows_NT x64 6.1.7601

System Info |Item|Value| |---|---| |CPUs|Intel(R) Pentium(R) CPU G630 @ 2.70GHz (2 x 2693)| |Memory (System)|7.85GB (2.39GB free)| |Process Argv|C:\Program Files\Microsoft VS Code\Code.exe| |Screen Reader|no| |VM|0%|
Extensions (3) Extension|Author (truncated)|Version ---|---|--- vscode-intelephense-client|bme|0.8.8 githistory|don|0.4.0 intellij-idea-keybindings|k--|0.2.21 (1 theme extensions excluded)

Reproduces without extensions

roblourens commented 6 years ago

There is no index, but it works differently for open files vs files that are not open.

Does it never find results in files that are not open? Does it work in other folders?

severak commented 6 years ago

It find in files which are open. Files which are not open are practically unsearchable. It's somewhat mysterious - this weird behavior began today, yesterday it was fine.

roblourens commented 6 years ago

Have you upgraded to 1.21, just released? See if it's any different there.

If not, please do the following

image

severak commented 6 years ago

Even more weird. Yesterday search was completely broken. Today it works fine and I am still on 1.20. :confused:

I will log search trace if it went wrong again.

severak commented 6 years ago

Suddenly, search broken again.

Here is the log:

[2018-03-08 12:06:02.448] [renderer1] [trace] SearchService#search {"type":2,"folderQueries":[{"folder":{"$mid":1,"fsPath":"c:\\Users\\Admin\\Projects\\irest","external":"file:///c%3A/Users/Admin/Projects/irest","path":"/c:/Users/Admin/Projects/irest","scheme":"file"},"fileEncoding":"utf8"}],"usingSearchPaths":true,"maxResults":10000,"contentPattern":{"pattern":"$__POST","isRegExp":false,"isCaseSensitive":false,"isWordMatch":false,"wordSeparators":"`~!@#$%^&*()-=+[{]}\\|;:'\",.<>/?","isSmartCase":false},"useRipgrep":true,"disregardIgnoreFiles":true,"disregardExcludeSettings":true,"ignoreSymlinks":false}
[2018-03-08 12:06:02.505] [renderer1] [debug] SearchService#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 -- '$__POST' 'c:\Users\Admin\Projects\irest'
 - cwd: c:/
 - Sibling clauses: {}

(Opened VSCode with no editors and searched for $__POST variable.)

roblourens commented 6 years ago

Does it work in other folders? Any pattern to where it works or doesn't?

Have you tried 1.21?

vscodebot[bot] commented 6 years ago

This issue has been closed automatically because it needs more information and has not had recent activity. See also our issue reporting guidelines.

Happy Coding!

krasi-georgiev commented 6 years ago

Still an issue with 1.21

it is quite random so can't give more info how to replicate.

krasi-georgiev commented 6 years ago

@roblourens this is still an issue on

Version 1.21.1 Commit 79b44aa704ce542d8ca4a3cc44cfca566e7720f1 Date 2018-03-14T14:46:30.761Z Shell 1.7.9 Renderer 58.0.3029.110 Node 7.9.0 Architecture x64

drone/autoscaler Search for Verfiy - Match Case , Match Word Finds a match only in license.go

doing grep -R Verify ./ shows many other matches If I open any of the other files that have a match and running the search again will add it to the search result.

for example here is the log for such example

before I open the file ./vendor/github.com/o1egl/paseto/v2.go

[2018-03-21 07:03:14.709] [renderer1] [trace] CommandService#executeCommand workbench.action.closeActiveEditor
[2018-03-21 07:03:20.227] [renderer1] [trace] SearchService#search {"type":2,"folderQueries":[{"folder":{"$mid":1,"fsPath":"/home/krasi/src/github.com/drone/autoscaler","external":"file:///home/krasi/src/github.com/drone/autoscaler","path":"/home/krasi/src/github.com/drone/autoscaler","scheme":"file"},"excludePattern":{"**/.git":true,"**/.svn":true,"**/.hg":true,"**/CVS":true,"**/.DS_Store":true,"**/node_modules":true,"**/bower_components":true},"fileEncoding":"utf8"}],"usingSearchPaths":false,"maxResults":10000,"contentPattern":{"pattern":"Verify","isRegExp":false,"isCaseSensitive":false,"isWordMatch":true,"wordSeparators":"`~!@#$%^&*()-=+[{]}\\|;:'\",.<>/?","isSmartCase":false},"useRipgrep":true,"disregardIgnoreFiles":false,"disregardExcludeSettings":false,"ignoreSymlinks":false}
[2018-03-21 07:03:20.237] [renderer1] [debug] SearchService#search rg --hidden --heading --line-number --color 'ansi' --colors 'path:none' --colors 'line:none' --colors 'match:fg:red' --colors 'match:style:nobold' --ignore-case -g '!/home/krasi/src/github.com/drone/autoscaler/**/.git' -g '!/home/krasi/src/github.com/drone/autoscaler/**/.svn' -g '!/home/krasi/src/github.com/drone/autoscaler/**/.hg' -g '!/home/krasi/src/github.com/drone/autoscaler/**/CVS' -g '!/home/krasi/src/github.com/drone/autoscaler/**/.DS_Store' -g '!/home/krasi/src/github.com/drone/autoscaler/**/node_modules' -g '!/home/krasi/src/github.com/drone/autoscaler/**/bower_components' --max-filesize '17179869184' --no-ignore-parent --follow --regexp '\bVerify\b' -- '/home/krasi/src/github.com/drone/autoscaler'
 - cwd: /
 - Sibling clauses: {}

After I open ./vendor/github.com/o1egl/paseto/v2.go which has a match which has a match for Verify and gets added to the search after I opened it.

[2018-03-21 07:04:02.899] [renderer1] [trace] SearchService#search {"type":2,"folderQueries":[{"folder":{"$mid":1,"fsPath":"/home/krasi/src/github.com/drone/autoscaler","external":"file:///home/krasi/src/github.com/drone/autoscaler","path":"/home/krasi/src/github.com/drone/autoscaler","scheme":"file"},"excludePattern":{"**/.git":true,"**/.svn":true,"**/.hg":true,"**/CVS":true,"**/.DS_Store":true,"**/node_modules":true,"**/bower_components":true},"fileEncoding":"utf8"}],"usingSearchPaths":false,"maxResults":10000,"contentPattern":{"pattern":"Verify","isRegExp":false,"isCaseSensitive":false,"isWordMatch":true,"wordSeparators":"`~!@#$%^&*()-=+[{]}\\|;:'\",.<>/?","isSmartCase":false},"useRipgrep":true,"disregardIgnoreFiles":false,"disregardExcludeSettings":false,"ignoreSymlinks":false}
[2018-03-21 07:04:02.920] [renderer1] [debug] SearchService#search rg --hidden --heading --line-number --color 'ansi' --colors 'path:none' --colors 'line:none' --colors 'match:fg:red' --colors 'match:style:nobold' --ignore-case -g '!/home/krasi/src/github.com/drone/autoscaler/**/.git' -g '!/home/krasi/src/github.com/drone/autoscaler/**/.svn' -g '!/home/krasi/src/github.com/drone/autoscaler/**/.hg' -g '!/home/krasi/src/github.com/drone/autoscaler/**/CVS' -g '!/home/krasi/src/github.com/drone/autoscaler/**/.DS_Store' -g '!/home/krasi/src/github.com/drone/autoscaler/**/node_modules' -g '!/home/krasi/src/github.com/drone/autoscaler/**/bower_components' --max-filesize '17179869184' --no-ignore-parent --follow --regexp '\bVerify\b' -- '/home/krasi/src/github.com/drone/autoscaler'
 - cwd: /
 - Sibling clauses: {}
roblourens commented 6 years ago

@krasi-georgiev please open a new issue

Make sure that the file with the match isn't covered by your gitignore file or an exclude setting.

krasi-georgiev commented 6 years ago

Thanks @roblourens Disabling Use Exclude settings and ingored Files was the culprit in my case. I think it all works as expected now. I didn't expect that .gitignore should affect the search.

roblourens commented 6 years ago

You can also set "search.useIgnoreFiles": false