Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Completion support with C++ #7

Closed
kiwichris opened this issue Sep 12, 2023 · 2 comments
Closed

Completion support with C++ #7

kiwichris opened this issue Sep 12, 2023 · 2 comments

Comments

@kiwichris
Copy link

I would like to be able to use completion support with C++ however the completion callback does not have a user argument. If I could pass the this pointer of an object as user data I could integrate completion into my C++ program.

I am thinking about adding a new callback type and call to maintain backwards compatibility:

typedef void (*crossline_user_completion_callback) (void* user, const char *buf, crossline_completions_t *pCompletions);
extern void  crossline_user_completion_register (crossline_user_completion_callback pCbFunc, void* user);

If a crossline_user_completion_callback is registered it is called else the crossline_completion_callback is called if registered.

Would you be interested in a pull request for such a change?

@jcwangxp
Copy link
Owner

In fact, the callback prototype is copied from famous linenoise.h
As you can only register one callback, if you want to pass extra arg, you can use a static or global variable and refer it in the callback.

@jcwangxp jcwangxp closed this as not planned Won't fix, can't repro, duplicate, stale Sep 26, 2023
@kiwichris
Copy link
Author

Thanks for getting back to me. I would prefer not to use statics. The change would not change the existing interface, it would add a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants