From 2d9c206552663ade1cadca6792486786534cd0a2 Mon Sep 17 00:00:00 2001 From: Fabien Freling Date: Tue, 11 Mar 2025 13:33:18 +0100 Subject: [PATCH] setup luacats --- flake.lock | 17 +++++++++++++++++ flake.nix | 8 +++++++- justfile | 3 +++ tools/gen-luarc.nu | 8 ++++++++ tools/luarc_sample.json | 19 +++++++++++++++++++ 5 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 tools/gen-luarc.nu create mode 100644 tools/luarc_sample.json diff --git a/flake.lock b/flake.lock index 3af5933..d24df7d 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,21 @@ { "nodes": { + "luacats": { + "flake": false, + "locked": { + "lastModified": 1740447442, + "narHash": "sha256-naorkTPkgJiEevBfpdRQtbCikN5YGiqWeIAWzCsEW4Q=", + "owner": "notpeter", + "repo": "playdate-luacats", + "rev": "7e56adacbbaceef923f24d898706aa3dec2225c1", + "type": "github" + }, + "original": { + "owner": "notpeter", + "repo": "playdate-luacats", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1740367490, @@ -38,6 +54,7 @@ }, "root": { "inputs": { + "luacats": "luacats", "nixpkgs": "nixpkgs", "playdate-sdk": "playdate-sdk" } diff --git a/flake.nix b/flake.nix index e3cc328..263a0d0 100644 --- a/flake.nix +++ b/flake.nix @@ -7,9 +7,13 @@ url = "github:RegularTetragon/playdate-sdk-flake"; inputs.nixpkgs.follows = "nixpkgs"; }; + luacats = { + url = "github:notpeter/playdate-luacats"; + flake = false; + }; }; - outputs = { self, nixpkgs, playdate-sdk }: + outputs = { self, nixpkgs, playdate-sdk, luacats }: let system = "x86_64-linux"; pkgs = nixpkgs.legacyPackages.${system}; playdate-sdk-pkg = playdate-sdk.packages.${system}.default; @@ -18,12 +22,14 @@ mkShell { env = { PLAYDATE_SDK_PATH = playdate-sdk-pkg; + LUACATS_PATH = luacats.outPath; }; nativeBuildInputs = [ just lua-language-server playdate-sdk-pkg + nushell tup ]; }; diff --git a/justfile b/justfile index f71d7ed..1ca5b64 100644 --- a/justfile +++ b/justfile @@ -11,3 +11,6 @@ simu: build cook-assets: @(which aseprite > /dev/null) || (echo "Missing aseprite program"; exit 1) tup + +setup: + tools/gen-luarc.nu diff --git a/tools/gen-luarc.nu b/tools/gen-luarc.nu new file mode 100644 index 0000000..d2d1b47 --- /dev/null +++ b/tools/gen-luarc.nu @@ -0,0 +1,8 @@ +#!/usr/bin/env nu + +def main [] { + const here = path self . + let sample = open ($here | path join luarc_sample.json) + mut updated = $sample | update "workspace.library" { $env.LUACATS_PATH} + $updated | save --force ($here | path join .. .luarc.json) +} diff --git a/tools/luarc_sample.json b/tools/luarc_sample.json new file mode 100644 index 0000000..0cf1799 --- /dev/null +++ b/tools/luarc_sample.json @@ -0,0 +1,19 @@ +{ + "$schema": "https://raw.githubusercontent.com/sumneko/vscode-lua/master/setting/schema.json", + "diagnostics.globals": ["import"], + "diagnostics.severity": { + "duplicate-set-field": "Hint" + }, + "format.defaultConfig": { + "indent_style": "space", + "indent_size": "4" + }, + "runtime.builtin": { + "io": "disable", + "os": "disable", + "package": "disable" + }, + "runtime.nonstandardSymbol": ["+=", "-=", "*=", "/=", "//=", "%=", "<<=", ">>=", "&=", "|=", "^="], + "runtime.version": "Lua 5.4", + "workspace.library": [] +}