@@ -90,30 +90,60 @@ private static CompletionSet CreateNewCompletionSet(CompletionSet completionSet,
9090
9191 private Completion CloneCompletion ( Completion originCompletion )
9292 {
93- return originCompletion switch
93+ if ( originCompletion is ICustomCommit customCommitter )
9494 {
95- Completion4 completion4 => completion4 . Suffix ? . Length > 0
96- ? new IdeographCompletion4 ( displayText : completion4 . DisplayText , suffix : completion4 . Suffix , origin : completion4 )
97- : new IdeographCompletion4 ( displayText : completion4 . DisplayText , origin : completion4 ) ,
98- Completion3 completion3 => new IdeographCompletion3 ( displayText : completion3 . DisplayText , origin : completion3 ) ,
99- Completion2 completion2 => new IdeographCompletion2 ( displayText : completion2 . DisplayText , origin : completion2 ) ,
100- _ => new IdeographCompletion ( displayText : originCompletion . DisplayText , origin : originCompletion ) ,
101- } ;
95+ return originCompletion switch
96+ {
97+ Completion4 completion4 => completion4 . Suffix ? . Length > 0
98+ ? new IdeographCustomCommitCompletion4 ( displayText : completion4 . DisplayText , suffix : completion4 . Suffix , origin : completion4 , customCommitter : customCommitter )
99+ : new IdeographCustomCommitCompletion4 ( displayText : completion4 . DisplayText , origin : completion4 , customCommitter : customCommitter ) ,
100+ Completion3 completion3 => new IdeographCustomCommitCompletion3 ( displayText : completion3 . DisplayText , origin : completion3 , customCommitter : customCommitter ) ,
101+ Completion2 completion2 => new IdeographCustomCommitCompletion2 ( displayText : completion2 . DisplayText , origin : completion2 , customCommitter : customCommitter ) ,
102+ _ => new IdeographCustomCommitCompletion ( displayText : originCompletion . DisplayText , origin : originCompletion , customCommitter : customCommitter ) ,
103+ } ;
104+ }
105+ else
106+ {
107+ return originCompletion switch
108+ {
109+ Completion4 completion4 => completion4 . Suffix ? . Length > 0
110+ ? new IdeographCompletion4 ( displayText : completion4 . DisplayText , suffix : completion4 . Suffix , origin : completion4 )
111+ : new IdeographCompletion4 ( displayText : completion4 . DisplayText , origin : completion4 ) ,
112+ Completion3 completion3 => new IdeographCompletion3 ( displayText : completion3 . DisplayText , origin : completion3 ) ,
113+ Completion2 completion2 => new IdeographCompletion2 ( displayText : completion2 . DisplayText , origin : completion2 ) ,
114+ _ => new IdeographCompletion ( displayText : originCompletion . DisplayText , origin : originCompletion ) ,
115+ } ;
116+ }
102117 }
103118
104119 private Completion CreateCompletion ( Completion originCompletion , string originInsertText , string spelling )
105120 {
106121 var displayText = FormatString ( Options . SyncCompletionDisplayTextFormat , spelling , originInsertText ) ;
107122
108- return originCompletion switch
123+ if ( originCompletion is ICustomCommit customCommitter )
109124 {
110- Completion4 completion4 => completion4 . Suffix ? . Length > 0
111- ? new IdeographMatchableCompletion4 ( displayText : displayText , suffix : completion4 . Suffix , matchText : spelling , origin : completion4 )
112- : new IdeographMatchableCompletion4 ( displayText : displayText , matchText : spelling , origin : completion4 ) ,
113- Completion3 completion3 => new IdeographMatchableCompletion3 ( displayText : displayText , matchText : spelling , origin : completion3 ) ,
114- Completion2 completion2 => new IdeographMatchableCompletion2 ( displayText : displayText , matchText : spelling , origin : completion2 ) ,
115- _ => new IdeographMatchableCompletion ( displayText : displayText , matchText : spelling , origin : originCompletion ) ,
116- } ;
125+ return originCompletion switch
126+ {
127+ Completion4 completion4 => completion4 . Suffix ? . Length > 0
128+ ? new IdeographMatchableCustomCommitCompletion4 ( displayText : displayText , suffix : completion4 . Suffix , matchText : spelling , origin : completion4 , customCommitter : customCommitter )
129+ : new IdeographMatchableCustomCommitCompletion4 ( displayText : displayText , matchText : spelling , origin : completion4 , customCommitter : customCommitter ) ,
130+ Completion3 completion3 => new IdeographMatchableCustomCommitCompletion3 ( displayText : displayText , matchText : spelling , origin : completion3 , customCommitter : customCommitter ) ,
131+ Completion2 completion2 => new IdeographMatchableCustomCommitCompletion2 ( displayText : displayText , matchText : spelling , origin : completion2 , customCommitter : customCommitter ) ,
132+ _ => new IdeographMatchableCustomCommitCompletion ( displayText : displayText , matchText : spelling , origin : originCompletion , customCommitter : customCommitter ) ,
133+ } ;
134+ }
135+ else
136+ {
137+ return originCompletion switch
138+ {
139+ Completion4 completion4 => completion4 . Suffix ? . Length > 0
140+ ? new IdeographMatchableCompletion4 ( displayText : displayText , suffix : completion4 . Suffix , matchText : spelling , origin : completion4 )
141+ : new IdeographMatchableCompletion4 ( displayText : displayText , matchText : spelling , origin : completion4 ) ,
142+ Completion3 completion3 => new IdeographMatchableCompletion3 ( displayText : displayText , matchText : spelling , origin : completion3 ) ,
143+ Completion2 completion2 => new IdeographMatchableCompletion2 ( displayText : displayText , matchText : spelling , origin : completion2 ) ,
144+ _ => new IdeographMatchableCompletion ( displayText : displayText , matchText : spelling , origin : originCompletion ) ,
145+ } ;
146+ }
117147 }
118148
119149 private void CreateCompletionWithConvertion ( Completion originCompletion , InputMethodDictionaryGroup inputMethodDictionaryGroup , Func < string , bool > shouldProcessCheck , Completion [ ] itemBuffer , ref int bufferIndex )
0 commit comments