lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Bertrand Mansion wrote:
> Is there a lua snippet that can "beautify" lua source code, especially
> indentation?
> This one <http://lua-users.org/wiki/SciteIndentation> doesn't work well,
> it's missing a lot of things code snippets within multiline comments for
> example.

I think it is likely that you will have to be the one to
contribute such a feature to the community.

For one thing, for generality, the program will have to somehow
tease Lua source code from normal text within a multiline comment.
If you have standard practices, the formatting might be easy to
parse, but then you are enforcing rules that are dependent on
specific developers. I can't recall any pretty printers supporting
formatting of source code within comments, but you can always hack
an existing pretty printer to suit your practices.

That said, the SciTE script in the above link does look primitive.
Actually I think the SciTE syntax highlighting lexer is pretty
accurate, so an SciTE script might work better if it retrieves
indentation or folding information from the editor itself.
However, to reformat code inside a comment block, you might have
to manually uncomment the snippet before applying the reformatting
operations.

Others might have better ideas or suggestions than the above,
which is highly speculative.

HTH,
-- 
Cheers,
Kein-Hong Man (esq.)
Kuala Lumpur, Malaysia