Skip to content

C_Cpp.files.exclude doesn't work with C_Cpp.caseSensitiveFileSupport "enabled" #12672

@BluTree

Description

@BluTree

Environment

  • OS and Version: W11 22631.4037
  • VS Code Version: 1.92.2
  • C/C++ Extension Version: 1.22.2

Bug Summary and Steps to Reproduce

Bug Summary:
When trying to exclude some files from the code analysis by using "C_Cpp.codeAnalysis.exclude", the warnings remain.
I tried different configurations, by writing folder/, or ${workspaceFolder}/folder/, but nothing works.
The description of the setting explains it inherits from "files.exclude" and "C_Cpp.files.exclude", but while the "files.exclude" correctly hides the file from the Explorer view and the search, the analysis of the file keeps running.

Steps to reproduce:

  1. Create a folder, put a file raising clang-tidy warnings, like :
void func()
{
	int* n = 0;
	*n = 0;
}
  1. Add in the settings.json:
"C_Cpp.codeAnalysis.exclude": {
    "folder/**":true
}
  1. Notice the clang-tidy warning still displayed, even after a window reload

Expected behavior:
The excluded files should not be checked by the code analysis.

Configuration and Logs

-------- Diagnostics - 8/31/2024, 8:47:48 PM
Version: 1.22.2
Current Configuration:
{
    "name": "Win32",
    "includePath": [
        "c:/Dev/Sources/C++ tests/**"
    ],
    "defines": [
        "_DEBUG",
        "UNICODE",
        "_UNICODE"
    ],
    "cStandard": "c17",
    "intelliSenseMode": "windows-clang-x64",
    "cppStandard": "c++17",
    "intelliSenseModeIsExplicit": false,
    "cStandardIsExplicit": false,
    "cppStandardIsExplicit": true,
    "mergeConfigurations": false,
    "compilerPath": "C:\\Dev\\LLVM\\bin\\clang.exe",
    "compilerPathIsExplicit": true,
    "browse": {
        "path": [
            "c:/Dev/Sources/C++ tests/**",
            "${workspaceFolder}"
        ],
        "limitSymbolsToIncludedHeaders": true
    }
}
Modified Settings:
{
    "C_Cpp.default.compilerPath": "C:\\Dev\\LLVM\\bin\\clang.exe",
    "C_Cpp.default.cppStandard": "c++17",
    "C_Cpp.exclusionPolicy": "checkFilesAndFolders",
    "C_Cpp.files.exclude": {
        "**/.vscode": true,
        "**/.vs": true,
        "folder/test.c": true
    },
    "C_Cpp.formatting": "clangFormat",
    "C_Cpp.doxygen.generateOnType": false,
    "C_Cpp.codeAnalysis.exclude": {
        "${workspaceFolder}/folder/**": true
    },
    "C_Cpp.codeAnalysis.clangTidy.enabled": true,
    "C_Cpp.codeAnalysis.clangTidy.path": "C:\\Dev\\LLVM\\bin\\clang-tidy.exe",
    "C_Cpp.intelliSenseMemoryLimit": 16384,
    "C_Cpp.loggingLevel": "Debug",
    "C_Cpp.experimentalFeatures": "enabled",
    "C_Cpp.caseSensitiveFileSupport": "enabled"
}
Additional Tracked Settings:
{
    "editorTabSize": 4,
    "editorInsertSpaces": false,
    "editorAutoClosingBrackets": "languageDefined",
    "filesEncoding": "utf8",
    "filesAssociations": {
        "*.sln": "xml",
        "log": "log",
        "iostream": "cpp"
    },
    "filesExclude": {
        "**/.git": true,
        "**/.svn": true,
        "**/.hg": true,
        "**/CVS": true,
        "**/.DS_Store": true,
        "**/Thumbs.db": true,
        "folder/**": true
    },
    "filesAutoSaveAfterDelay": false,
    "editorInlayHintsEnabled": true,
    "editorParameterHintsEnabled": true,
    "searchExclude": {
        "**/node_modules": true,
        "**/bower_components": true,
        "**/*.code-search": true
    },
    "workbenchSettingsEditor": "ui"
}
cpptools version (native): 1.22.2.0
Translation Unit Mappings:
[ C:\Dev\Sources\C++ tests\folder\test.c - source TU]:
Translation Unit Configurations:
[ C:\Dev\Sources\C++ tests\folder\test.c ]
    Process ID: 30248
    Memory Usage: 59 MB
    Compiler Path: C:\Dev\LLVM\bin\clang.exe
    Includes:
        C:\Dev\Sources\C++ tests
        C:\Dev\Sources\C++ tests\folder
        C:\Dev\Sources\C++ tests\src
    System Includes:
        C:\Dev\LLVM\lib\clang\18\include
        C:\Dev\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.41.34120\include
        C:\Dev\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.41.34120\atlmfc\include
        C:\Windows Kits\10\Include\10.0.22621.0\ucrt
        C:\Windows Kits\10\Include\10.0.22621.0\shared
        C:\Windows Kits\10\Include\10.0.22621.0\um
        C:\Windows Kits\10\Include\10.0.22621.0\winrt
        C:\Windows Kits\10\Include\10.0.22621.0\cppwinrt
    Defines:
        _DEBUG
        UNICODE
        _UNICODE
    Standard Version: c17
    IntelliSense Mode: windows-clang-x64
    Other Flags:
        --clang
        --clang_version=180108
        --ms_compatibility
Total Memory Usage: 59 MB

------- Workspace parsing diagnostics -------
Number of files discovered (not excluded): 5398

Other Extensions

No response

Additional context

No response

Metadata

Metadata

Assignees

Labels

Language ServiceVerified - InternalVerified issue reproducesbugfixedCheck the Milestone for the release in which the fix is or will be available.regressionA bug that didn't exist in a previous release

Type

No type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions