Closed esidegallery closed 1 year ago
I've found that if I change the end-of-line sequence option in VS Code from CRLF to LF I can get full formatting to work. However, there seems to be a critical mass of code you can reach which causes the formatter to crash. I've attached the console output below as it's too long to paste:
It's hard to determine what exactly causes this threshold to be crossed, as it seems to differ depending on the content of the Script tag. Take the following file (I had to add a .txt extension to get it to upload):
Ensuring EOL is set to LF, I can get this file to crash the formatter by duplicating lines in the ListCollection block and then get it to work again by removing lines.
Empty lines don't affect this, but whitespace characters do seem to have an effect.
Thanks. I may not have tested much with CRLF because I tend to avoid it, even on Windows. I'll check that out. I'll also investigate the crash, which seems to be from a regular expression.
I admit I never thought to change it from the default 'auto' setting in VS Code, but have done now!
apache/royale-compiler@d76804aae02115dbb76c09eb3b39ab183281da5f
Sorry to be a pest, but just wondering if this looks fixable (either the CRLF or LF - whichever is easier!) It would be such a massive enhancement to my workflow if so.
I posted the commit in the Royale compiler where it was fixed. I'm just waiting on the next Royale release to include it in vscode-as3mxml.
Awesome! 🎉
Josh, it appears that MXML formatting is broken in a similar way for both CRLF and LF style line endings. If the Script contents is too long, formatting breaks, but removing lines will eventually allow it to work. The strange thing is that once it works, I can re-add lines and it will still work - up to a point at least. CRLF seems to be a little more sensitive than LF. This is a Windows PC btw. I'm using the file I posted above for the example below:
Shall I create a new issue for this?
Yeah, create a new issue. Be sure to click the "Go to output" button and copy the exception that is reported.
This is confirmed in a fresh installation of the latest VSCode with the ActionScript & MXML extension on Windows 10 x64.
The opening Script tag is unindented and the ActionScript inside isn't formatted.