Skip to content

Rename Symbol includes unrelated files from include path #4766

@Seneral

Description

@Seneral

Type: LanguageService

Describe the bug

  • OS and Version: Arch Linux Manjaro
  • VS Code Version: 1.41.0 Microsoft Branded from AUR
  • C/C++ Extension Version: latest 0.26.2
  • Short Description: Rename Symbol command can put out-of-scope, non-related files from the include path into the Confirmed Rename (Pending Rename) section. NOT tested if it actually performs the rename, but if it did, it would break other programs relying on it.

To Reproduce

  1. Open brand new folder (no include paths, cpp_properties, etc. needed) and create main.cpp with:
struct Tag {};
int main() { return 0; }
  1. Rename Symbol on Tag (probably works on other common names as well)
  2. Provided name was common enough, VSCode will default to modifying files in the include path. For Tag, it will attempt to replace in /usr/include/google/protobuf/parse_context.h:
template <typename Tag, typename T>
PROTOBUF_MUST_USE_RESULT const char* ReadRepeatedFixed(const char* ptr, Tag expected_tag, RepeatedField<T>* out);

Note in this instance it would probably not break anything as it is a local name.

Expected behavior

VSCode C/C++ Rename detects that occurance is unrelated to the local definition and puts it into "Candidates for Rename" at best.

Screenshots

Screenshot_2019-12-19_00-25-02
(In context of project, but tested with provided example as well)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    No status

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions