-
Notifications
You must be signed in to change notification settings - Fork 352
indentation refactoring #515
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
more testing needed for this, everything is working(except for a few string problems,and generally worse performance, which i hope to fix) |
this is largely finished, if your reading this can you please test? performance suffers within large blocks of code but the simplification makes this a fair trade in my opinion |
I'll test this today, and report here with any regressions or bugs. |
Testing has so far revealed only one thing I'd definitely call a bug, and a couple of other things which are perhaps a matter of personal preference. The former I can only reproduce on a fairly large file, and I'm having trouble producing a minimal test case. In fact, it almost seems like the size is to blame, since changing the file at all seems to resolve the bug. That file is proprietary, so I can't share it, sadly. Once I've managed to make a minimal test case, I'll put it here. I'll describe the other personal preference "bugs" later, too, when I have some time. |
Bizarrely, it seems that this bug I mentioned only happens when the file I'm working with is 1035 lines or more long. If I remove any line in the file, even blank lines, before, inside or after (?!) the incorrectly indented code, it then indents the whole file correctly. |
these are caused by the timeout for the search pair function, default is 300 ms. maybe it should be configurable if this gets merged |
i have a few ideas for improving the speed issue, 300 ms is too much(though it would only take that long in a very big block scope) |
this limits the amount of matches search pair finds, this regex needs work
I think this is good to merge to develop for further testing and speed improvements
@markrian there have been improvements to this, is this working any better for you? |
I'll take a look tomorrow. Sounds good! |
So this sounds like it might be an improvement over |
& removing needless if's
I think this is about done, if you see any regressions let me know. also i am glad to hear any suggestions on what i've tried here |
premature optimization which had the opposite effect
I'm afraid I've found another indenting bug. Trying to produce minimal test case. |
It seems to be another idempotency issue. The follow correctly indented code stays intact after one 'use strict';
function foo() {
} but a second call results in this: 'use strict';
function foo() {
} and subsequent calls indent the function further and further. |
Just found another one. Do/while loops mess up indentation of the line immediately following them: function foo() {
do {
anything();
} while (false)
anything();
anything();
} |
i think the first issue is fixed but the do while syntax makes it very unlikely that can be solved unless there is a do block syntax element added, which may or may not be possible |
actually,i'll try and port this |
been on vacation this past week, hopefully someone was testing this as I'd like to finish and merge it tomorrow |
Overall, things have been pretty good, however I have found a couple weird instances, mostly working within JSX files, not sure if they are related to JSX, or if it's something deeper with JS. I'll see if I can isolate the problems over the next couple days. |
However, at this point, it may be worth merging this in and then working to fix the rest of the issues over time? Also getting it into |
Sounds fine, i'll merge after a few finishing touches |
No description provided.