forked from tapeinosyne/light-typedclojure
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
ndr
committed
May 5, 2014
1 parent
0a9a7b5
commit 924643e
Showing
1 changed file
with
52 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,64 @@ | ||
light-typedclojure | ||
================== | ||
Official Typed Clojure plugin for Light Table | ||
# Typed Clojure for Light Table | ||
<a href="http://typedclojure.org"><img src="https://raw.githubusercontent.com/typedclojure/vim-typedclojure/master/images/part-of-typed-clojure-project.png"></a> | ||
|
||
## Installation | ||
Typed Clojure is available in the plugin manager. | ||
The official Typed Clojure plugin for Light Table. | ||
|
||
Alternatively, you can manually clone this repository into your plugin folder. | ||
## Installation | ||
Typed Clojure is available in the Plugin Manager, which is the preferred installation method. | ||
|
||
### Dependencies | ||
Light Table 0.6.4+ | ||
Clojure plugin 0.0.10+ | ||
Paredit plugin 0.0.4+ | ||
- Light Table ≥ 0.6.4 | ||
- Clojure plugin ≥ 0.0.10 | ||
- Paredit plugin ≥ 0.0.4 | ||
|
||
Your project should include `[org.clojure/core.typed "0.2.30"]` or above. | ||
### Manual Installation | ||
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. | ||
|
||
## Usage | ||
The following commands are currently available: | ||
Typed Clojure ships functionality in the form of Light Table commands. | ||
|
||
Available commands are prefixed with `Typed Clojure` in the command bar, and can be bound to keyboard shortcuts via your `user.keymap`. For example: | ||
```clojure | ||
{:+ {:editor.clj {"pmeta-shift-n" [:typedclojure.check.ns] | ||
"pmeta-shift-f" [:typedclojure.check.form] | ||
"ctrl-alt-v" [:typedclojure.ann.var] | ||
"ctrl-alt-f" [:typedclojure.ann.form]}}} | ||
``` | ||
|
||
`Typed Clojure: check namespace` | ||
to typecheck the namespace defined in your current file (as saved on disk). | ||
### Typechecking | ||
Typecheck commands report type mismatches, errors, and missing annotations. They rely on `core.typed` functions, invoking them as you would in the REPL. | ||
|
||
`Typed Clojure: check var or form` | ||
to typecheck the variable or form under the cursor, or in the selection. | ||
#### `Typed Clojure: check namespace` | ||
`:typedclojure.check.ns` | ||
`clojure.core.typed/check-ns-info` | ||
|
||
`Typed Clojure: annotate var` | ||
to annotate a var with a type through `clojure.core.typed/ann`, fully qualifying it if necessary. | ||
Typecheck the namespace declared in your current file (as saved on disk). Results are logged in the console. | ||
|
||
`Typed Clojure: annotate form` | ||
to annotate a form or symbol with a type through `clojure.core.typed/ann-form`. | ||
#### `Typed Clojure: check var or form` | ||
`:typedclojure.check.form` | ||
`clojure.core.typed/check-form-info` | ||
|
||
To bind keys to any of these functions, add any of the following commands to your user.keymap: | ||
```clojure | ||
{:+ {:editor.clj {"keybinding" [:typedclojure.check.ns] | ||
"keybinding" [:typedclojure.check.form] | ||
"keybinding" [:typedclojure.ann.var] | ||
"keybinding" [:typedclojure.ann.form]}}} | ||
``` | ||
Typecheck the variable or form under the cursor, or in the selection. Results are displayed inline. | ||
|
||
### Annotating | ||
Annotation commands produce snippets which call a `core.typed` function, aliasing it if possible. | ||
|
||
Annotations default to the `Any` type. They will wrap symbols and forms under your cursor, or active selections, if any. | ||
|
||
#### `Typed Clojure: annotate var` | ||
`:typedclojure.ann.var` | ||
`clojure.core.typed/ann` | ||
|
||
Annotate a var with a type. The annotation will be inserted at the top level, above the current form. | ||
|
||
#### `Typed Clojure: annotate form` | ||
`:typedclojure.ann.form` | ||
`clojure.core.typed/ann-form` | ||
|
||
Annotate a form or symbol with a type. | ||
|
||
#### `Typed Clojure: add predicate` | ||
`:typedclojure.pred` | ||
`clojure.core.typed/pred` | ||
|
||
Add a type predicate to a form or symbol. |