           [clojure.string :refer [trim]])
   (:import
    [UnityEngine Time Mathf Debug]
+   [RSG Promise IPromise]
    [seawisphunter.minibuffer Minibuffer Command Prompt Keymap ICompleter]))
 
 (defn do-with-minibuffer

    [minibuffer-var & body]
    `(do-with-minibuffer (fn [~minibuffer-var] ~@body)))

(defn- generate-generic-type
  "Like generate-generic-delegate but just provides the type.

e.g. (generate-generic-type 'Dictionary [String String])
       -> |Dictionary`2[System.String,System.String]|"
  [typename typesyms]
  (let [types (map (fn [tsym]
                       (clojure.lang.CljCompiler.Ast.HostExpr/MaybeType tsym false))
                   typesyms)
       ftype (symbol (str typename "`" (count types) "[" (clojure.string/join "," types) "]"))]
       ftype))

           (message "No such function \"%s\"." function)))

(defn make-func-completer
  "Convert a fn into a ICompleter. The completer accepts the current input and
  returns a list of potential matches (does not have to be sorted).

The coercer accepts two arguments, the selected string and the desired type.

  e.g. (f \"Sh\") -> (\"Shane\" \"Shawn\" \"Shannon\")
       (f \"Shane\" clojure.lang.Symbol) -> 'Shane"
  [completer-fn]
  (CompleterEntity. (reify ICompleter
                           (Complete [this input]
