mirror of
https://github.com/LazyVim/LazyVim.git
synced 2026-07-23 21:11:05 +00:00
feat(lang): add luau support
This commit is contained in:
parent
c64a61734f
commit
39790a373c
1 changed files with 72 additions and 0 deletions
72
lua/lazyvim/plugins/extras/lang/luau.lua
Normal file
72
lua/lazyvim/plugins/extras/lang/luau.lua
Normal file
|
|
@ -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,
|
||||||
|
},
|
||||||
|
}
|
||||||
Loading…
Add table
Reference in a new issue