microsoft / microsoft/vscode-cpptools
Display completion items for member variables sorted in declaration order
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 6.2k
- Forks
- 1.7k
- Avg merge
- 14h 46m
- Merged PRs (30d)
- 61
Description
Feature Request
C++20 has released designated initializers which enables the initialization of data as follows:
struct Foo { int b; char a; };
Foo foo{ .b = 3, .a = 's' };
Note that the initialization of designated members must be listed in declaration order (first b, then a). This is a strict error, not a warning and this behavior can only be disabled in clang (not GCC or MSVC).
The issue is that when the extension provides completion items, it will list members in alphabetical order (i.e. first a, then b in this example). This forces the user to inspect the declaration site to determine if they have the order correct (or get hit with a compiler error long after).
As for severity, this issue has a dramatic impact on usability of this feature. The example shown here is a small struct, but consider structs such as VkPhysicalDeviceFeatures with dozens upon dozens of non-alphabetized fields. In production code, big bags of data or state bits such as these are common, and having declaration-order listings of completion items would be a dramatic productivity boost.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the completion-item implementation and related tests in vscode-cpptools; the payload does not name specific files or entry points. Reproduce the C++20 designated-initializer example and verify that member completions follow declaration order rather than alphabetical order.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, typescript
- Domain
- developer-experience, tooling
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100