Skip to content

Commit

Permalink
Prepping 0.2.0 release
Browse files Browse the repository at this point in the history
  • Loading branch information
rundis committed Dec 11, 2015
1 parent a0dc089 commit 08c5393
Show file tree
Hide file tree
Showing 12 changed files with 5,805 additions and 5,198 deletions.
86 changes: 84 additions & 2 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -90,19 +90,83 @@ at the command line to see if packages installs correctly (I've experienced that
== Usage

=== Linting
image::lint.png[width=500]

To lint an elm file use the command: `Elm: Lint selected file`

* Errors are show inline for all errors in the file. Any errors caused by dependent files are shown in the console.
* Warnings are also shown inline
* Errors are marked with red underline, warnings with yellow underline
* Errors/warnings in dependent files are shown in the console

==== Details and navigation
* To view details about an error or warning place your cursor inside an underline range and select the
command `Linter: Show details at cursor`
* To move to next lint result select command `Linter: Move to next result`
* To move to previous lint result select command `Linter: Move to previous result`


NOTE: Rember to save. Linting works on saved files !


----
TIP: Linting on save
If you wish to lint on save just add the following to your user behaviors
[:editor.elm "ctrl-s" :save :elm.lint]
----


=== Make (to js)
To run make for your elm file/project use the command: `Elm: Make selected file`
A .js file is generated in the same directory as the .elm file resides.
Errors and warnings are handled similar to linting.


=== Testing
[cols="1a,1a"]
|===

| image::browsertests.png[width=400, role="thumb"]
| image::consoletests.png[width=400]
|===

.Preconditions
The plugin comes bundled with the https://github.com/rtfeldman/node-elm-test[node-elm-test] node package. It's slighly
modified to ensure that it uses the node instance that comes bundled with Light Table.
So you **don't** need to install node-elm-test !

Of course you can run browser based tests without problems. The great benefit of using the console runner is that these tests can also be run as part of a ci build.



==== Quick start
The plugin has a feature create a test skeleton subproject. From any (non-test) elm file;

. Invoke the command `Elm: Add test subproject to current project`
. The plugin will:
.. Create a test directory
.. Create a elm-package.json file based on the elm-package.json file in your current project. It will add dependencies
to https://github.com/deadfoxygrandpa/Elm-Test[elm-test] and https://github.com/laszlopandy/elm-console[elm-console].
It will also set up source directories for your test project to include any source directories set up for your root project
.. It will add a sample console TestRunner.elm and a sample Tests.elm
.. Finally it will run elm-package install do set you up for subsequently quickly run your tests (this may take a little while the first time)
. Now you have a great starting point to start writing tests running them


==== Running tests
. Open a test file
. Select the command `Elm: Test current file`
. One of two outcomes will occur:
.. If the test is considered a console test (contains "consoleRunner" or "Console") ; The tests are run using https://github.com/rtfeldman/node-elm-test[node-elm-test].
Results are shown in the console. In case of errors a message is displayed in the status bar
.. If not a console test, the test is assumed to be a browser/element test and the file is opened in the inline browser (backed by elm-reactor). Test are run and results are shown using elm-tests elementRunner (or stringRunner if that's what you are using)


NOTE: The first time you run a browser test, you might need to reload the page as the reactor might not have completed starting before
the tests run (and hence the test file hasn't completed compiling yet). After that it's just a matter of changing tests and reloead (`ctrl-r`)




=== Language docs
.From an elm file;
* Select the command: Docs: Search language docs (ctrl-shift-d)
Expand Down Expand Up @@ -228,6 +292,21 @@ For any packages installed (with an exact version) you may view the online docs:
is displayed


=== Elm format
In an effort to standardize how Elm code should be formatted, https://github.com/avh4/elm-format[elm-format] was
created. It is still in alpha, but I figured you might just as well start playing with it.

.Precondition
You will need to install elm-format and make sure the executable is available in your path for it to work from
the plugin. You'll find install instructions on the https://github.com/avh4/elm-format[elm-format] readme.

.Format a file
* With an elm file open, select the command `Elm: Format file`
* Voila file formatted
* If there are any errors (typically syntax errors), a message is shown in the Statusbar and details can be found in the console



=== Note on editor commands


Expand All @@ -246,6 +325,8 @@ In most cases it should work sensibly though.


==== Commenting
**DEPRECATED. Will be removed in the next version of the plugin as Light Table 0.8 will include this feature.**

Light Table out of the box doesn't support block commenting (well it only supports uncommenting block comments currently)

.For your pleasure I've provided a remedy for this
Expand All @@ -263,6 +344,7 @@ Light Table out of the box doesn't support block commenting (well it only suppor
Pull requests are most welcome. Please do not include the transpiled files (*_compiled*) in the PR.

== History
* 0.2.0 Improved linting, introduced test support and support for elm-format
* 0.1.3 Bugfix: Forgot to include react.js (used for rendering package ui)
* 0.1.2 Package manager and 0.16.0 fix
** UI for managing your project packages.
Expand Down
Binary file added browsertests.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added consoletests.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions elm-light.behaviors
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,7 @@
[:editor.elm :lt.plugins.elm-light.test/elm-test]
[:editor.elm :lt.plugins.elm-light.test/elm-test-init]

;; Elm format
[:editor.elm :lt.plugins.elm-light/elm-format]

]
Loading

0 comments on commit 08c5393

Please sign in to comment.