Comments (11)
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.
So... any updates on this? :-)
from lua-mode.
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.
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.
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.
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.
Cool, thanks!
from lua-mode.
So, how is it doing? :-)
from lua-mode.
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.
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.
from lua-mode.
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)
- highlighting and auto-indent problem with [[strings]] HOT 5
- 'local a =' makes '=' in warning face HOT 3
- Manually installation never working for emacs 27.0.90 HOT 3
- Please tag a new release HOT 4
- No highlighting in comment. HOT 5
- Very slow performance when inserting newlines HOT 5
- No license in the repository HOT 1
- sending whole buffer (lua-send-buffer) cause error
- Add an option to indent with tabs HOT 2
- unindenting 'end' without hitting RET HOT 2
- Indent lines of closers accroding to the first closer instead of the last closer HOT 3
- lua-send-buffer, unfinished string error HOT 1
- Extremely slow font-locking on lines with lots of dot operators HOT 1
- Extremely slow indentation inside tables HOT 3
- init-tryout ist distributed as part of the MELPA package
- Really bad performance while edit big lua table. HOT 3
- Support luacheck via Flymake HOT 1
- Indenting and new lines and other things I don't understand
- Indenting suggestion HOT 1
- Is there an option to highlight table keys?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lua-mode.