Glob pattern "**/.*" in "files.exclude" breaks the symbol resolution
smwikipedia opened this issue · 7 comments
Type: LanguageService
My source tree can produce different build results. Each build use different C files.
I use files.exclude
in settings.json to exclude the C files not relevant to a specific build.
For a specific build, I add about 2500 C files to files.exclude
.
But this break the symbol parsing. The database icon at the bottom right simply doesn't show the progress percentage. It just keep saying Parsing open files
forever...
If the file parsing cannot finish, it will cause #4059
Describe the bug
-
OS and Version:
Windows 10 Version 1709 (Build 16299.1268)
-
VS Code Version:
Version: 1.37.0 (user setup)
Commit: 036a6b1d3ac84e5ca96a17a44e63a87971f8fcc8
Date: 2019-08-08T02:33:50.993Z
Electron: 4.2.7
Chrome: 69.0.3497.128
Node.js: 10.11.0
V8: 6.9.427.31-electron.0
OS: Windows_NT x64 10.0.16299
-
C/C++ Extension Version:
0.25.0-insiders
-
Other extensions you installed (and if the issue persists after disabling them):
-
A clear and concise description of what the bug is.
To Reproduce
There are 2 reproduces in the comments.
Expected behavior
Screenshots
Additional context
Well, it seems the root cause is I added below highlighted "**/.*" : true
to the settings.json.
Adding this line will cause the database icon never disappear:
And when I hover the mouse over it, it just says "Parsing open files". No percentage show.
My intention is to exclude all the files and folders started with a dot.
According to here: https://code.visualstudio.com/docs/editor/codebasics#_advanced-search-options
**/.*
can be used to represent dot started files or folders in any dir and subdir.
I don't know why it can break the symbol parsing.
Could someone help me explain it?
Reproduce 1: "**/.*" : true
breaks the goto definition
.
The unexpected result happens at step 4.
(In below steps, the database icon can disappear, I think it's because the folder structure is too simple. But the **/.*
glob patter breaks the "goto definition".)
The content of each file are:
(lib.c)
#include "lib.h"
void func(void)
{
}
(lib.h)
void func(void);
(main.c)
#include "lib.h"
void main()
{
func();
}
The .vscode folder contains 2 files:
(c_cpp_properties.json)
{
"configurations": [
{
"name": "Win32",
"includePath": [
"${workspaceFolder}/**"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"windowsSdkVersion": "8.1",
"compilerPath": "C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/cl.exe",
"cStandard": "c11",
"cppStandard": "c++17",
"intelliSenseMode": "msvc-x64"
}
],
"version": 4
}
(settings.json)
{
"files.exclude": {
"**/.*": true
}
}
-
Open the
glob
folder in VS Code. -
Reset the intellisense database. (<======== DO NOT SKIP THIS )
-
Open
main.c
, pressF12
onfunc()
to goto its definition.
It will only go to its declaration. The log is:
-------- Diagnostics - 8/12/2019, 2:43:27 PM
Version: 0.25.0-insiders
Current Configuration:
{
"name": "Win32",
"includePath": [
"${workspaceFolder}/**"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"windowsSdkVersion": "8.1",
"compilerPath": "C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/cl.exe",
"cStandard": "c11",
"cppStandard": "c++17",
"intelliSenseMode": "msvc-x64",
"compilerArgs": [],
"browse": {
"path": [
"${workspaceFolder}/**"
],
"limitSymbolsToIncludedHeaders": true
}
}
-
Change the
"**/.*": true
to"**/.*": false
, or delete it. -
Reset the Intellisense database. (<======== DO NOT SKIP THIS )
-
Open
main.c
, pressF12
onfunc()
to goto its definition.
Now the definition can be reached. The log is:
-------- Diagnostics - 8/12/2019, 2:41:45 PM
Version: 0.25.0-insiders
Current Configuration:
{
"name": "Win32",
"includePath": [
"${workspaceFolder}/**"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"windowsSdkVersion": "8.1",
"compilerPath": "C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/cl.exe",
"cStandard": "c11",
"cppStandard": "c++17",
"intelliSenseMode": "msvc-x64",
"compilerArgs": [],
"browse": {
"path": [
"${workspaceFolder}/**"
],
"limitSymbolsToIncludedHeaders": true
}
}
I am using:
VSCode version:
Version: 1.37.0 (user setup)
Commit: 036a6b1d3ac84e5ca96a17a44e63a87971f8fcc8
Date: 2019-08-08T02:33:50.993Z
Electron: 4.2.7
Chrome: 69.0.3497.128
Node.js: 10.11.0
V8: 6.9.427.31-electron.0
OS: Windows_NT x64 10.0.16299
c_cpp_extension version:
0.25.0-insiders
OS version:
Windows 10 Version 1709 (build 16299.1268)
Reproduce 2: "**/.*" : true
keeps the database icon showing forever. And file parsing never ends.
I upload the repro code to here: https://github.com/smwikipedia/globRepro
Steps:
-
Open the
testFolder
in VS Code -
Open the
.vscode/settings.json
, you should see below content:
-
Reset the Intellisense database, you will see the database icon will show up and never disappear.
-
Change the settings.json to below:
The database icon will disappear immediately.
- Change the
**/.*: false
back to**/*: true
. The database icon will show up again immediately and never disappear. And it keeps sayingParsing open files
.
I tried "**/[.]*" : true
. It can match all the hidden files/folders. And it doesn't break symbol parsing.
Could anyone explain why I need to add the [ ]
?
We wrote our own code to do the glob pattern matching (around 3 years ago?) and it has some bugs in cases that were not expected/tested. Also, having hundreds or more patterns in files.exclude is expected to slow down stuff a lot, because the regex matching can be expensive when it's run for every file in several large loops.
So is your workaround sufficient? I'm not sure when we'll have time to fix this.
@sean-mcmanus
Thanks for your reply.
In my two reproduces above, I just put one single pattern in the files.exclude. That is "**/.*" : true
.
As to the workaround, I am still evaluating it.
I guess it may be not difficult to find the root cause in code. Maybe just debug through below 2 scenarios for the files.exclude
:
"**/.*" : true
(the bad one)"**/[.]*" : true
(the seemingly good one)
If you are still seeing this issue, please let us know. I just tried both scenarios and they appear to work as expected for me.