refactor: extract CommandHandler from GeneralKeyboardIME (Part 14) - #426 - #689
refactor: extract CommandHandler from GeneralKeyboardIME (Part 14) - #426#689prince-0408 wants to merge 1 commit into
Conversation
|
Thanks so much for this, @prince-0408! It would be really helpful to maybe get a checklist in the issue of all of the work that you would say is left in order to close this issue. This should include all the current PRs that are open and all the subtasks of the original task. In this way we can keep in mind what we have left to do and maybe set a goal to close the original issue, as I feel like its scope is getting a bit out of bounds. Appreciate your continued efforts here! |
|
@prince-0408 The 7 methods widened to internal here are adding up across the extraction PRs would it be worth defining an explicit interface that handlers receive instead, so the contract doesn't silently grow? |
Hey @Roniscend Very true indeed. Passing the entire Having an explicit interface contract (e.g. As we are close to the end of the extraction process (Part 15 is the last component), we could either define this explicit interface contract among the handlers in Part 15 or in a subsequent PR immediately after Part 15. This will ensure that handlers strictly follow the interface without any delays in current modularization PRs. Do let me know your thoughts on this approach. |
|
@prince-0408 do the interface contract in a dedicated PR right after Part 15, not inside it, so it stays a clean, focused diff across all handlers. |
This sounds good! In Part 15, I will ensure that the only thing done is extraction of |
Description
This PR is Part 14 in modularizing GeneralKeyboardIME for #426.
It extracts command execution logic (
handleKeycodeEnter), translation and plural lookup result handling (handlePluralOrTranslateState), verb conjugation query dispatching (handleConjugateState), standard editor action execution (handleDefaultEnter), and result output committing (applyCommandOutput) out ofGeneralKeyboardIME.ktinto a standalone helper classCommandHandler.Detailed Changes Table
CommandHandler.kthandleKeycodeEnter), command lookup result processing (handlePluralOrTranslateState,handleConjugateState), standard editor action execution (handleDefaultEnter), and output result committing (applyCommandOutput).GeneralKeyboardIME.ktinto a dedicated helper class.GeneralKeyboardIME.ktcommandHandlerand delegated command methods (handleKeycodeEnter,applyCommandOutput). Updated helper visibilities (getPluralRepresentation,getTranslation,refreshUI,applyCapitalizationToConjugations,currentVerbForConjugation,conjugateOutput,conjugateLabels) tointernal.GeneralKeyboardIME.ktwhile maintaining 100% backward compatibility for all callers.CommandHandlerTest.ktCHANGELOG.md### ♻️ Code Refactoringdetailing the extraction ofCommandHandlerfromGeneralKeyboardIME.ci_changelog_checkworkflow requirement for pull requests targetingmain.Key Benefits
GeneralKeyboardIME.kt.Related Issue
Refactors part of #426