stride icon indicating copy to clipboard operation
stride copied to clipboard

AssetCompiler - allow TABS in sdpkg

Open najak3d opened this issue 2 years ago • 3 comments

Another easy one. As I push down the "Code Only" approach, this came to light. I added a "Root Asset" to my sdpkg manually, but used TAB instead of 3 spaces, and it crashed the Asset Compiler. It would be great if the Asset Compiler treated TABs as whitespace, just like <SPACE>.

Here was the entry I was trying to make to my sdpkg:

RootAssets: - 1eddabed-b75e-4c92-89d6-6dfa4a96d502:Animations/Run

But mine prefixed with TAB instead of 3 spaces, and it caused critical failure for Asset Compiler. (i.e. "Encountered character that can not start any token.")

najak3d avatar Mar 20 '22 21:03 najak3d

This is just YAML spec. I wouldn't try to change that (just like I wouldn't start to use our own flavor of XML allowing both '<' and '[' or something like that).

xen2 avatar Mar 21 '22 01:03 xen2

However, I agree it would be good to have better prevention of such case. Maybe we should add an .editorconfig specifying spaces for *.sd* by default when creating a project?

xen2 avatar Mar 21 '22 01:03 xen2

The issue is with hand-editing, which should occasionally occur. That's how I ran into this.

Perhaps inside the exception handler, it should run some analysis code there to determine the issue -- such as finding the existence of "tabs" and then report that to the user in the error message. So the inefficiency of a more forgiving parser would be circumvented -- this extra logic would only be executed in response to an exception. And for now it would be just a few lines of code to look for 'tabs' -and tell user "Tabs not allowed in .sdpkg; use spaces."

najak3d avatar Mar 21 '22 20:03 najak3d