[clang] Use existing AvailabilityKind enum for code completion availability (PR #160296)

Jannick Kremer via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 23 06:48:43 PDT 2025


DeinAlptraum wrote:

@Endilll about `CompletionChunk.Kind`, you wrote in the issue that we should
> preserve convertibility of the new enum to the same strings users get today (e.g. "CurrentParameter"), so that nothing breaks for the current users of CompletionChunk.kind;

This is not entirely possible: since we want to switch to returning the proper `AvailabilityKind` enum variants rather than this replication building on `CompletionChunk.Kind` that we've had so far, we cannot control how this is printed: the result of `CompletionString.availability` will of course print the same as our other enums, leading to the following differences:
``` 
      __str__                         __repr__
Old   NotAccessible                   <ChunkKind: NotAccessible>
New   AvailabilityKind.NOT_ACCESSIBLE AvailabilityKind.NOT_ACCESSIBLE
``` 

As mentioned above, I changed the `__repr__` of `CompletionString` to adapt the spelling of `AvaialabilityKind` so it still prints the same as before, but I'm not sure that keeping just this part the same as before really makes this much better... what do you think?

https://github.com/llvm/llvm-project/pull/160296


More information about the cfe-commits mailing list