Skip to content

Commit

Permalink
added timers to setup functions
Browse files Browse the repository at this point in the history
  • Loading branch information
Nimaoth committed Apr 2, 2024
1 parent c31602a commit 2fa1456
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
7 changes: 7 additions & 0 deletions config/default_config.nim
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import absytree_runtime
import std/[json]
import misc/[timer]

import languages

Expand Down Expand Up @@ -56,6 +57,12 @@ proc loadDefaultOptions*() =
loadTheme "tokyo-night-color-theme"

proc loadDefaultKeybindings*(clearExisting: bool = false) =
let t = startTimer()
defer:
infof"loadDefaultKeybindings: {t.elapsed.ms} ms"

info "Applying default keybindings"

if clearExisting:
clearCommands "editor"
clearCommands "editor.ast"
Expand Down
12 changes: 11 additions & 1 deletion config/keybindings_normal.nim
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import absytree_runtime
import misc/[event, id]
import misc/[event, id, timer]

proc setModeChangedHandler*(handler: proc(editor: TextDocumentEditor, oldMode: string, newMode: string)) =
let modeChangedHandler = getOption("editor.text.mode-changed-handler", "")
Expand All @@ -12,6 +12,10 @@ proc setModeChangedHandler*(handler: proc(editor: TextDocumentEditor, oldMode: s
setOption("editor.text.mode-changed-handler", $id)

proc loadNormalKeybindings*() {.scriptActionWasmNims("load-normal-keybindings").} =
let t = startTimer()
defer:
infof"loadNormalKeybindings: {t.elapsed.ms} ms"

info "Applying normal keybindings"

clearCommands("editor.text")
Expand Down Expand Up @@ -107,6 +111,12 @@ proc loadNormalKeybindings*() {.scriptActionWasmNims("load-normal-keybindings").
addTextCommand "", "<C-SPACE>", "get-completions"

proc loadModelKeybindings*() {.scriptActionWasmNims("load-model-keybindings").} =
let t = startTimer()
defer:
infof"loadModelKeybindings: {t.elapsed.ms} ms"

info "Applying model keybindings"

setHandleInputs "editor.model", true
setOption "editor.model.cursor.wide.", false

Expand Down

0 comments on commit 2fa1456

Please sign in to comment.