microsoft / microsoft/vscode-cpptools
Rename Symbol includes unrelated files from include path
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- TypeScript
- Sterne
- 6.2k
- Forks
- 1.7k
- Ø Merge
- 14 Std. 46 Min.
- Gemergte PRs (30 T.)
- 61
Beschreibung
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
- Open brand new folder (no include paths, cpp_properties, etc. needed) and create main.cpp with:
struct Tag {};
int main() { return 0; }
- Rename Symbol on Tag (probably works on other common names as well)
- 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

(In context of project, but tested with provided example as well)
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginnen Sie damit, das Verhalten von Rename Symbol anhand des bereitgestellten main.cpp-Beispiels mit den gemeldeten Versionen von VS Code und der C/C++-Erweiterung zu reproduzieren. Verfolgen Sie, wie Rename Symbol die lokale Tag-Definition und das nicht verwandte Vorkommen in /usr/include/google/protobuf/parse_context.h behandelt, und überprüfen Sie anschließend, dass nicht verwandte Dateien ausgeschlossen oder unter Candidates for Rename statt Confirmed Rename eingeordnet werden.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- cpp, typescript, vscode
- Bereich
- developer-experience, tooling
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 42/100