|
1 |
| -light-typedclojure |
2 |
| -================== |
3 |
| -Official Typed Clojure plugin for Light Table |
| 1 | +# Typed Clojure for Light Table |
| 2 | +<a href="http://typedclojure.org"><img src="https://raw.githubusercontent.com/typedclojure/vim-typedclojure/master/images/part-of-typed-clojure-project.png"></a> |
4 | 3 |
|
5 |
| -## Installation |
6 |
| -Typed Clojure is available in the plugin manager. |
| 4 | +The official Typed Clojure plugin for Light Table. |
7 | 5 |
|
8 |
| -Alternatively, you can manually clone this repository into your plugin folder. |
| 6 | +## Installation |
| 7 | +Typed Clojure is available in the Plugin Manager, which is the preferred installation method. |
9 | 8 |
|
10 | 9 | ### Dependencies
|
11 |
| -Light Table 0.6.4+ |
12 |
| -Clojure plugin 0.0.10+ |
13 |
| -Paredit plugin 0.0.4+ |
| 10 | +- Light Table ≥ 0.6.4 |
| 11 | +- Clojure plugin ≥ 0.0.10 |
| 12 | +- Paredit plugin ≥ 0.0.4 |
14 | 13 |
|
15 |
| -Your project should include `[org.clojure/core.typed "0.2.30"]` or above. |
| 14 | +### Manual Installation |
| 15 | +Download the latest version from [GitHub Releases](https://github.com/typedclojure/light-typedclojure/releases) and extract it to your plugin folder. Alternatively, you can clone this repository; however, this is not advisable, as the code in the master branch is not guaranteed to be stable. |
16 | 16 |
|
17 | 17 | ## Usage
|
18 |
| -The following commands are currently available: |
| 18 | +Typed Clojure ships functionality in the form of Light Table commands. |
| 19 | + |
| 20 | +Available commands are prefixed with `Typed Clojure` in the command bar, and can be bound to keyboard shortcuts via your `user.keymap`. For example: |
| 21 | +```clojure |
| 22 | +{:+ {:editor.clj {"pmeta-shift-n" [:typedclojure.check.ns] |
| 23 | + "pmeta-shift-f" [:typedclojure.check.form] |
| 24 | + "ctrl-alt-v" [:typedclojure.ann.var] |
| 25 | + "ctrl-alt-f" [:typedclojure.ann.form]}}} |
| 26 | +``` |
19 | 27 |
|
20 |
| -`Typed Clojure: check namespace` |
21 |
| -to typecheck the namespace defined in your current file (as saved on disk). |
| 28 | +### Typechecking |
| 29 | +Typecheck commands report type mismatches, errors, and missing annotations. They rely on `core.typed` functions, invoking them as you would in the REPL. |
22 | 30 |
|
23 |
| -`Typed Clojure: check var or form` |
24 |
| -to typecheck the variable or form under the cursor, or in the selection. |
| 31 | +#### `Typed Clojure: check namespace` |
| 32 | +`:typedclojure.check.ns` |
| 33 | +`clojure.core.typed/check-ns-info` |
25 | 34 |
|
26 |
| -`Typed Clojure: annotate var` |
27 |
| -to annotate a var with a type through `clojure.core.typed/ann`, fully qualifying it if necessary. |
| 35 | +Typecheck the namespace declared in your current file (as saved on disk). Results are logged in the console. |
28 | 36 |
|
29 |
| -`Typed Clojure: annotate form` |
30 |
| -to annotate a form or symbol with a type through `clojure.core.typed/ann-form`. |
| 37 | +#### `Typed Clojure: check var or form` |
| 38 | +`:typedclojure.check.form` |
| 39 | +`clojure.core.typed/check-form-info` |
31 | 40 |
|
32 |
| -To bind keys to any of these functions, add any of the following commands to your user.keymap: |
33 |
| -```clojure |
34 |
| -{:+ {:editor.clj {"keybinding" [:typedclojure.check.ns] |
35 |
| - "keybinding" [:typedclojure.check.form] |
36 |
| - "keybinding" [:typedclojure.ann.var] |
37 |
| - "keybinding" [:typedclojure.ann.form]}}} |
38 |
| -``` |
| 41 | +Typecheck the variable or form under the cursor, or in the selection. Results are displayed inline. |
| 42 | + |
| 43 | +### Annotating |
| 44 | +Annotation commands produce snippets which call a `core.typed` function, aliasing it if possible. |
| 45 | + |
| 46 | +Annotations default to the `Any` type. They will wrap symbols and forms under your cursor, or active selections, if any. |
| 47 | + |
| 48 | +#### `Typed Clojure: annotate var` |
| 49 | +`:typedclojure.ann.var` |
| 50 | +`clojure.core.typed/ann` |
| 51 | + |
| 52 | +Annotate a var with a type. The annotation will be inserted at the top level, above the current form. |
| 53 | + |
| 54 | +#### `Typed Clojure: annotate form` |
| 55 | +`:typedclojure.ann.form` |
| 56 | +`clojure.core.typed/ann-form` |
| 57 | + |
| 58 | +Annotate a form or symbol with a type. |
| 59 | + |
| 60 | +#### `Typed Clojure: add predicate` |
| 61 | +`:typedclojure.pred` |
| 62 | +`clojure.core.typed/pred` |
| 63 | + |
| 64 | +Add a type predicate to a form or symbol. |
0 commit comments