From 39790a373cb9056f488d90a04839ade07fc58f74 Mon Sep 17 00:00:00 2001 From: lopy <70210066+lopi-py@users.noreply.github.com> Date: Wed, 24 Dec 2025 22:46:52 -0500 Subject: [PATCH] feat(lang): add luau support --- lua/lazyvim/plugins/extras/lang/luau.lua | 72 ++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 lua/lazyvim/plugins/extras/lang/luau.lua diff --git a/lua/lazyvim/plugins/extras/lang/luau.lua b/lua/lazyvim/plugins/extras/lang/luau.lua new file mode 100644 index 00000000..b7776374 --- /dev/null +++ b/lua/lazyvim/plugins/extras/lang/luau.lua @@ -0,0 +1,72 @@ +local rojo_project + +return { + recommended = function() + return LazyVim.extras.wants({ + ft = "luau", + root = { + ".luaurc", + ".config.luau", + "*.project.json", + }, + }) + end, + + { + "nvim-treesitter/nvim-treesitter", + opts = { ensure_installed = { "luau" } }, + }, + + { + "neovim/nvim-lspconfig", + opts = { + servers = { + luau_lsp = {}, + }, + setup = { + luau_lsp = function(_, config) + -- luau-lsp.nvim configures it's own lsp so forward the config to it + vim.lsp.config("luau-lsp", config) + return true + end, + }, + }, + }, + + { + "stevearc/conform.nvim", + optional = true, + opts = { + formatters_by_ft = { + luau = { "stylua" }, + }, + }, + }, + + { + "lopi-py/luau-lsp.nvim", + ft = "luau", + init = function() + rojo_project = vim.fs.root(0, function(name) + return name:match(".+%.project%.json$") + end) + + if rojo_project then + vim.filetype.add({ + extension = { + lua = function(path) + return path:match("%.nvim%.lua$") and "lua" or "luau" + end, + }, + }) + end + end, + opts = function() + return { + platform = { + type = rojo_project and "roblox" or "standard", + }, + } + end, + }, +}