Skip to content

Commit e9dff6e

Browse files
committed
fix: keyboard layout mapping causing shortcut malfunction
Keyboard layout libraries using dynamic import were not included in bundle, causing runtime module resolution errors - Restored keyboard-layout-converter.ts to static import to resolve bundling issues - Removed async/await and converted to synchronous functions (generateKeyVariants, findMatchingShortcut) - Restored convert-layout.d.ts type definition file - Rolled back performance optimization while preserving Strategy Pattern fix #143
1 parent 981d74d commit e9dff6e

File tree

3 files changed

+176
-188
lines changed

3 files changed

+176
-188
lines changed
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
type LayoutConverter = {
2+
fromEn(text: string): string;
3+
toEn(text: string): string;
4+
};
5+
6+
declare module "convert-layout/kr" {
7+
const converter: LayoutConverter;
8+
export default converter;
9+
}
10+
11+
declare module "convert-layout/ru" {
12+
const converter: LayoutConverter;
13+
export default converter;
14+
}
15+
16+
declare module "convert-layout/ar" {
17+
const converter: LayoutConverter;
18+
export default converter;
19+
}
20+
21+
declare module "convert-layout/he" {
22+
const converter: LayoutConverter;
23+
export default converter;
24+
}
25+
26+
declare module "convert-layout/de" {
27+
const converter: LayoutConverter;
28+
export default converter;
29+
}
30+
31+
declare module "convert-layout/es" {
32+
const converter: LayoutConverter;
33+
export default converter;
34+
}
35+
36+
declare module "convert-layout/cs" {
37+
const converter: LayoutConverter;
38+
export default converter;
39+
}
40+
41+
declare module "convert-layout/gr" {
42+
const converter: LayoutConverter;
43+
export default converter;
44+
}
45+
46+
declare module "convert-layout/fa" {
47+
const converter: LayoutConverter;
48+
export default converter;
49+
}
50+
51+
declare module "convert-layout/by" {
52+
const converter: LayoutConverter;
53+
export default converter;
54+
}
55+
56+
declare module "convert-layout/uk" {
57+
const converter: LayoutConverter;
58+
export default converter;
59+
}
60+
61+
declare module "convert-layout/kk" {
62+
const converter: LayoutConverter;
63+
export default converter;
64+
}
65+
66+
declare module "wanakana" {
67+
export const isJapanese: (text: string) => boolean;
68+
export const isRomaji: (text: string) => boolean;
69+
export const toRomaji: (text: string) => string;
70+
export const toHiragana: (text: string) => string;
71+
}
72+
73+
declare module "tiny-pinyin" {
74+
export const convertToPinyin: (text: string, separator?: string, lowerCase?: boolean) => string;
75+
}
76+
77+
declare module "@indic-transliteration/sanscript" {
78+
export const t: (text: string, from: string, to: string) => string;
79+
}

src/internal/command-executor.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,17 @@ export const validateShortcuts = (items: QuickPickItem[]): string[] => {
2121
return [...new Set(duplicates)];
2222
};
2323

24-
export const findShortcutItem = async (
24+
export const findShortcutItem = (
2525
items: QuickPickItem[],
2626
inputValue: string
27-
): Promise<QuickPickItem | undefined> => {
27+
): QuickPickItem | undefined => {
2828
if (inputValue.length !== 1) return undefined;
2929

3030
const shortcuts = items
3131
.map((item) => item.command.shortcut)
3232
.filter((shortcut): shortcut is string => Boolean(shortcut));
3333

34-
const matchingShortcut = await findMatchingShortcut(inputValue, shortcuts);
34+
const matchingShortcut = findMatchingShortcut(inputValue, shortcuts);
3535

3636
if (!matchingShortcut) return undefined;
3737

@@ -102,9 +102,9 @@ export const createQuickPickWithShortcuts = (
102102
executeCommand(selected);
103103
});
104104

105-
quickPick.onDidChangeValue(async (value) => {
105+
quickPick.onDidChangeValue((value) => {
106106
const trimmedValue = value.trim();
107-
const shortcutItem = await findShortcutItem(config.items, trimmedValue);
107+
const shortcutItem = findShortcutItem(config.items, trimmedValue);
108108

109109
if (!shortcutItem) return;
110110
executeCommand(shortcutItem);

0 commit comments

Comments
 (0)