Lua rocks formatting addon for premake5 #344
|
hello i am the developper behind the luarocks premake-language-support addon. the defenition files work great. but what i am wondering is if there is a way i can make a formating plugin for said premake5 scripts (see example script below). the problem/questionAs you can see the premake script is just a collection of function calls. workspace "WorkspaceName"
architecture"x86_64"
configurations { "Debug", "Release" }
project "ProjectName"
kind "ConsoleApp"
language "C"
targetdir "bin/%{cfg.buildcfg}"
files { "src/**.c", "include/**.h" }
filter "configurations:Debug"
defines { "DEBUG" }
symbols "On"
filter "configurations:Release"
defines { "NDEBUG" }
optimize "On" |
Replies: 1 comment 1 reply
|
An addon can include a For Premake's indentation-by-function-call semantics, first check whether EmmyLuaCodeStyle can express the layout you need. If it cannot, the robust approach is a separate Premake-aware formatter that implements your editor's formatting command (or an LSP In other words: the definitions belong in this addon, but a formatter with Premake-specific scope rules should be its own tool. A LuaLS |
An addon can include a
plugin.lua, but LuaLS plugins operate on the language-server analysis pipeline; they are not a replacement formatter API. The built-in formatter is EmmyLuaCodeStyle and is configured through.editorconfig/Lua.format.defaultConfig.For Premake's indentation-by-function-call semantics, first check whether EmmyLuaCodeStyle can express the layout you need. If it cannot, the robust approach is a separate Premake-aware formatter that implements your editor's formatting command (or an LSP
textDocument/formattingserver), while keeping the LLS addon for definitions and diagnostics.In other words: the definitions belong in this addon, but a formatter with Premake-specific…