Page MenuHomePhabricator

[clangd] Prototype for postfix completion.
Needs ReviewPublic

Authored by hokein on Jun 2 2020, 1:42 AM.
This revision needs review, but there are no reviewers specified.



This is a quick proof-of-concept demo for postfix completion.

demo (ignore the wrong highlightings in VSCode):

The big question: Where should we implement? in clangd, or in Sema?

Diff Detail

Event Timeline

hokein created this revision.Jun 2 2020, 1:42 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 2 2020, 1:42 AM
hokein edited the summary of this revision. (Show Details)Jun 2 2020, 1:45 AM
sammccall added a comment.EditedJun 2 2020, 3:33 AM


The big question: Where should we implement? in clangd, or in Sema?

Advantages of Sema:

  • better access to AST/context so more flexible
  • available to tools other than clangd

Advantages of clangd:

  • fewer layer of abstraction to traverse
  • access to the index, config etc
  • more comfortable making calls about how much to assume about stdlib etc
  • maybe a bit easier to understand/test (depends on what you're used to)

We could get access to the index or other things from clangd by adding a hook to provide these "extended" member completions, and having clangd implement it... Not sure if that's best or worst of both worlds.

One question with Sema is how to make it produce the right text edit. Can we model it as a RK_Pattern completion with a typo fix to delete the foo. before the if?

This choice would be clearer if we had a set of examples we wanted to implement. If it's just if/for, then Sema seems like the right call...