Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Indenting suggestion #205

Open
lemzwerg opened this issue Dec 22, 2022 · 1 comment
Open

Indenting suggestion #205

lemzwerg opened this issue Dec 22, 2022 · 1 comment

Comments

@lemzwerg
Copy link

lemzwerg commented Dec 22, 2022

With version 20220801.503, I get code formatted like the following (I use two spaces for indentation)

if umatch(uchar(c1.char), "[%l%u_]")
  and umatch(uchar(c2.char), "[%l%u_]")
  and umatch(uchar(c3.char), "[_-]")
  and umatch(uchar(c4.char), "[%l%u]")
  and umatch(uchar(c5.char), "[%l%u_]") then
  local pen = node.new(PENALTY)
  pen.penalty = tex.hyphenpenalty
  node.set_attribute(pen, code_attribute, 1)
  node.insert_after(head, c3, pen)
end

IMHO, the positioning of and is unfortunate, since it makes it hard to recognize where the code block actually begins. What I would like to have is a new variable lua-indent-continuation-line-level to get this:

if umatch(uchar(c1.char), "[%l%u_]")
     and umatch(uchar(c2.char), "[%l%u_]")
     and umatch(uchar(c3.char), "[_-]")
     and umatch(uchar(c4.char), "[%l%u]")
     and umatch(uchar(c5.char), "[%l%u_]") then
  local pen = node.new(PENALTY)
  pen.penalty = tex.hyphenpenalty
  node.set_attribute(pen, code_attribute, 1)
  node.insert_after(head, c3, pen)
end

Maybe such a feature is already available; however, I couldn't find it.

@lemzwerg
Copy link
Author

Ping!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant