Skip to content
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

js-beautify adds a space between # and include #1114

Closed
ghost opened this issue Jan 19, 2017 · 6 comments
Closed

js-beautify adds a space between # and include #1114

ghost opened this issue Jan 19, 2017 · 6 comments

Comments

@ghost
Copy link

ghost commented Jan 19, 2017

I'm using js-beautify when coding for Adobe After Effects that uses Javascript. The problem is that when I write #include js-beautify changes it to # include and breaks the code.
Is there a way to ignore # signs or another way to fix this or will it need to be done in the source-code?

Thanks!

@bitwiseman
Copy link
Member

The ignore directive might work:
https://github.com/beautify-web/js-beautify#directives-to-ignore-or-preserve-sections-javascript-only

Please provide an example input, expected output and actual output.

@ghost
Copy link
Author

ghost commented Jan 19, 2017

Input

The code looked like this before beautification:

#include "settings.jsxinc"

Expected Output

The code should have looked like this after beautification:

#include "settings.jsxinc"

Actual Output

The code actually looked like this after beautification:

# include "settings.jsxinc"

Putting my includes between beautify preserve fixed the problem! I searched for a good hour but for some reason I missed beautify preserve.
Thanks!

@bitwiseman
Copy link
Member

Note: the above is definitely not valid JavaScript, so it's not really a surprise that the beautifier doesn't handle it. Where can I find the spec for this language?

@bitwiseman bitwiseman added this to the Future milestone Jan 19, 2017
@ghost
Copy link
Author

ghost commented Jan 19, 2017

Here you have all documented info about Extendscript:http://download.macromedia.com/pub/developer/aftereffects/scripting/JavaScript-Tools-Guide-CC.pdf
I have used js-beautify for years with this language without problem except now with the #include

@bitwiseman bitwiseman modified the milestones: v1.7.x, Future Jan 19, 2017
@bitwiseman
Copy link
Member

I've pulled this into the next milestone. Getting the #include back is a minor change.

@MacKLess
Copy link
Collaborator

I just ran this on v1.8.6 and the break has evolved. It no longer adds a space between the '#' and the 'include', now it inserts a newline:
Actual output:

#
include "settings.jsxinc"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants