Closed takaeda closed 3 weeks ago
@ueno Thanks for the feedback! I believe I've reworked the implementation based on your suggestion.
The new implementation uses an array of "completion sources," which eliminates the need for predefined ordering combinations and makes it easier to add non-dictionary sources in the future.
Main updates:
CompletionSource
and DictCompletionSource
classesCompletionService
to manage multiple completion sourcesset_completion_order
method in Context
State
class now uses the new completion serviceI've updated the PR description. Please let me know if you have any further feedback or suggestions.
@ueno Thank you for your positive feedback and for merging the changes. I'd be happy to work on adding unit tests for the new API in the near future.
Overview
This PR introduces a feature to libskk that allows customization of the completion candidate order from various sources, including user dictionary and system dictionary.
Implementation Details
Added
CompletionSource
abstract class:get_completions
method andpriority
propertyAdded
DictCompletionSource
class:CompletionSource
to provide completion candidates from dictionariesAdded
CompletionService
class:CompletionSource
instancesAdded new method to the
Context
class:set_completion_order
: Allows customization of completion order for normal and abbreviation modesUpdated the
State
class:CompletionService
for retrieving completion candidatesDefault Completion Order
The default completion order for both normal mode and abbreviation mode is set to prioritize user dictionary completions over system dictionary completions.
How to Change Completion Order
Users can change the completion order by using the
set_completion_order
method of theContext
class. For example:In this example, completion candidates from the user dictionary (priority 20) will be shown before those from the system dictionary (priority 10).
Testing Environment and Procedure
Environment
Test Procedure
The feature was tested using the following procedure:
Obtain the source code:
This expands to
libskk-1.0.5
.Update the modified files: Copy the modified
state.vala
,context.vala
,completion.vala
andMakefile.am
in libskk tolibskk-1.0.5/libskk/
.Build the package:
Install the built packages:
Restart fcitx5 to apply the changes.
This testing procedure ensures that the changes are properly integrated into the existing libskk package and work correctly with fcitx5-skk.
Related Issue
74
Acknowledgements
Thanks to the original author and maintainers of libskk for their great work.
Your review and feedback are appreciated.