-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
Feature Request
If I have a datum, say a, if I type a., I want autocomplete to list functions that can take a as their first argument.
This is somewhat similar to how, if I have a pointer called b, typing b. will list *b's fields even though the syntax for that should be b->. This FR allows me to know more of what I can do with x by typing x. than I currently can.
For example: say I have a FILE *f. Typing f. should allow autocomplete to show me fprintf, fclose, etc., since those take FILE *s as their first arguments.
This could be extended to pointers. Perhaps if I have an int *a and a void b(int), typing a. or a-> could bring up b. Then, pressing Tab automatically fills in b(*a);.
Or, perhaps it could work the other way. If I have an int a and a void b(int *), typing a. could bring up b, and pressing Tab could fill in b(&a);. (This feature is perhaps more important than the previous, at least for my application.)
This should also work for function macros which expand to functions meant to take those arguments. Two examples of this from my codebase:
#define __LVIter_peekType(_1, NAME, ...) NAME
#define LVIter_peekType(this, ...) __LVIter_peekType(__VA_ARGS__ __VA_OPT__(,) fMHui3hFugti, vZModmIDU962)(this ## __VA_OPT__(,) __VA_ARGS__)#define applyScalingFactor(value) _Generic(value, uint32_t *: GyBqsQpU8scP, long int *: Z31WPMv7S2e9)(value)These ones are pretty complex, but are realistic. The parser already colours fMHui3hFugti and vZModmIDU962 as functions even though they are declared using those macros (funnily enough, it doesn't properly colour fMHui3hFugti since it doesn't know what __VA_OPT__ means):
__always_inline TokenType LVIter_peekType(const LVIter *const restrict this);
TokenType LVIter_peekType(const LVIter *const restrict this, uint32_t ahead);