Debian Codegraph @

src/harlequin_vscode/__init__.py

raw
1 from harlequin.keymap import HarlequinKeyBinding, HarlequinKeyMap
2
3 VSCODE_APP_BINDINGS = [
4 HarlequinKeyBinding("ctrl+q", "quit"),
5 HarlequinKeyBinding("f1", "help"),
6 HarlequinKeyBinding("f2", "focus_query_editor"),
7 HarlequinKeyBinding("f5", "focus_results_viewer"),
8 HarlequinKeyBinding("f6", "focus_data_catalog"),
9 HarlequinKeyBinding("f8", "show_query_history"),
10 HarlequinKeyBinding("ctrl+b,f9", "toggle_sidebar"),
11 HarlequinKeyBinding("f10", "toggle_full_screen"),
12 HarlequinKeyBinding("f12", "show_debug_info"),
13 HarlequinKeyBinding("ctrl+e", "show_data_exporter"),
14 HarlequinKeyBinding("ctrl+r", "refresh_catalog"),
15 HarlequinKeyBinding("tab", "focus_next"),
16 HarlequinKeyBinding("shift+tab", "focus_previous"),
17 ]
18 VSCODE_EDITOR_BINDINGS = [
19 HarlequinKeyBinding("ctrl+n", "code_editor.new_buffer"),
20 HarlequinKeyBinding("ctrl+w", "code_editor.close_buffer"),
21 HarlequinKeyBinding("ctrl+k", "code_editor.next_buffer"),
22 HarlequinKeyBinding(
23 "ctrl+enter,ctrl+j",
24 "code_editor.run_query",
25 key_display="^⏎ or ^j",
26 ),
27 HarlequinKeyBinding("f4", "code_editor.format_buffer"),
28 HarlequinKeyBinding("ctrl+s", "code_editor.save_buffer"),
29 HarlequinKeyBinding("ctrl+o", "code_editor.load_buffer"),
30 HarlequinKeyBinding("ctrl+f", "code_editor.find"),
31 HarlequinKeyBinding("f3", "code_editor.find_next"),
32 HarlequinKeyBinding("ctrl+g", "code_editor.goto_line"),
33 HarlequinKeyBinding("up", "code_editor.cursor_up"),
34 HarlequinKeyBinding("down", "code_editor.cursor_down"),
35 HarlequinKeyBinding("left", "code_editor.cursor_left"),
36 HarlequinKeyBinding("right", "code_editor.cursor_right"),
37 HarlequinKeyBinding("ctrl+left", "code_editor.cursor_word_left"),
38 HarlequinKeyBinding("ctrl+right", "code_editor.cursor_word_right"),
39 HarlequinKeyBinding("home", "code_editor.cursor_line_start"),
40 HarlequinKeyBinding("end", "code_editor.cursor_line_end"),
41 HarlequinKeyBinding("ctrl+home", "code_editor.cursor_doc_start"),
42 HarlequinKeyBinding("ctrl+end", "code_editor.cursor_doc_end"),
43 HarlequinKeyBinding("pageup", "code_editor.cursor_page_up"),
44 HarlequinKeyBinding("pagedown", "code_editor.cursor_page_down"),
45 HarlequinKeyBinding("shift+up", "code_editor.select_up"),
46 HarlequinKeyBinding("shift+down", "code_editor.select_down"),
47 HarlequinKeyBinding("shift+left", "code_editor.select_left"),
48 HarlequinKeyBinding("shift+right", "code_editor.select_right"),
49 HarlequinKeyBinding("ctrl+shift+left", "code_editor.select_word_left"),
50 HarlequinKeyBinding("ctrl+shift+right", "code_editor.select_word_right"),
51 HarlequinKeyBinding("shift+home", "code_editor.select_line_start"),
52 HarlequinKeyBinding("shift+end", "code_editor.select_line_end"),
53 HarlequinKeyBinding("ctrl+shift+home", "code_editor.select_doc_start"),
54 HarlequinKeyBinding("ctrl+shift+end", "code_editor.select_doc_end"),
55 HarlequinKeyBinding("ctrl+a", "code_editor.select_all"),
56 HarlequinKeyBinding("ctrl+up", "code_editor.scroll_up_one"),
57 HarlequinKeyBinding("ctrl+down", "code_editor.scroll_down_one"),
58 HarlequinKeyBinding("ctrl+underscore", "code_editor.toggle_comment"),
59 HarlequinKeyBinding("ctrl+x", "code_editor.cut"),
60 HarlequinKeyBinding("ctrl+c", "code_editor.copy"),
61 HarlequinKeyBinding("ctrl+u,ctrl+v,shift+insert", "code_editor.paste"),
62 HarlequinKeyBinding("ctrl+z", "code_editor.undo"),
63 HarlequinKeyBinding("ctrl+y", "code_editor.redo"),
64 HarlequinKeyBinding("backspace", "code_editor.delete_left"),
65 HarlequinKeyBinding("delete", "code_editor.delete_right"),
66 HarlequinKeyBinding("shift+delete", "code_editor.delete_line"),
67 ]
68 VSCODE_DATA_CATALOG_BINDINGS = [
69 HarlequinKeyBinding("j", "data_catalog.previous_tab"),
70 HarlequinKeyBinding("k", "data_catalog.next_tab"),
71 HarlequinKeyBinding(
72 "ctrl+enter,ctrl+j",
73 "data_catalog.insert_name",
74 key_display="^⏎ or ^j",
75 ),
76 HarlequinKeyBinding("ctrl+c", "data_catalog.copy_name"),
77 HarlequinKeyBinding("enter", "data_catalog.select_cursor"),
78 HarlequinKeyBinding("space", "data_catalog.toggle_node"),
79 HarlequinKeyBinding("up", "data_catalog.cursor_up"),
80 HarlequinKeyBinding("down", "data_catalog.cursor_down"),
81 HarlequinKeyBinding("full_stop", "data_catalog.show_context_menu"),
82 HarlequinKeyBinding("escape", "data_catalog.hide_context_menu"),
83 ]
84 VSCODE_RESULTS_VIEWER_BINDINGS = [
85 HarlequinKeyBinding("j", "results_viewer.previous_tab"),
86 HarlequinKeyBinding("k", "results_viewer.next_tab"),
87 HarlequinKeyBinding("ctrl+c", "results_viewer.copy_selection"),
88 HarlequinKeyBinding("enter", "results_viewer.select_cursor"),
89 HarlequinKeyBinding("space", "results_viewer.view_cell"),
90 HarlequinKeyBinding("up", "results_viewer.cursor_up"),
91 HarlequinKeyBinding("down", "results_viewer.cursor_down"),
92 HarlequinKeyBinding("left", "results_viewer.cursor_left"),
93 HarlequinKeyBinding("right", "results_viewer.cursor_right"),
94 HarlequinKeyBinding("ctrl+left", "results_viewer.cursor_row_start"),
95 HarlequinKeyBinding("ctrl+right", "results_viewer.cursor_row_end"),
96 HarlequinKeyBinding("ctrl+up,home", "results_viewer.cursor_column_start"),
97 HarlequinKeyBinding("ctrl+down,end", "results_viewer.cursor_column_end"),
98 HarlequinKeyBinding("tab", "results_viewer.cursor_next_cell"),
99 HarlequinKeyBinding("shift+tab", "results_viewer.cursor_previous_cell"),
100 HarlequinKeyBinding("pageup", "results_viewer.cursor_page_up"),
101 HarlequinKeyBinding("pagedown", "results_viewer.cursor_page_down"),
102 HarlequinKeyBinding("ctrl+home", "results_viewer.cursor_table_start"),
103 HarlequinKeyBinding("ctrl+end", "results_viewer.cursor_table_end"),
104 HarlequinKeyBinding("shift+up", "results_viewer.select_up"),
105 HarlequinKeyBinding("shift+down", "results_viewer.select_down"),
106 HarlequinKeyBinding("shift+left", "results_viewer.select_left"),
107 HarlequinKeyBinding("shift+right", "results_viewer.select_right"),
108 HarlequinKeyBinding("ctrl+shift+left", "results_viewer.select_row_start"),
109 HarlequinKeyBinding("ctrl+shift+right", "results_viewer.select_row_end"),
110 HarlequinKeyBinding(
111 "ctrl+shift+up,shift+home", "results_viewer.select_column_start"
112 ),
113 HarlequinKeyBinding(
114 "ctrl+shift+down,shift+end", "results_viewer.select_column_end"
115 ),
116 HarlequinKeyBinding("shift+pageup", "results_viewer.select_page_up"),
117 HarlequinKeyBinding("shift+pagedown", "results_viewer.select_page_down"),
118 HarlequinKeyBinding("ctrl+shift+home", "results_viewer.select_table_start"),
119 HarlequinKeyBinding("ctrl+shift+end", "results_viewer.select_table_end"),
120 HarlequinKeyBinding("ctrl+a", "results_viewer.select_all"),
121 ]
122
123 VSCODE_HISTORY_SCREEN_BINDINGS = [
124 HarlequinKeyBinding("enter", "history_screen.select_query"),
125 HarlequinKeyBinding("escape", "history_screen.cancel"),
126 ]
127
128
129 VSCODE = HarlequinKeyMap(
130 name="vscode",
131 bindings=[
132 *VSCODE_APP_BINDINGS,
133 *VSCODE_EDITOR_BINDINGS,
134 *VSCODE_DATA_CATALOG_BINDINGS,
135 *VSCODE_RESULTS_VIEWER_BINDINGS,
136 *VSCODE_HISTORY_SCREEN_BINDINGS,
137 ],
138 )