Closed thorade closed 8 years ago
I don't know what this is even supposed to do, and I'm squeezed on time now (you're hard to keep up with:).
I think this is supposed to increase/decrease indentation, e.g. if you type for loop
and then hit enter, then the new/next line should have two more spaces than the previous one.
But I think it is not working properly, so it needs testing and fixing.
The PR is just here so the code does not get lost, there is no hurry to merge it.
I think the auto indentation works quite good now.
I can try to do some testing tomorrow. If you tested it already then you can just merge it and apm publish the next minor or patch version.
It would be good if one/you could test the changes before the next version is published.
I would like to add protected
and public
also to the decreaseIndentPattern
list. Should I just push to this branch?
Why is \t
better than \s
here?
http://stackoverflow.com/questions/17950842/what-is-the-difference-between-s-and-t
[\t ]
is a subset of \s
(\s
usually also contains newline characters).
I can just update my commit (for a clean history after merging) or you can or you can add a new commit to this branch. It’s up to you.
Thanks for testing and fixing. I think we can merge this request.
I am not good at all with regex, so I still do not understand why \t
matches everything we want it to match. Why do we want to match only tabs and not normal spaces?
[\t ]*
matches zero or more tabs and/or spaces (i.e. what you use for indentation), but not newlines, etc. (i.e. the other characters contained in \s
, which we don't want to match).
OK, then I misunderstood the answers on stackoverflow or they do not apply here. @lochel please merge this.
As this adds new features, lets publish it using apm publish minor
.
Who will do that?
BTW: How can one disable this feature? Just in case that anyone does not like it.
There are some settings related to indentation in Atom->File->Settings, but I think they all work globally. If you consider auto-indentation to be annoying, we can also completely remove it. Even without this settings file Atom does some auto-indentation.
OK, then I misunderstood the answers on stackoverflow
no, I think you just overlooked the space in the brackets - i.e. [\t ]*
vs. [\t]*
(which is functionally the same as \t*
).
And does it also match spaces before tabs?
Yes, it matches each composition of spaces and tabs.
Good, so now I know that, too. And now that we have this feature, do we want to keep it? Should I publish it?
Yes, let’s keep it. That's why we did it :-).
OK. It is published.
@thorade check out this page (and especially the explanation section on the right). Another example from this PR: https://regex101.com/r/jZ2pN0/2 (I love that page for tweaking/understanding regexes!)
Thanks @bilderbuchi , that looks really good!
@lochel One can also turn of auto indentation for certain grammars only: Go to Settings->Packages and click on the package (anywhere in the grey box but NOT on the text)!
Go to Settings->Packages and click on the package
I see! Therefore the package need to be stored in a folder named "language-modelica" instead of "atom-language-modelica", otherwise the config page is empty.
Raphael's package did not have such a file. Is it needed, should we add this? Not sure if it works as expected, could someone help with testing?