modelica-tools / atom-language-modelica

Modelica language support for the atom editor
https://atom.io/packages/language-modelica
Other
8 stars 4 forks source link

settings for indentation #14

Closed thorade closed 8 years ago

thorade commented 8 years ago

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?

tshort commented 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:).

thorade commented 8 years ago

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.

lochel commented 8 years ago

I think the auto indentation works quite good now.

thorade commented 8 years ago

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.

lochel commented 8 years ago

It would be good if one/you could test the changes before the next version is published.

thorade commented 8 years ago

I would like to add protected and public also to the decreaseIndentPattern list. Should I just push to this branch?

thorade commented 8 years ago

Why is \t better than \s here? http://stackoverflow.com/questions/17950842/what-is-the-difference-between-s-and-t

lochel commented 8 years ago

[\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.

lochel commented 8 years ago

Thanks for testing and fixing. I think we can merge this request.

thorade commented 8 years ago

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?

bilderbuchi commented 8 years ago

[\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).

thorade commented 8 years ago

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?

lochel commented 8 years ago

BTW: How can one disable this feature? Just in case that anyone does not like it.

thorade commented 8 years ago

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.

bilderbuchi commented 8 years ago

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*).

thorade commented 8 years ago

And does it also match spaces before tabs?

lochel commented 8 years ago

Yes, it matches each composition of spaces and tabs.

thorade commented 8 years ago

Good, so now I know that, too. And now that we have this feature, do we want to keep it? Should I publish it?

lochel commented 8 years ago

Yes, let’s keep it. That's why we did it :-).

thorade commented 8 years ago

OK. It is published.

bilderbuchi commented 8 years ago

@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!)

thorade commented 8 years ago

Thanks @bilderbuchi , that looks really good!

thorade commented 8 years ago

@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)!

lochel commented 8 years ago

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.