Giter Site home page Giter Site logo

Comments (11)

vhallac avatar vhallac commented on June 11, 2024

It would have been great to be able to have an indentation configuration somewhat like the cc-mode, but the current state of affairs is nowhere near that. As you've said yourself, it is the last rule in your list that causes the biggest headache, and unfortunately, even with hacking the code, I don't see an easy way to fix this. I will think about either a quick fix, or a way to make things configurable, but so far, I've got nothing.

One possibility is generating a list of syntax entries instead of simply adding the indentation rules for the modifier in lua-make-indentation-info-pair (the relative and absolute settings), and then converting the entries to the relative and absolute symbols later. I am thinking on this on and off, but it needs to cook a little more in the backburner, I think.

Of course, if someone can get the semantics integration, or maybe even the SMIE indentation support (not sure if this is as good as the semantic mode), that would solve your problems, but I don't see us getting anywhere near that goal soon either.

from lua-mode.

agladysh avatar agladysh commented on June 11, 2024

So... any updates on this? :-)

from lua-mode.

immerrr avatar immerrr commented on June 11, 2024

Hi, unfortunately, no.

But there's good news. I think I'm very close to implementing multiline constructs properly in terms of Emacs24 and the next thing on the list is the indentation engine.

from lua-mode.

immerrr avatar immerrr commented on June 11, 2024

Hey, actually, todays bugfix for #26 (8d28342) might have fixed some of incompatibilities with your guidelines.

Three things I see now:

  • unindented block-close tokens should be in fact indented by different level
    • easy fix
  • table constructor in return statement is considered a "statement continuation" line and is indented
    • requires some tinkering, but doable
  • lambda-function args block is not unindented properly
    • this might be tough to do without nasty hacks

from lua-mode.

immerrr avatar immerrr commented on June 11, 2024

unindented block-close tokens should be in fact indented by different level
easy fix

Made unindentation offset customizable in refactor_indentation branch.

from lua-mode.

immerrr avatar immerrr commented on June 11, 2024

lambda-function args block is not unindented properly
this might be tough to do without nasty hacks

Done in ca39a4a. Two down, one to go.

from lua-mode.

agladysh avatar agladysh commented on June 11, 2024

Cool, thanks!

from lua-mode.

agladysh avatar agladysh commented on June 11, 2024

So, how is it doing? :-)

from lua-mode.

immerrr avatar immerrr commented on June 11, 2024

Well, there's good news and there's bad news. :)

The bad news is that the issue remains: indentation engine needs a rewrite and with lua-mode remaining a hobby project it probably won't happen in nearest future. The good news is that I've finally added automatic tests infrastructure to the project and covering indentation corner cases with tests will facilitate the rewrite significantly.

from lua-mode.

cigumo avatar cigumo commented on June 11, 2024

This is a comparison between version 20110428 and 20130419 indentation.
As you can see the anon function is properly indented in the old version, as the second if block and the third.

screen shot 2014-10-21 at 3 03 39 am

from lua-mode.

Ambrevar avatar Ambrevar commented on June 11, 2024

I recently made a pull-request (#80) for a full indentation engine rewrite.
Indenting
https://gist.github.com/agladysh/37855303239506a16731
almost yield the expected result. Two differences:

  • Function parameters have one indent only.
  • The continuing lines.

But the point is not to adapt the engine to the taste of one user, but to make it customizable. My engine rewrite simplifies a great deal the previous version: only 3 functions play 3 distinct roles:

  • indent impact for current line
  • indent impact for next line
  • indentation of current line

It believe this is a saner basis to start from in term of indent customization.
A few variables can easily be added to control the work flow. For instance the continuing line indentation can be easily bo toggled off.

However the function parameters are a different matter as they require some semantic analysis. As far as I know, there is no Lua semantic analyzer for Emacs. Fortunately, Lua is easy to parse, but still, this would be quite some work. Plus semantic analysis is way slower than a 2-lines context indentation.

from lua-mode.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.