microsoft / microsoft/vscode-cpptools

Using dot '.' as member access operator fails to trigger auto completion/intellisense when used inside macro.

Open
#14,604 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug Feature: Auto-complete 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: Windows 10
  • VS Code Version: 1.108.2
  • C/C++ Extension Version: 1.32.2
  • If using SSH remote, specify OS of remote machine: none
Bug Summary and Steps to Reproduce

Bug Summary:
There is a feature that allows to type '.' as access member operator on any type to show completion window with all members and then it resolves to '.' or '->' automatically.
This feature fails when used inside macro call.

Steps to reproduce:

  1. Paste code (file.hpp):
#define myMacro(value) 

struct MyStruct
{
    int value;
};

struct Container
{
    int value2;
    MyStruct *myStruct;
};

void func(Container *container)
{
    myMacro(container.                         // <- problem here
}
  1. Go to 'func' function and type in 'myMacro(container'
  2. Now when we type access member operator '.' normally popup with suggestions should appear - but it doesn't.
  3. Instead of '.' type '->' - suggestions appear.

Expected behavior:
After typing '.' in macro call we should see suggestions with struct members just like after typing '->'.
'Trigger Suggest' command (CTRL+SPACE) doesn't work on '.' but works after '->' when used in macro call.

Configuration and Logs
ask for more details
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 issue in file.hpp using VS Code 1.108.2 and the C/C++ extension 1.32.2, starting with the macro call in func and comparing '.' with '->'. Trace the completion behavior for member access inside macro arguments; done means '.' opens the same member suggestions as '->', including when Trigger Suggest is invoked.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, typescript, vscode
Domain
developer-experience, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.