From a50fa9da49e9d2546d186b2c5b6617ef4ef206ac Mon Sep 17 00:00:00 2001 From: please Date: Sat, 29 Jun 2024 04:16:11 -0700 Subject: [PATCH] add formatting by Tab --- src/app/editor.cljs | 2 ++ src/app/problem.cljs | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/app/editor.cljs b/src/app/editor.cljs index 6469e35..870f0c2 100644 --- a/src/app/editor.cljs +++ b/src/app/editor.cljs @@ -52,6 +52,8 @@ #js [(cm-clj/syntax live-grammar/parser) (.slice editor-extensions-to-load 1)] editor-extensions-to-load)) + ;; enable formatting by Tab key + (.of view/keymap (.filter cm-clj/complete-keymap #(= "Tab" (aget % "key")))) #_(.of view/keymap cm-clj/complete-keymap) #_(.of view/keymap historyKeymap)]))) diff --git a/src/app/problem.cljs b/src/app/problem.cljs index 475636c..fd141a8 100644 --- a/src/app/problem.cljs +++ b/src/app/problem.cljs @@ -154,9 +154,9 @@ (reset! editor-extension-mode extension-mode))]] [:p {:style {:margin-top "1rem"}} [:small - "Alt+Enter will eval the local form in the editor box above. There are + "Alt+Enter will eval the local form in the editor box above, and Tab will format the code. There are lots of nifty such features and keybindings. More docs coming soon! (Try - playing with alt + arrows / ctrl + enter) in the meanwhile. + playing with alt + arrows / ctrl + enter / tab) in the meanwhile. For documentation try e.g. (doc map)."]] [modal/box {:is-open success-modal-is-open :on-close success-modal-on-close}