[clang] [libclang/python] Add type annotations for code completion classes (PR #140539)
Jannick Kremer via cfe-commits
cfe-commits at lists.llvm.org
Mon May 19 06:30:04 PDT 2025
================
@@ -3051,6 +3053,7 @@ def isKindResultType(self):
class CompletionString(ClangObject):
class Availability:
----------------
DeinAlptraum wrote:
I did not annotate this class because it isn't used. I assume the `availability` property accessing `availabilityKinds` was supposed to use that, but `availabilityKinds` uses the `CompletionChunk.Kind` class: https://github.com/llvm/llvm-project/blob/91a7085faf268b595e597fa2a2b979ca7b8de0a8/clang/bindings/python/clang/cindex.py#L3109-L3114
So either the `CompletionString.Availability` class should be removed, or actually used for that. This would be a breaking change technically (if anyone checks the type of the returned kind object or its `repr`) but otherwise these two classes have the same interface anyway.
Could also be changed to either some common class or use Python's builtin Enum class.
https://github.com/llvm/llvm-project/pull/140539
More information about the cfe-commits
mailing list