Skip to content

Commit

Permalink
feat: update contributing.md and use lazydev.nvim
Browse files Browse the repository at this point in the history
  • Loading branch information
max397574 committed Jul 20, 2024
1 parent 49c5afe commit 54fe168
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 66 deletions.
34 changes: 20 additions & 14 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,26 @@ make format
```

## Type annotations
You can get third party libraries for type annotations by doing
```bash
make install_libraries
```

Then use
```bash
make gen_luarc
```
from the root directory of this repo to generate a `.luarc.json` file to configure luals to use the type annotations.

These two steps can be executed together with
```bash
make dev_setup
For type annotations it is recommended to use lazydev.nvim.
It can be setup with the following options:
```lua
{
"folke/lazydev.nvim",
ft = "lua", -- only load on lua files
opts = {
library = {
-- See the configuration section for more details
-- Load luvit types when the `vim.uv` word is found
{ path = "luvit-meta/library", words = { "vim%.uv" } },
{ path = "luassert/library", words = { "vim%.uv" } },
{ path = "busted/library", words = { "vim%.uv" } },
{ path = "neocomplete.nvim/lua/neocomplete/types/" },
},
},
},
{ "Bilal2453/luvit-meta", lazy = true },
{ "LuaCATS/busted", lazy = true },
{ "LuaCATS/luassert", lazy = true },
```

## Nix dev environment
Expand Down
12 changes: 0 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,5 @@ test:
LUA_CPATH="$(shell luarocks path --lr-cpath --lua-version 5.1 --local)" \
luarocks test --local --lua-version 5.1

install_libraries:
-rm -rf .libraries/
git clone https://github.com/LuaCATS/busted ./.libraries/busted
git clone https://github.com/LuaCATS/luassert ./.libraries/luassert
git clone https://github.com/LuaCATS/luv ./.libraries/luv

gen_luarc:
bash scripts/write_luarc.sh


dev_setup: install_libraries gen_luarc

format:
stylua lua/ spec/
37 changes: 0 additions & 37 deletions scripts/write_luarc.lua

This file was deleted.

3 changes: 0 additions & 3 deletions scripts/write_luarc.sh

This file was deleted.

0 comments on commit 54fe168

Please sign in to comment.