diff options
author | aktersnurra <grydholm@kth.se> | 2022-04-23 22:36:52 +0200 |
---|---|---|
committer | aktersnurra <grydholm@kth.se> | 2022-04-23 22:36:52 +0200 |
commit | 49ad7bc9e6bb5c1a9ba1210959761b811efa0e1f (patch) | |
tree | af53ac46d83892a9ea9ac50143b326200b5f77e6 /fnl/config | |
parent | 597c4c2d18325f6b7b67ca66ac321af4be386664 (diff) |
fix(comment): add new logic
Diffstat (limited to 'fnl/config')
-rw-r--r-- | fnl/config/ncomment.fnl | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/fnl/config/ncomment.fnl b/fnl/config/ncomment.fnl index 2da59c6..06e9de1 100644 --- a/fnl/config/ncomment.fnl +++ b/fnl/config/ncomment.fnl @@ -2,18 +2,22 @@ (module config.ncomment {autoload {util util}}) (defn- get-type [ctx U] - (or (and (= ctx.ctype U.ctype.line) :__default) :__multiline)) + (if (= ctx.ctype U.ctype.line) + :__default + :__multiline)) (defn- get-location [ctx U] - (if (= ctx.ctype U.ctype.block) - ((require :ts_context_commentstring.utils).get_cursor_location) - (or (= ctx.cmotion U.motion.v) (= ctx.cmotion U.cmotion.V)) - ((require :ts_context_commentstring.utils).get_visual_start_location) - nil)) + (let [utils (require :ts_context_commentstring.utils)] + (if (= ctx.ctype U.ctype.block) + (utils.get_cursor_location) + (or (= ctx.cmotion U.cmotion.v) (= ctx.cmotion U.cmotion.V)) + (utils.get_visual_start_location) + nil))) (defn- pre-hook [ctx] - (let [U (require :Comment.utils)] - ((require :ts_context_commentstring.internal).calculate_commentstring + (let [U (require :Comment.utils) + internal (require :ts_context_commentstring.internal)] + (internal.calculate_commentstring {:key (get-type ctx U) :location (get-location ctx U)}))) |