microsoft / vscode

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

Global Regex Search with Whole Word Only Searches Open Files If Search Includes Newline #233140

Open mb-realpage opened 3 hours ago

mb-realpage commented 3 hours ago

Type: Bug

Make a global Whole Word, RegEx search that returns both open files and files in the project folder(s). It will return multiple files. The search must match something at the end of a line.

Add a newline to the search, using \n. It will incorrectly only show open files that have a newline.

Turning off Whole Word will correctly include all files that match the search string.

The search should either include all files that match or no files that match, instead of including open files only.

VS Code version: Code 1.95.1 (65edc4939843c90c34d61f4ce11704f09d3e5cb6, 2024-10-31T05:14:54.222Z) OS version: Windows_NT x64 10.0.19045 Modes: Remote OS version: Linux x64 5.15.153.1-microsoft-standard-WSL2 Remote OS version: Linux x64 5.15.153.1-microsoft-standard-WSL2 Remote OS version: Linux x64 5.15.153.1-microsoft-standard-WSL2 Remote OS version: Linux x64 5.15.153.1-microsoft-standard-WSL2 Remote OS version: Linux x64 5.15.153.1-microsoft-standard-WSL2 Remote OS version: Linux x64 5.15.153.1-microsoft-standard-WSL2 Remote OS version: Linux x64 5.15.153.1-microsoft-standard-WSL2

System Info |Item|Value| |---|---| |CPUs|12th Gen Intel(R) Core(TM) i7-1255U (12 x 2611)| |GPU Status|2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off| |Load (avg)|undefined| |Memory (System)|31.69GB (3.58GB free)| |Process Argv|--crash-reporter-id 5983b7a4-e461-42af-8bc3-bfe1619ec9de| |Screen Reader|no| |VM|50%| |Item|Value| |---|---| |Remote|WSL: Ubuntu-22.04| |OS|Linux x64 5.15.153.1-microsoft-standard-WSL2| |CPUs|12th Gen Intel(R) Core(TM) i7-1255U (12 x 0)| |Memory (System)|15.47GB (8.44GB free)| |VM|0%| |Item|Value| |---|---| |Remote|WSL: Ubuntu-22.04| |OS|Linux x64 5.15.153.1-microsoft-standard-WSL2| |CPUs|12th Gen Intel(R) Core(TM) i7-1255U (12 x 0)| |Memory (System)|15.47GB (8.44GB free)| |VM|0%| |Item|Value| |---|---| |Remote|WSL: Ubuntu-22.04| |OS|Linux x64 5.15.153.1-microsoft-standard-WSL2| |CPUs|12th Gen Intel(R) Core(TM) i7-1255U (12 x 0)| |Memory (System)|15.47GB (8.44GB free)| |VM|0%| |Item|Value| |---|---| |Remote|WSL: Ubuntu-22.04| |OS|Linux x64 5.15.153.1-microsoft-standard-WSL2| |CPUs|12th Gen Intel(R) Core(TM) i7-1255U (12 x 0)| |Memory (System)|15.47GB (8.44GB free)| |VM|0%| |Item|Value| |---|---| |Remote|WSL: Ubuntu-22.04| |OS|Linux x64 5.15.153.1-microsoft-standard-WSL2| |CPUs|12th Gen Intel(R) Core(TM) i7-1255U (12 x 0)| |Memory (System)|15.47GB (8.44GB free)| |VM|0%| |Item|Value| |---|---| |Remote|WSL: Ubuntu-22.04| |OS|Linux x64 5.15.153.1-microsoft-standard-WSL2| |CPUs|12th Gen Intel(R) Core(TM) i7-1255U (12 x 0)| |Memory (System)|15.47GB (8.44GB free)| |VM|0%| |Item|Value| |---|---| |Remote|WSL: Ubuntu-22.04| |OS|Linux x64 5.15.153.1-microsoft-standard-WSL2| |CPUs|12th Gen Intel(R) Core(TM) i7-1255U (12 x 0)| |Memory (System)|15.47GB (8.44GB free)| |VM|0%|
Extensions (35) Extension|Author (truncated)|Version ---|---|--- extension-path|act|0.0.4 lua-debug|act|2.0.10 batch-replacer|ang|1.2.1 vscode-markdownlint|Dav|0.56.0 gitlens|eam|15.6.3 gc-excelviewer|Gra|4.2.62 rainbow-csv|mec|3.12.0 vscode-docker|ms-|1.29.3 makefile-tools|ms-|0.11.13 quicktype|qui|23.0.170 java|red|1.36.0 vscode-yaml|red|1.15.0 markdown-preview-enhanced|shd|0.8.14 intellicode-api-usage-examples|Vis|0.2.9 vscodeintellicode|Vis|1.3.2 vscode-gradle|vsc|3.16.4 vscode-java-debug|vsc|0.58.1 vscode-java-dependency|vsc|0.24.0 vscode-java-pack|vsc|0.29.0 vscode-java-test|vsc|0.42.0 vscode-maven|vsc|0.44.0 markdown-all-in-one|yzh|3.6.2 vscode-nginx-conf|ahm|0.3.5 jsonl|Alp|0.0.1 Handlebars|and|0.4.1 jsdoc-markdown-highlighting|bie|0.0.1 javascript-ejs-support|Dig|1.3.3 vscode-graphql-syntax|Gra|1.3.8 hjson|lak|0.3.2 dotenv|mik|1.0.1 jupyter-keymap|ms-|1.1.2 remote-ssh|ms-|0.115.0 remote-ssh-edit|ms-|0.87.0 remote-wsl|ms-|0.88.5 remote-explorer|ms-|0.4.3
A/B Experiments ``` vsliv368:30146709 vspor879:30202332 vspor708:30202333 vspor363:30204092 vscod805:30301674 binariesv615:30325510 vsaa593:30376534 py29gd2263:31024239 vscaat:30438848 c4g48928:30535728 azure-dev_surveyone:30548225 2i9eh265:30646982 962ge761:30959799 pythongtdpath:30769146 pythonnoceb:30805159 asynctok:30898717 pythonmypyd1:30879173 h48ei257:31000450 pythontbext0:30879054 cppperfnew:31000557 dsvsc020:30976470 pythonait:31006305 dsvsc021:30996838 0ee40948:31013168 dvdeprecation:31068756 dwnewjupyter:31046869 newcmakeconfigv2:31071590 impr_priority:31102340 nativerepl2:31139839 refactort:31108082 pythonrstrctxt:31112756 wkspc-onlycs-t:31132770 wkspc-ranged-t:31151552 cf971741:31144450 iacca1:31171482 notype1cf:31157160 5fd0e150:31155592 dwcopilot:31170013 ```
mb-realpage commented 2 hours ago

This is not the first time I've run into this bug; previously, I found that particular combinations with \n led to odd behavior with Global Search. But this is the first time I drilled down into it and experimented, rather than just working around it as quickly as possible.

RedCMD commented 52 minutes ago

prob need to use \r?\n instead open files are normalized to \n while file search looks at the og file which is \r\n in Windows