Skip to content

refactor: simplify rime proto conversion#1926

Merged
WhiredPlanck merged 1 commit intoosfans:developfrom
WhiredPlanck:refactor
Feb 9, 2026
Merged

refactor: simplify rime proto conversion#1926
WhiredPlanck merged 1 commit intoosfans:developfrom
WhiredPlanck:refactor

Conversation

@WhiredPlanck
Copy link
Collaborator

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

Build pass

  • make debug

Manually test

  • Done

Code Review

  1. No wildcards import
  2. Manual build and test pass
  3. GitHub Action CI pass
  4. At least one contributor review and approve
  5. Merged clean without conflicts
  6. PR will be merged by rebase upstream base

Daily build

Login and download artifact at https://github.com/osfans/trime/actions

Additional Info

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.cc and replace with lightweight C++ *Proto helper types in helper-types.h.
  • Update JNI to build CommitProto/ContextProto/StatusProto from rime->get_*() results and convert them to JVM objects via objconv.h.
  • Replace Kotlin usages of nested RimeProto.* types with top-level CommitProto/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.

@WhiredPlanck WhiredPlanck force-pushed the refactor branch 3 times, most recently from 3b1672e to 6b0447f Compare February 8, 2026 11:06
@WhiredPlanck WhiredPlanck merged commit 2707bf1 into osfans:develop Feb 9, 2026
3 checks passed
@WhiredPlanck WhiredPlanck deleted the refactor branch February 9, 2026 16:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants