microsoft / microsoft/vscode-cpptools
Make constraint based auto-complete work with alias declarations.
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
Environment
OS and Version: Ubuntu 23.04
VS Code Version: 1.79.0
C/C++ Extension Version: 1.16.3
This should be the last of my issues. I'm putting the finishing touches on my code base and this is the last of the low hanging issues with how autocomplete and intellisense work with my concept system. Really great work so far, btw. I think the autocomplete should document my library nicely.
The following is a minimal example of what I mean
template <typename Type>
concept HasFoo = requires(Type &type) {
type.foo();
};
struct T {
void foo () {}
};
template <HasFoo Type>
struct Foo {
using T = Type;
Foo () {
T x;
Type y;
// T will autocomplete `foo()`, x will NOT
}
};
int main () {
Foo<T> a{};
}
The name T cannot be associated to anything other than Type, which will have foo() suggested for it. However this suggestion does not appear after T x.
template <typename Types>
concept HasReal = requires(typename Types::Real &real) {
real.reduce();
};
struct T {
struct Real {
void reduce () {}
};
};
template <HasReal Types>
struct Foo {
using R = typename Types::Real x;
Foo () {
R x;
typename Types::Real y;
}
};
int main () {
Foo<T>();
}
This is another example of the auto complete not working as expected. It will work for typename Types::Real y but not R x.
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 reproducing the two minimal C++ examples, focusing on autocomplete and IntelliSense for concept-constrained types and alias declarations. Compare completion for the direct type declarations with the aliases; done means aliases such as T and R provide the same member suggestions as their underlying types.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, typescript, vscode
- Domain
- devtools
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100