microsoft / microsoft/vscode-cpptools

Function pointer variables should be colorized as functions when they're called.

Aperta
#13,015 1 commento 1 reazione 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

bug Feature: Colorization Language Service Visual Studio
Lingua principale
TypeScript
Stelle
6.2k
Fork
1.7k
Merge medio
14h 46m
PR unite (30g)
61

Descrizione

Environment
  • OS and Version: NixOS 24.11
  • VS Code Version: 1.94.2
  • C/C++ Extension Version: 1.22.2
  • If using SSH remote, specify OS of remote machine: N/A
Bug Summary and Steps to Reproduce

Bug Summary:
Executing a function call from a function pointer has mostly the same relevance as any normal function call; as such it should be colorized in a similar way.

Minimal example: Image
Note how the syntactic token type is easily detected thanks to the parentheses (and is identified as "entity.name.function.c" for the bare function pointer and as "entity.name.function.member.c" for the function pointer struct member), but the semantic analyzer ignores this particular property

Steps to reproduce:

  1. Define a function in a C or C++ file;
  2. Place the functions' address in a function pointer variable;
  3. Call the function from the variable.

Expected behavior:
In the above screenshot, the text f on line 11 and ptr on line 12 should be colorized as func on line 10 is (i.e. purple)

Configuration and Logs
No "c_cpp_properties.json" present
Diagnostic logs: https://pastebin.com/nRDFDEKL
LSP logs: https://pastebin.com/Z0iZDQ56
Other Extensions

No response

Additional context

No response

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

Riproduci l'esempio in un file C o C++ e analizza la gestione delle chiamate tramite puntatori a funzione da parte dell'analizzatore semantico, usando come contesto i log di diagnostica e LSP collegati. Il lavoro è completato quando la variabile chiamata f e il membro della struct ptr ricevono la stessa colorazione delle funzioni di func.

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

Valutazione

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

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.