microsoft / microsoft/vscode-cpptools

Rename Symbol includes unrelated files from include path

Aperta
#4,766 1 commento 8 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

bug Feature: Find All References Feature: Rename Language Service verified Works in VS
Lingua principale
TypeScript
Stelle
6.2k
Fork
1.7k
Merge medio
14h 46m
PR unite (30g)
61

Descrizione

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)

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia riproducendo il comportamento di Rename Symbol con l’esempio main.cpp fornito e con le versioni segnalate di VS Code e dell’estensione C/C++. Traccia il modo in cui Rename Symbol gestisce la definizione locale di Tag e l’occorrenza non correlata in /usr/include/google/protobuf/parse_context.h, quindi verifica che i file non correlati vengano esclusi o inseriti in Candidates for Rename invece che in Confirmed Rename.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
cpp, typescript, vscode
Ambito
developer-experience, tooling
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
42/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.