Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Glob pattern "**/.*" in "files.exclude" breaks the symbol resolution #4063

Closed
smwikipedia opened this issue Aug 11, 2019 · 7 comments
Closed
Labels
bug investigate: repro This issue's repro steps needs to be investigated/confirmed Language Service
Milestone

Comments

@smwikipedia
Copy link

smwikipedia commented Aug 11, 2019

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...

image

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

@smwikipedia
Copy link
Author

smwikipedia commented Aug 11, 2019

Well, it seems the root cause is I added below highlighted "**/.*" : true to the settings.json.

image

Adding this line will cause the database icon never disappear:

image

And when I hover the mouse over it, it just says "Parsing open files". No percentage show.

image

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?

@smwikipedia smwikipedia changed the title files.exclude in settings.json greatly slow down the file parsing progress. Glob pattern "**/.*" in files.exclude in settings.json hangs the file parsing progress. Aug 12, 2019
@smwikipedia smwikipedia changed the title Glob pattern "**/.*" in files.exclude in settings.json hangs the file parsing progress. Glob pattern "**/.*" in "files.exclude" causes the "Parsing open files" last forever. Aug 12, 2019
@smwikipedia
Copy link
Author

smwikipedia commented Aug 12, 2019

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".)

  1. Create a folder named glob, it contains 3 files and a .vscode folder.
    image

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:
image

(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
    }
}
  1. Open the glob folder in VS Code.

  2. Reset the intellisense database. (<======== DO NOT SKIP THIS )

  3. Open main.c, press F12 on func() 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
    }
}
  1. Change the "**/.*": true to "**/.*": false, or delete it.

  2. Reset the Intellisense database. (<======== DO NOT SKIP THIS )

  3. Open main.c, press F12 on func() 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)

@smwikipedia smwikipedia changed the title Glob pattern "**/.*" in "files.exclude" causes the "Parsing open files" last forever. Glob pattern "**/.*" in "files.exclude" breaks the symbol resolution Aug 12, 2019
@smwikipedia
Copy link
Author

smwikipedia commented Aug 12, 2019

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:

  1. Open the testFolder in VS Code

  2. Open the .vscode/settings.json, you should see below content:
    image

  3. Reset the Intellisense database, you will see the database icon will show up and never disappear.
    image

  4. Change the settings.json to below:

image

The database icon will disappear immediately.

image

  1. Change the **/.*: false back to **/*: true. The database icon will show up again immediately and never disappear. And it keeps saying Parsing open files.

image

@smwikipedia
Copy link
Author

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 [ ] ?

@sean-mcmanus
Copy link
Collaborator

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 sean-mcmanus added bug Language Service more votes needed Issues that have been postponed until more community members upvote it labels Aug 12, 2019
@smwikipedia
Copy link
Author

smwikipedia commented Aug 12, 2019

@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)

@bobbrow bobbrow added investigate: repro This issue's repro steps needs to be investigated/confirmed and removed more votes needed Issues that have been postponed until more community members upvote it labels Mar 12, 2020
@bobbrow bobbrow added this to the Backlog milestone Mar 12, 2020
@bobbrow
Copy link
Member

bobbrow commented Feb 5, 2021

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.

@bobbrow bobbrow closed this as completed Feb 5, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Mar 23, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug investigate: repro This issue's repro steps needs to be investigated/confirmed Language Service
Projects
None yet
Development

No branches or pull requests

3 participants