|
33 | 33 | :class="[
|
34 | 34 | 'text-white bg-gradient-to-r from-purple-500 via-purple-600 to-purple-700 hover:bg-gradient-to-br focus:ring-4 focus:outline-none focus:ring-purple-300 dark:focus:ring-purple-800',
|
35 | 35 | 'font-medium rounded-lg text-xs flex items-center justify-center py-1 px-1 ',
|
36 |
| - buttonText === 'TAB' ? 'w-16' : 'w-18' |
| 36 | + buttonText === approveCompletionValue ? 'w-16' : 'w-18' |
37 | 37 | ]">
|
38 | 38 | <div
|
39 | 39 | class="flex items-center justify-center"
|
40 |
| - v-if="buttonText === 'TAB'" |
| 40 | + v-if="buttonText === approveCompletionValue" |
41 | 41 | >
|
42 | 42 | <IconArrowRightThin class="mt-0.5 w-5 h-5 text-white"/>
|
43 | 43 | <span class="ml-1 px-1 h-4 flex items-center justify-center rounded border bg-white text-black text-[10px] font-mono shadow-inner shadow-sm border-gray-300 dark:bg-gray-700 dark:text-white dark:border-gray-500">
|
|
46 | 46 | </div>
|
47 | 47 | <div
|
48 | 48 | class="flex items-center justify-center"
|
49 |
| - v-else-if="buttonText === 'CTRL + ->'" |
| 49 | + v-else-if="buttonText === approveNextWorldValue" |
50 | 50 | >
|
51 | 51 | <IconArrowRightThin class="mt-0.5 w-5 h-5 text-white" />
|
52 | 52 | <span class="ml-1 px-1 h-4 flex items-center justify-center rounded border bg-white text-black text-[10px] font-mono shadow-inner shadow-sm border-gray-300 dark:bg-gray-700 dark:text-white dark:border-gray-500">
|
@@ -85,24 +85,24 @@ const props = defineProps<{
|
85 | 85 | const emit = defineEmits([
|
86 | 86 | 'update:value',
|
87 | 87 | ]);
|
88 |
| -
|
| 88 | +const approveCompletionValue:string='TAB'; |
| 89 | +const approveNextWorldValue:string='CTRL + ->' |
89 | 90 | const isLoading = ref<boolean>(false);
|
90 | 91 | const isUntouched = ref<boolean>(true);
|
91 | 92 | const isFocused = ref<boolean>(false);
|
92 | 93 | const currentValue: Ref<string> = ref('');
|
93 | 94 | const suggestionInputRef = ref<InstanceType<typeof SuggestionInput> | null>(null);
|
94 |
| -const buttonText = ref<string>('TAB'); |
| 95 | +const buttonText = ref<string>(approveCompletionValue); |
95 | 96 |
|
96 | 97 | const tooltipText = computed(() =>
|
97 |
| - buttonText.value === 'TAB' ? 'Approve completion' : 'Approve next word' |
| 98 | + buttonText.value === approveCompletionValue ? 'Approve completion' : 'Approve next word' |
98 | 99 | );
|
99 | 100 |
|
100 | 101 | function handleCompletionApproved(type: 'all' | 'word') {
|
101 |
| - console.log('🔥 Completion approved with type:', type); |
102 |
| - if(buttonText.value === 'TAB' && type === 'all') { |
103 |
| - buttonText.value = 'CTRL + ->'; |
104 |
| - } else if (buttonText.value === 'CTRL + ->' && type === 'word') { |
105 |
| - buttonText.value = 'TAB'; |
| 102 | + if(buttonText.value === approveCompletionValue && type === 'all') { |
| 103 | + buttonText.value = approveNextWorldValue; |
| 104 | + } else if (buttonText.value === approveNextWorldValue && type === 'word') { |
| 105 | + buttonText.value = approveCompletionValue; |
106 | 106 | }
|
107 | 107 | }
|
108 | 108 |
|
@@ -151,13 +151,13 @@ async function complete(textBeforeCursor: string) {
|
151 | 151 |
|
152 | 152 | const approveCompletion = async () => {
|
153 | 153 | if (suggestionInputRef.value) {
|
154 |
| - if( buttonText.value === 'TAB') { |
| 154 | + if( buttonText.value === approveCompletionValue) { |
155 | 155 | await suggestionInputRef.value.approveCompletion('all');
|
156 | 156 | } else {
|
157 | 157 | await suggestionInputRef.value.approveCompletion('word');
|
158 | 158 | }
|
159 | 159 | }
|
160 |
| - buttonText.value === 'TAB' ? buttonText.value = 'CTRL + ->' : buttonText.value = 'TAB'; |
| 160 | + buttonText.value === approveCompletionValue ? buttonText.value = approveNextWorldValue : buttonText.value = approveCompletionValue; |
161 | 161 | }
|
162 | 162 |
|
163 | 163 | function handleFocus() {
|
|
0 commit comments