diff --git a/lua/astrocommunity/pack/lua/README.md b/lua/astrocommunity/pack/lua/README.md index f50255014..51e3a70c3 100644 --- a/lua/astrocommunity/pack/lua/README.md +++ b/lua/astrocommunity/pack/lua/README.md @@ -6,3 +6,4 @@ This plugin pack does the following: - Adds `lua_ls` language server - Adds `stylua` formatter - Adds `selene` linter + - On `aarch64` machines this is skipped. diff --git a/lua/astrocommunity/pack/lua/init.lua b/lua/astrocommunity/pack/lua/init.lua index db9eee282..001a09e4d 100644 --- a/lua/astrocommunity/pack/lua/init.lua +++ b/lua/astrocommunity/pack/lua/init.lua @@ -2,13 +2,24 @@ local function selene_configured(path) return #vim.fs.find("selene.toml", { path = path, upward = true, type = "file" }) > 0 end +local is_aarch64 = vim.loop.os_uname().machine == "aarch64" + return { { "AstroNvim/astrolsp", optional = true, opts = { config = { - lua_ls = { settings = { Lua = { hint = { enable = true, arrayIndex = "Disable" } } } }, + lua_ls = { + settings = { + Lua = { + hint = { + enable = true, + arrayIndex = "Disable", + }, + }, + }, + }, }, }, }, @@ -32,14 +43,21 @@ return { "jay-babu/mason-null-ls.nvim", optional = true, opts = function(_, opts) - opts.ensure_installed = require("astrocore").list_insert_unique(opts.ensure_installed, { "stylua", "selene" }) + opts.ensure_installed = require("astrocore").list_insert_unique(opts.ensure_installed, { + "stylua", + (not is_aarch64 and "selene") or nil, + }) + if not opts.handlers then opts.handlers = {} end - opts.handlers.selene = function(source_name, methods) - local null_ls = require "null-ls" - for _, method in ipairs(methods) do - null_ls.register(null_ls.builtins[method][source_name].with { - runtime_condition = function(params) return selene_configured(params.bufname) end, - }) + + if not is_aarch64 then + opts.handlers.selene = function(source_name, methods) + local null_ls = require "null-ls" + for _, method in ipairs(methods) do + null_ls.register(null_ls.builtins[method][source_name].with { + runtime_condition = function(params) return selene_configured(params.bufname) end, + }) + end end end end, @@ -48,8 +66,11 @@ return { "WhoIsSethDaniel/mason-tool-installer.nvim", optional = true, opts = function(_, opts) - opts.ensure_installed = - require("astrocore").list_insert_unique(opts.ensure_installed, { "lua-language-server", "stylua", "selene" }) + opts.ensure_installed = require("astrocore").list_insert_unique(opts.ensure_installed, { + "lua-language-server", + "stylua", + (not is_aarch64 and "selene") or nil, + }) end, }, { @@ -64,13 +85,16 @@ return { { "mfussenegger/nvim-lint", optional = true, - opts = { - linters_by_ft = { - lua = { "selene" }, - }, - linters = { - selene = { condition = function(ctx) return selene_configured(ctx.filename) end }, - }, - }, + opts = function(_, opts) + if not is_aarch64 then + opts.linters_by_ft = { + lua = { "selene" }, + } + opts.linters = opts.linters or {} + opts.linters.selene = { + condition = function(ctx) return selene_configured(ctx.filename) end, + } + end + end, }, }