[PATCH] D41537: Optionally add code completion results for arrow instead of dot

Ilya Biryukov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 20 08:13:10 PST 2018


ilya-biryukov added a comment.

Sorry for not getting back on this earlier.

I wanted to discuss whether returning correction as a enum value is a proper interface for users of `libclang`.
It seems easy to replace `.` with `->` inside clang, properly handling all the tricky cases (tokens coming from macro substitution, etc)  and making sure it's a viable option (again, macro substitutions may make it non-viable).
And even though it's not hard to implement things like "replace . with ->" for any particular editor, we still need to do that for **every** small correction that may we want to add to the completion in **every** editor.

I propose to return something similar to a `FixItHint` from `Diagnostic.h`, i.e. description of a simple text edit that should be applied before inserting the completion identifier. In that case, we may hope that every editor will implement the corrections once, and we could add more features into code completions that will be immediately picked up by all the editors that support it.
WDYT?


https://reviews.llvm.org/D41537





More information about the cfe-commits mailing list