|
46 | 46 | (expect (nth 2 (clojure-ts-completion-at-point-function))
|
47 | 47 | :to-equal '(("foo" . defun-candidate)
|
48 | 48 | ("bar" . defun-candidate)
|
49 |
| - ("baz" . defun-candidate))))) |
| 49 | + ("baz" . defun-candidate) |
| 50 | + (":first" . keyword-candidate) |
| 51 | + (":second" . keyword-candidate))))) |
50 | 52 |
|
51 | 53 | (it "should complete function arguments"
|
52 | 54 | (with-clojure-ts-buffer-point "
|
|
61 | 63 | :to-equal '(("foo" . defun-candidate)
|
62 | 64 | ("bar" . defun-candidate)
|
63 | 65 | ("baz" . defun-candidate)
|
| 66 | + (":first" . keyword-candidate) |
| 67 | + (":second" . keyword-candidate) |
64 | 68 | ("username" . local-candidate)))))
|
65 | 69 |
|
66 | 70 | (it "should not complete function arguments outside of function"
|
|
77 | 81 | (expect (nth 2 (clojure-ts-completion-at-point-function))
|
78 | 82 | :to-equal '(("foo" . defun-candidate)
|
79 | 83 | ("bar" . defun-candidate)
|
80 |
| - ("baz" . defun-candidate))))) |
| 84 | + ("baz" . defun-candidate) |
| 85 | + (":first" . keyword-candidate) |
| 86 | + (":second" . keyword-candidate))))) |
81 | 87 |
|
82 | 88 | (it "should complete destructured function arguments"
|
83 | 89 | (with-clojure-ts-buffer-point "
|
|
86 | 92 | (println u|))"
|
87 | 93 | (expect (nth 2 (clojure-ts-completion-at-point-function))
|
88 | 94 | :to-equal '(("baz" . defun-candidate)
|
| 95 | + (":keys" . keyword-candidate) |
89 | 96 | ("username" . local-candidate))))
|
90 | 97 |
|
91 | 98 | (with-clojure-ts-buffer-point "
|
|
94 | 101 | (println u|))"
|
95 | 102 | (expect (nth 2 (clojure-ts-completion-at-point-function))
|
96 | 103 | :to-equal '(("baz" . defun-candidate)
|
| 104 | + (":strs" . keyword-candidate) |
97 | 105 | ("username" . local-candidate))))
|
98 | 106 |
|
99 | 107 | (with-clojure-ts-buffer-point "
|
|
102 | 110 | (println u|))"
|
103 | 111 | (expect (nth 2 (clojure-ts-completion-at-point-function))
|
104 | 112 | :to-equal '(("baz" . defun-candidate)
|
| 113 | + (":syms" . keyword-candidate) |
105 | 114 | ("username" . local-candidate))))
|
106 | 115 |
|
107 | 116 | (with-clojure-ts-buffer-point "
|
|
110 | 119 | (println u|))"
|
111 | 120 | (expect (nth 2 (clojure-ts-completion-at-point-function))
|
112 | 121 | :to-equal '(("baz" . defun-candidate)
|
| 122 | + (":name" . keyword-candidate) |
113 | 123 | ("username" . local-candidate))))
|
114 | 124 |
|
115 | 125 | (with-clojure-ts-buffer-point "
|
|
131 | 141 | a|))"
|
132 | 142 | (expect (nth 2 (clojure-ts-completion-at-point-function))
|
133 | 143 | :to-equal '(("baz" . defun-candidate)
|
| 144 | + (":street" . keyword-candidate) |
| 145 | + (":zip-code" . keyword-candidate) |
| 146 | + (":keys" . keyword-candidate) |
134 | 147 | ("first-name" . local-candidate)
|
135 | 148 | ("last-name" . local-candidate)
|
136 | 149 | ("address" . local-candidate)
|
|
147 | 160 | (expect (nth 2 (clojure-ts-completion-at-point-function))
|
148 | 161 | :to-equal '(("baz" . defun-candidate)
|
149 | 162 | ("first-name" . local-candidate)
|
150 |
| - ("full-name" . local-candidate)))))) |
| 163 | + ("full-name" . local-candidate))))) |
| 164 | + |
| 165 | + (it "should complete any keyword" |
| 166 | + (with-clojure-ts-buffer-point " |
| 167 | +(defn baz |
| 168 | + [first-name] |
| 169 | + (let [last-name \"Doe\" |
| 170 | + address {:street \"Whatever\" :zip-code 2222} |
| 171 | + {:keys [street zip-code]} address] |
| 172 | + (println street zip-code))) |
| 173 | +
|
| 174 | +:|" |
| 175 | + (expect (nth 2 (clojure-ts-completion-at-point-function)) |
| 176 | + :to-equal '(("baz" . defun-candidate) |
| 177 | + (":street" . keyword-candidate) |
| 178 | + (":zip-code" . keyword-candidate) |
| 179 | + (":keys" . keyword-candidate))))) |
| 180 | + |
| 181 | + (it "should complete locals of for bindings" |
| 182 | + (with-clojure-ts-buffer-point " |
| 183 | +(for [digit [\"one\" \"two\" \"three\"] |
| 184 | + :let [prefixed-digit (str \"hello-\" digit)]] |
| 185 | + (println d|))" |
| 186 | + (expect (nth 2 (clojure-ts-completion-at-point-function)) |
| 187 | + :to-equal '((":let" . keyword-candidate) |
| 188 | + ("digit" . local-candidate) |
| 189 | + ("prefixed-digit" . local-candidate))))) |
| 190 | + |
| 191 | + (it "should complete locals of doseq bindings" |
| 192 | + (with-clojure-ts-buffer-point " |
| 193 | +(doseq [digit [\"one\" \"two\" \"three\"] |
| 194 | + :let [prefixed-digit (str \"hello-\" digit)]] |
| 195 | + (println d|))" |
| 196 | + (expect (nth 2 (clojure-ts-completion-at-point-function)) |
| 197 | + :to-equal '((":let" . keyword-candidate) |
| 198 | + ("digit" . local-candidate) |
| 199 | + ("prefixed-digit" . local-candidate)))))) |
151 | 200 |
|
152 | 201 | (provide 'clojure-ts-mode-completion)
|
153 | 202 | ;;; clojure-ts-mode-completion.el ends here
|
0 commit comments