diff --git a/README.md b/README.md index 7c0f1bc..a08efac 100644 --- a/README.md +++ b/README.md @@ -1,35 +1,45 @@ # fennel-ls -A language server for fennel. +A language server for Fennel. Supports Go-to-definition, and a little bit of completion suggestions. Fennel-LS uses static analysis, and does not execute your code. -For now, you can ask fennel-ls to **treat your file as a macro file** if the very first characters in the file exactly match `;; fennel-ls: macro-file`. Expect this to change at some point in the future when I come up with a better way to specify which files are meant to be macro files. +You can ask fennel-ls to **treat your file as a macro file** if the first line +exactly matches `;; fennel-ls: macro-file`. Expect this to change at some point +in the future when I come up with a better way to specify which files are meant +to be macro files. -## Building / Installing -The build dependencies are `make` and `lua`. Lua 5.1 or higher is needed. Every other dependency is already included in the repository. See the License section at the bottom of the readme if you care about what other dependencies are being used. +## Table of Contents -Pick your favorite command to build and install the language server. +- [Installation](#installation) +- [Usage](#usage) +## Installation +I recommend building from source. I promise it's really easy! You need to have `make` and `lua` (5.1+). Every other dependency is included. See the License section at the bottom of this file for more info on the bundled dependencies. +### Make (writes the file `/usr/local/bin/fennel-ls`) ```sh -make && sudo make install # to install into /usr/local/bin -make && make install PREFIX=$HOME # if you have ~/bin on your $PATH +make && sudo make install +``` + +### Make (writes the file `$HOME/bin/fennel-ls`) +```sh +make install PREFIX=$HOME +``` + +### Make (writes the file `./fennel-ls`) +```sh +make ``` ### NixOS - -If you are using NixOS, you may use the included `/flake.nix` or `/default.nix` -to to build the language server configure a development environment. +If you are using NixOS, you can use the included `/flake.nix` or `/default.nix`. ### LuaRocks - -If you are specifically the Neovim plugin `mason.nvim`, or have some other -reason to support building on Windows, you may want to use the command: +I recommend just using `make` if possible, but if not, `fennel-ls` can be built with LuaRocks. ```sh luarocks install fennel-ls --tree /path/to/your/new/luarocks/tree ``` -## Set Up Your Editor - +## Usage Once you've installed the binary somewhere on your computer, the next step is to set up your text editor! Each editor has a different way of doing it. If you are using vim+lspconfig, it is pretty simple: @@ -48,7 +58,7 @@ Generally you need to give this information to your editor: * "fennel-ls" is a language server program on the $PATH * it should be run for .fnl files. -## Batch mode +## Usage You can gather diagnostics without connecting your editor: diff --git a/TODO.md b/TODO.md index e177ebe..9f9f339 100644 --- a/TODO.md +++ b/TODO.md @@ -2,7 +2,7 @@ ([X] = complete, [ ] = planned) My current goal is to work on completions a little bit more. -- [ ] create a release +- [X] create a release refactor brainstorm: - [ ] get rid of `bytes` stuff and use "stack" everywhere @@ -66,7 +66,10 @@ Here is my feature wishlist. I don't expect to ever get all of this done, but th - [.] `unpack` or `values` into a special - [ ] `do`/`values` with only one inner form - [ ] redundant `do` as the last/only item in a form that accepts a "body" - - [ ] `var` forms that could be `local` + - [ ] `values`/`unpack` in a non tail position + - [ ] numbers and strings in a non tail position + - [ ] deprecated specials/macros + - [X] `var` forms that could be `local` - [ ] Arity checking - [ ] Too many args (assuming there is no ... argument) - [ ] Too few args (assuming the last argument is statically countable, and also account for ?optional arguments) @@ -76,6 +79,7 @@ Here is my feature wishlist. I don't expect to ever get all of this done, but th - [ ] Dead code (I'm not sure what sort of things cause dead code) - [ ] Unused fields (difficult) - [ ] unification in a `match` pattern (difficult) + - [ ] unused values in `λ` (difficult) - [ ] Brainstorm more linting patterns (I spent a couple minutes brainstorming these ideas, other ideas are welcome of course) - [ ] Type Checking - [X] Hover over a symbol for documentation @@ -102,3 +106,11 @@ Here is my feature wishlist. I don't expect to ever get all of this done, but th - [ ] arbitrary fields (may affect code behavior, may modify other files) - [ ] formatting with fnlfmt - [ ] Type annotations? Global type inference? + + +fn-arg-nil: Function arguments are assumed to be nil in a function body, until there's a type system to give more information. + +hashfn: Hash functions currently don't work well. + +refs-dedup: + diff --git a/test/completion.fnl b/test/completion.fnl index b594abb..efe4932 100644 --- a/test/completion.fnl +++ b/test/completion.fnl @@ -161,7 +161,7 @@ []) (local things-that-are-allowed-to-have-missing-docs - {:lua 1 :set-forcibly! 1 :unpack 1 :setfenv 1}) + {:lua 1 :set-forcibly! 1 :unpack 1 :setfenv 1 :getfenv 1 :module 1 :newproxy 1 :gcinfo 1 :loadstring 1 :bit 1 :jit 1}) (check "(" [;; builtin specials @@ -175,7 +175,7 @@ :kind kinds.Keyword :documentation true}] [{:documentation #(= nil $) :label #(not (. things-that-are-allowed-to-have-missing-docs $))} - {:kind #(= nil $)} + {:kind #(= nil $) :label #(not (. things-that-are-allowed-to-have-missing-docs $))} {:label #(= nil $)}]) (check "(let [x (fn x [a b c]