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

Already on GitHub? Sign in to your account

Improved Lua indenting #834

Merged
merged 1 commit into from Jul 12, 2012

Conversation

Projects
None yet
2 participants
Contributor

tstarling commented Jul 5, 2012

Improved Lua indenting:

  • Support single-line blocks: don't indent the following line.
  • Indent the line following a line with unclosed parentheses, such as a
    function call where some parameters are specified on the same line as
    the name.
  • Use a negative next-line indent to restore the correct indenting level
    after the end of a multi-line parenthesized block where the ending
    parenthesis occurs with other text on the same line as it.
  • Implement outdenting. Outdenting is triggered after "enter" is pressed,
    similar to the Python mode. This avoids problems with incomplete token
    information, e.g. outdenting when the user is halfway through typing a
    quoted string "the end is nigh", where "end" is recognised as a
    keyword until the right quote is present.

Of course it is still flawed, anything less than a complete Lua parser will be flawed, but I'm pretty confident that the code here is better than what came before.

Improved Lua indenting
* Support single-line blocks: don't indent the following line.
* Indent the line following a line with unclosed parentheses, such as a
  function call where some parameters are specified on the same line as
  the name.
* Use a negative next-line indent to restore the correct indenting level
  after the end of a multi-line parenthesized block where the ending
  parenthesis occurs with other text on the same line as it.
* Implement outdenting. Outdenting is triggered after "enter" is pressed,
  similar to the Python mode. This avoids problems with incomplete token
  information, e.g. outdenting when the user is halfway through typing a
  quoted string "the end is nigh", where "end" is recognised as a
  keyword until the right quote is present.

Of course it is still flawed, anything less than a complete Lua parser will
be flawed, but I'm pretty confident that the code here is better than
what came before.
Contributor

tstarling commented Jul 5, 2012

I have sent a CLA to info@ajax.org.

nightwing added a commit that referenced this pull request Jul 12, 2012

@nightwing nightwing merged commit edf963e into ajaxorg:master Jul 12, 2012

Member

nightwing commented Jul 12, 2012

thanks, merged!

btw. wouldn't it be better if whole line after unpaired " was interpreted as a string, like in js mode?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment