microsoft / microsoft/vscode-cpptools

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

Open
#13,015 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug Feature: Colorization Language Service Visual Studio
Dominant language
TypeScript
Stars
6.2k
Forks
1.7k
Avg merge
14h 46m
Merged PRs (30d)
61

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the example in a C or C++ file and inspect the semantic analyzer's handling of function-pointer calls, using the linked diagnostic and LSP logs for context. Done means the called variable f and struct member ptr receive the same function colorization as func.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, vscode
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.