Home

LINQPad hangs when editing script with errors with multiple cursors

I'm in the process of creating some classes representing some json data and to do this, I would paste the json as-is in the source file, add multiple cursors to apply attributes to the listed properties, then define the rest. However trying to do this with this case, LINQPad would hang pretty much indefinitely (waited a couple of minutes and it didn't complete, memory steadily climbing).

It hangs immediately upon typing a (. It's fine for a few properties but it seems like anything beyond 6 would cause it to hang.

Editing the lines individually, it really starts to slow down after 8 or so attributes then seems to hang exponentially longer after. I guess the parser is doing its damndest to parse and color the source. And with the open attribute, every following error multiplies the problems. Could this be handled better?

https://share.linqpad.net/jp8tdw9t.linq

Comments

  • Rather than type it all out, what happens when you paste in the text completely?

  • Not sure what you mean exactly. When it comes to making multiline edits like this, I would often do it in a separate editor (Sublime Text in my case), make my edits there with the cursors, and paste it back in to the original script.

    If I started with the json, had the text [JsonProperty( in my clipboard, add the cursors in front of all properties, and paste, it would lock up as if I typed in the open (.

    Going from the end of the line or somewhere midway doesn't quite work as well since it doesn't seem to be able to have separate horizontal positions for the cursors, they all must be on the same column and adjacent lines so it's less useful there.

    If the values did line up and I were able to add the closing )] for the attributes beforehand, it does at least work around the issue. I could then go to the beginning of the lines and enter the same [JsonProperty( text and have no issues.

  • I haven't been able to reproduce this, however there's a major rewrite in the works that's likely to help with editor performance.

Sign In or Register to comment.