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

Excludes sometimes aren't applied to dependent headers with recursive includes #12042

Closed
JominL opened this issue Mar 1, 2024 · 4 comments
Closed
Assignees
Labels
bug fixed Check the Milestone for the release in which the fix is or will be available. Language Service quick fix
Milestone

Comments

@JominL
Copy link

JominL commented Mar 1, 2024

Environment

  • OS and Version: WIN11
  • VS Code Version: 1.80.0
  • C/C++ Extension Version: 1.19.4
  • If using SSH remote, specify OS of remote machine: SSH remote ubuntu 20.04

Bug Summary and Steps to Reproduce

Bug Summary:
cpptools alway parse those files and folders even they have been added to exclude.

From below log, you can cpptools still parse cpp under "distro/build".

I also try the vscode inside today, same behavior.

Steps to reproduce:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior:

Configuration and Logs

c_cpp_properties.json
============================
{
    "configurations": [
        {
            "name": "Linux",
            "includePath": [
                "${workspaceFolder}/**"
            ],
            "defines": [],
            "compilerPath": "/usr/bin/clang",
            "cStandard": "c23",
            "intelliSenseMode": "gcc-arm",
            "cppStandard": "gnu++23"
            
        }
        
    ],
    "version": 4
}
======================
.vscode/settings.json
=======================
"C_Cpp.default.cStandard": "gnu23",
    "C_Cpp.default.cppStandard": "gnu++20",
    "ctags.languages": [
        "C",
        "C++",
        "DTS",
        "Kconfig",
        "Make"
    ],
    "C_Cpp.files.exclude": {
        "build":true,
        "tmp/work":true,
        "tmp/work/**":true,
        "**/build":true,
        "**/build/**":true,
        "**/.vscode": true,
        "**/.vs": true
    },
    "C_Cpp.default.intelliSenseMode": "linux-gcc-arm",
    "C_Cpp.default.compilerPath": "",
    "files.exclude": {
        "**/.DS_Store": true,
        "**/.git": true,
        "**/.hg": true,
        "**/.svn": true,
        "**/build": true,
        "**/CVS": true,
        "distro/build": true,
        "**/distro/build/**": true,
        "**/Thumbs.db": true
    },
    "C_Cpp.exclusionPolicy": "checkFilesAndFolders",
    "C_Cpp.loggingLevel": "Debug"
========================================================


loggingLevel: Debug
LSP: (received) cpptools/initialize (id: 1)
LSP: (invoked) cpptools/initialize (id: 1)
cpptools version (TypeScript): 1.19.4
cpptools version (native): 1.19.4.0
Autocomplete is enabled.
Error squiggles are enabled if all header dependencies are resolved.
Hover is enabled.
IntelliSense Engine = default.
LSP: Sending response (id: 1)
LSP: (received) cpptools/queryCompilerDefaults (id: 2)
LSP: (invoked) cpptools/queryCompilerDefaults (id: 2)
LSP: (received) cpptools/didChangeCppProperties (id: 3)
LSP: (received) cpptools/queryCompilerDefaults (id: 4)
Querying compiler for default C++ language standard using command line: /usr/bin/clang -x c++ -E -dM /dev/null
Detected language standard version: c++14
Querying compiler's default target using command line: "/usr/bin/clang" -dumpmachine
Compiler returned default target value: x86_64-pc-linux-gnu
Compiler query command line: /usr/bin/clang -std=c17 -m64 -Wp,-v -fno-blocks -E -dM -x c /dev/null
Attempting to get defaults from C compiler in "compilerPath" property: '/usr/bin/clang'
Compiler query command line: /usr/bin/clang -std=c++14 -m64 -Wp,-v -fno-blocks -E -dM -x c++ /dev/null
Attempting to get defaults from C++ compiler in "compilerPath" property: '/usr/bin/clang'
LSP: Sending response (id: 2)
LSP: (invoked) cpptools/didChangeCppProperties (id: 3)
enabling full-text triggers
Code browsing service initialized
Compiler query command line: /usr/bin/clang -std=gnu++23 -m32 -Wp,-v -fno-blocks -E -dM -x c++ /dev/null
Compiler query command line: /usr/bin/clang -std=gnu++2b -m64 -Wp,-v -fno-blocks -E -dM -x c++ /dev/null
Compiler query command line: /usr/bin/clang -std=gnu++20 -m64 -Wp,-v -fno-blocks -E -dM -x c++ /dev/null
Attempting to get defaults from C++ compiler in "compilerPath" property: '/usr/bin/clang'
Compiler query command line: /usr/bin/clang -std=c23 -m32 -Wp,-v -fno-blocks -E -dM -x c /dev/null
Compiler query command line: /usr/bin/clang -std=c2x -m64 -Wp,-v -fno-blocks -E -dM -x c /dev/null
Attempting to get defaults from C compiler in "compilerPath" property: '/usr/bin/clang'
  Folder: /usr/include/ will be indexed
  Folder: /usr/lib/llvm-10/lib/clang/10.0.0/include/ will be indexed
  Folder: /usr/local/include/ will be indexed
  Folder: /home/myuser/workspace/ will be indexed
LSP: Sending response (id: 3)
LSP: (invoked) cpptools/queryCompilerDefaults (id: 4)
Discovering files...
LSP: Sending response (id: 4)
LSP: (received) cpptools/didChangeCppProperties (id: 5)
LSP: (invoked) cpptools/didChangeCppProperties (id: 5)
LSP: Sending response (id: 5)

LSP: (invoked) cpptools/didChangeVisibleTextEditors
  Processing folder (recursive): /usr/include/
LSP: Sending response (id: 6)
  Processing folder (recursive): /usr/lib/llvm-10/lib/clang/10.0.0/include/
  Processing folder (recursive): /usr/local/include/
  Processing folder (recursive): /home/myuser/workspace/
LSP: (received) cpptools/didChangeVisibleTextEditors
LSP: (invoked) cpptools/didChangeVisibleTextEditors
Database safe to open.
LSP: (received) cpptools/didChangeVisibleTextEditors
LSP: (invoked) cpptools/didChangeVisibleTextEditors
LSP: (received) cpptools/didChangeVisibleTextEditors
LSP: (invoked) cpptools/didChangeVisibleTextEditors
LSP: (received) cpptools/didChangeVisibleTextEditors
LSP: (invoked) cpptools/didChangeVisibleTextEditors
...

  Discovering files: 1335199 file(s) processed
  0 file(s) removed from database
Done discovering files.
Populating include completion cache.
Parsing remaining files...
  tag parsing file: /usr/include/features.h
  tag parsing file: /usr/lib/llvm-10/lib/clang/10.0.0/include/stddef.h
  tag parsing file: /usr/include/time.h
  tag parsing file: /home/myuser/workspace/apps/src/power_control.hpp
  tag parsing file: /home/myuser/workspace/distro/build/target/tmp/work/armv7ahf/usr/include/cjson/cJSON.h
  tag parsing file: /usr/include/x86_64-linux-gnu/sys/sysinfo.h
  tag parsing file: /usr/lib/llvm-10/lib/clang/10.0.0/include/stdbool.h
  tag parsing file: /usr/lib/llvm-10/lib/clang/10.0.0/include/stdint.h
  tag parsing file: /home/myuser/workspace/distro/build/target/tmp/work/armv7ahf/usr/include/systemd/sd-journal.h
  tag parsing file: /home/myuser/workspace/apps/intel/crashdump/engine/logger.h
  tag parsing file: /usr/local/include/boost/asio/io_context.hpp
  tag parsing file: /home/myuser/workspace/distro/build/target/tmp/work/armv7ahf/usr/include/peci.h
  tag parsing file: /usr/local/include/boost/asio/posix/stream_descriptor.hpp
  tag parsing file: /usr/local/include/boost/asio/steady_timer.hpp
  tag parsing file: /usr/local/include/boost/container/flat_map.hpp
  tag parsing file: /usr/include/stdio.h
  tag parsing file: /usr/local/include/boost/container/flat_set.hpp
  tag parsing file: /usr/include/stdlib.h
  tag parsing file: /home/myuser/workspace/distro/build/target/tmp/work/armv7ahf/usr/include/gpiod.hpp
  tag parsing file: /usr/include/string.h

Other Extensions

No response

Additional context

No response

@sean-mcmanus sean-mcmanus self-assigned this Mar 1, 2024
@sean-mcmanus
Copy link
Contributor

sean-mcmanus commented Mar 1, 2024

@JominL This is currently "by design" -- the folder is being excluded for symbol search workspace parsing and the parse file you're seeing is caused by the opening of a file that includes header that references an include in an excluded folder and the usage of ** at the end of your includePath ${workspaceFolder} (recursive includes) -- if you remove the ** it should be "fixed". The recursive includes feature can't function currently unless it parses the file to get the headers used...this might change in an upcoming release though, so that tag parsing might go away as a result.

@sean-mcmanus sean-mcmanus changed the title cpptools can not exclude files/folders Headers found during recursive includes resolving are tag parsed still Mar 1, 2024
@sean-mcmanus sean-mcmanus added Language Service performance enhancement Improvement to an existing feature labels Mar 1, 2024
@sean-mcmanus sean-mcmanus added this to the 1.20 milestone Mar 1, 2024
@sean-mcmanus sean-mcmanus assigned Colengms and unassigned sean-mcmanus Mar 1, 2024
@sean-mcmanus sean-mcmanus assigned sean-mcmanus and unassigned Colengms Mar 1, 2024
@sean-mcmanus sean-mcmanus added bug and removed by design labels Mar 1, 2024
@sean-mcmanus sean-mcmanus added quick fix and removed enhancement Improvement to an existing feature labels Mar 1, 2024
@sean-mcmanus sean-mcmanus assigned Colengms and unassigned sean-mcmanus Mar 1, 2024
@sean-mcmanus sean-mcmanus added enhancement Improvement to an existing feature and removed bug labels Mar 1, 2024
@sean-mcmanus sean-mcmanus assigned sean-mcmanus and unassigned Colengms Mar 1, 2024
@sean-mcmanus sean-mcmanus added bug and removed enhancement Improvement to an existing feature performance labels Mar 1, 2024
@sean-mcmanus sean-mcmanus changed the title Headers found during recursive includes resolving are tag parsed still Tag parsing excludes aren't working in some cases Mar 1, 2024
@sean-mcmanus
Copy link
Contributor

@JominL On further investigation, it seems like this is a bug.

@sean-mcmanus sean-mcmanus changed the title Tag parsing excludes aren't working in some cases Excludes sometimes aren't applied to dependent headers with recursive includes Mar 1, 2024
@sean-mcmanus sean-mcmanus modified the milestones: 1.20, 1.19.5 Mar 1, 2024
@sean-mcmanus sean-mcmanus added the fixed Check the Milestone for the release in which the fix is or will be available. label Mar 1, 2024
@sean-mcmanus
Copy link
Contributor

@JominL
Copy link
Author

JominL commented Mar 7, 2024

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug fixed Check the Milestone for the release in which the fix is or will be available. Language Service quick fix
Projects
None yet
Development

No branches or pull requests

3 participants