A fork of https://git.sr.ht/~xerool/fennel-ls/ for development purposes
Go to file
2023-06-02 17:34:19 -05:00
src Completions now come with some doc info 2023-06-02 17:34:19 -05:00
test Completions now come with some doc info 2023-06-02 17:34:19 -05:00
.gitignore reduce the prevelance of penlight 2022-08-01 18:21:27 -05:00
fennel Support completions of x: symbols 2023-05-27 21:10:49 -05:00
LICENSE Bump LICENSE Year 2023-05-02 23:57:28 -05:00
Makefile Makefile supports switching out Lua 2023-05-29 12:18:45 -05:00
README.md Description of Settings in the README 2023-05-03 00:27:27 -05:00
TODO.md clean up test code 2023-05-29 12:21:36 -05:00

fennel-ls

A language server for fennel-ls. 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.

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.

Pick your favorite command to build and install the language server.

make && sudo make install # to install into /usr/local/bin
make && make install PREFIX=$HOME # if you have ~/bin on your $PATH

For now, the only way to install is to build from source, but I plan on adding fennel-ls to luarocks soon.

Set Up Your Editor

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:

require('lspconfig').fennel_ls.setup()

For Emacs, (eglot, built-in to 29+):

(with-eval-after-load 'eglot
  (add-to-list 'eglot-server-programs '(fennel-mode . ("fennel-ls"))))

It should be possible to set up for other text editors, but the instructions depend on which editor you use. Generally this involves somehow configuring this information:

  • "fennel-ls" is a language server program on the path
  • it should be run for .fnl files.

If you get it working in any other environments, I'd love to know! It would be great to have instructions on how to set up other editors!

Default Settings

fennel-ls can be configured over LSP. Any setting that's not provided will be filled in with the defaults, which means that {} will be a valid configuration with default settings. You can provide different settings in the same shape as the default settings in order to override the defaults.

fennel-ls default settings:

{
  "fennel-ls": {
    "fennel-path": "./?.fnl;./?/init.fnl;src/?.fnl;src/?/init.fnl",
    "macro-path": "./?.fnl;./?/init-macros.fnl;./?/init.fnl;src/?.fnl;src/?/init-macros.fnl;src/?/init.fnl",
    "checks": {
      "unused-definition": true
    }
  }
}

License

fennel-ls is licensed under the MIT license. See LICENSE for more info. This project also contains files from other projects:

  • test/pl/* comes from Penlight [MIT license]
  • src/json/* comes from json.lua [MIT license]
  • test/lust.lua comes from lust [MIT license]
  • fennel and src/fennel.lua are compiled from fennel [MIT license]