refactor: simplify rime proto conversion#1926
Merged
WhiredPlanck merged 1 commit intoosfans:developfrom Feb 9, 2026
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR refactors Trime’s Rime “proto” data flow by removing the old proto.(h|cc) conversion layer and switching JNI↔Kotlin conversions to use the librime C API structs directly, alongside new top-level Kotlin *Proto data classes.
Changes:
- Remove legacy
proto.h/proto.ccand replace with lightweight C++*Protohelper types inhelper-types.h. - Update JNI to build
CommitProto/ContextProto/StatusProtofromrime->get_*()results and convert them to JVM objects viaobjconv.h. - Replace Kotlin usages of nested
RimeProto.*types with top-levelCommitProto/CompositionProto/MenuProto/StatusProto/ContextProto.
Reviewed changes
Copilot reviewed 22 out of 22 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| app/src/main/jni/librime_jni/rime_jni.cc | Switch JNI output getters to construct new *Proto objects via librime C API and convert to Java objects. |
| app/src/main/jni/librime_jni/proto.h | Deleted legacy proto model + conversion function declarations. |
| app/src/main/jni/librime_jni/proto.cc | Deleted legacy conversion implementations using librime internal C++ APIs. |
| app/src/main/jni/librime_jni/objconv.h | Update object conversion helpers to accept new *Proto C++ types and map to new JVM class names. |
| app/src/main/jni/librime_jni/jni-utils.h | Update cached JNI class lookups/signatures to use new top-level Kotlin *Proto classes. |
| app/src/main/jni/librime_jni/helper-types.h | Add new C++ CommitProto/ContextProto/StatusProto etc. built from librime C API structs. |
| app/src/main/jni/librime_jni/frontend.h / frontend.cc | Extract rime_get_highlighted_candidate_index into a small “frontend” helper. |
| app/src/main/java/com/osfans/trime/core/RimeProto.kt | Replace class RimeProto { ... } nested types with top-level *Proto data classes. |
| app/src/main/java/com/osfans/trime/core/RimeMessage.kt | Update message payload types/casts to new *Proto classes. |
| app/src/main/java/com/osfans/trime/core/RimeApi.kt | Update cached type declarations to new *Proto types. |
| app/src/main/java/com/osfans/trime/core/Rime.kt | Update external JNI method return types and internal handling to new *Proto types. |
| app/src/main/java/com/osfans/trime/ime/**.kt (multiple) | Replace imports and parameter types from RimeProto.* to *Proto. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
3b1672e to
6b0447f
Compare
6b0447f to
718bd25
Compare
Bambooin
approved these changes
Feb 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull request
Issue tracker
Fixes will automatically close the related issues
Fixes # N/A
Feature
Describe features of this pull request
Code of conduct
Code style
make sytle-lintBuild pass
make debugManually test
Code Review
Daily build
Login and download artifact at https://github.com/osfans/trime/actions
Additional Info