Closed tonyhallett closed 4 years ago
Hi, thanks for your bug report. I just tried it and can reproduce the problem in my test environment. I'm not entirely sure if this code causes an endless loop or it just takes very long to format. Regardless I want to fix this. Unfortunately I cannot make it today but hopefully I will have some time to work on it in the upcoming days.
I will udpate you as soon as I start investigating further.
I investigated the issue and found the cause. It appears to be a performance problem where the computing load scales exponentially with the use of some kinds of expressions, especially if expressions. I'm working on a fix but since performance optimizations are not trivial this might require a lot of refactoring.
I deployed the fix right now. Instead of refactoring the whole code base in order to optimize performance overall I created a workaround that speeds up the nested expressions that caused the problem. I also fixed some other formatting issues regarding InvokeExpressoins and simple ArithmeticExpressions. Regarding performance your query now takes less than a second (on my laptop and with 100 characters line space. The less line space the more iterations are needed for the formatter so performance will go down if you lower this number). Let me know if there are any additional problems.
Closing this for now.
Description Web formatter hangs
Power Query- / M-Code Taken from unit testing
Expected behavior It works