   [index-in-word word word-to-complete trim-chars]
   (let [partitioned-by-trimmed-chars (vec (utils/partition-by-regexp word trim-chars))
         index-of-part-to-complete (-> index-in-word
-                                          inc
-                                          (take word)
-                                          (utils/partition-by-regexp trim-chars)
-                                          count
-                                          dec)]
+                                      inc
+                                      (take word)
+                                      (utils/partition-by-regexp trim-chars)
+                                      count
+                                      dec)]
     (->> (update-in partitioned-by-trimmed-chars [index-of-part-to-complete]
                     #(str word-to-complete))
          (string/join ""))))



(defn case-sensitivity [case-sensitive? dictionary-item input]
  (if case-sensitive?
    (string/starts-with? dictionary-item input)
    (string/starts-with? (string/lower-case dictionary-item) (string/lower-case input))))

(defn items-to-complete
  "List of the items to autocomplete by given input and list of the all items"

      ""
      current-word-item)))

(defn opening-excluded-chars [word excluded-chars]
  (if ((set (map #(= (first word) %) excluded-chars)) true)
    (opening-excluded-chars (apply str (rest word)) excluded-chars)
    word))

(defn closing-excluded-chars [word excluded-chars]
  (if ((set (map #(= (last word) %) excluded-chars)) true)
    (closing-excluded-chars (apply str (butlast word)) excluded-chars)
    word))

(defn completions [word dictionary {:keys [trim-chars sort-fn case-sensitive?]}]
  (let [new-text (-> word
                     (opening-excluded-chars trim-chars)
                     (closing-excluded-chars trim-chars))]
    (sort-by sort-fn (items-to-complete case-sensitive? dictionary new-text))))

(defn words-to-index
  "Words to change index"
