Has anyone got a good tool or plugin to correctly ...
# suitescript
c
Has anyone got a good tool or plugin to correctly display and auto format PDF templates? I need matching tags, braces etc.
a
lol honestly i just suffer though it, or manually fix it myself if its really bothering me... apparently there's a vscode plugin for it. but i don't use vscode or this plugin so... i have no idea if its any good https://marketplace.visualstudio.com/items?itemName=AntonLilleby.xp-freemarker-formatter
c
I don't use vscode but I'll abandon my principles for a tool that actually works. The templates I'm looking at now are too long, complex, and messy to look at any longer. I can't do it by hand because it's too big but how do you get NS to keep the formatting you do by hand?
a
err i don't i just keep my version of that i fixed 😄
tbh i don't work with pdf templates so much these days so its not as regularly annoying as it used to be for me personally
c
installed, can't see any difference 😄
a
lol idk how it works you might have to right click and actually TELL it to reformat
c
image.png
after I forced it
facepalm 1
🤮 1
Nevermind 🤷
e
IntelliJ supports freemarker.
c
@ehcanadian I've tried standard and a plugin. I just can't get it to work with the PDF templates
They still look terrible without matching HTML tags, no auto indent, it doesn't understand where an if starts or ends etc. Am I doing something wrong? Could it be because of the BFO tags?
Is this the plugin you're using?
e
I think it's built-in, but I could be wrong. Do your files have the .ftl file extension?
c
.gtl made some difference but the auto formatting is still wrong in places
many places
image.png
I guess there's only so much it can do if the previous devs didn't care about the formatting
e
I guess you could try asking your favorite AI to fix it
s
.ftl = a faster-than-light file?
ultra fast parrot 1
c
jetbrains IntelliJ supports freemarker/templating. I've used it to mess around with formatting.
Like you can get a realtime view while writing it
c
How does the realtime view work?
I've got the source mostly formatted correctly now thanks to intelli and the AI assistant.
I don't see how a realtime view will work given the freemarker conditional statements which intellij doesn't have the runtime for @creece ?
c
I've just used it for the layout/formatting of the template itself. It won't be able to display netsuite stuff.
c
Where can I see that view?
c
You're right I was wrong. It was a plugin I had not a native built in. It just supports the syntax stuff natively. My bad there.
👍 1
There's https://try.freemarker.apache.org (the online template tester) that's been pretty useful to. You can even specify your data model which is nice.
c
Trying to do the formatting with AI is a pain. It removes random bits of code, adds comments that aren't true etc.
e
Try telling it not to remove code and only add missing matching elements/tags. Start with a small sample template and keep editing your prompt.
c
Yeah, I'm prompting the life out of this thing. It's scary how it can make massive mistakes without you noticing. Ive got functional consultants telling me they've started using AI instead of actual SS devs. I feel like we're going to see a wave of failed AI projects etc before this matures.
💯 2
1000000 1
c
What are you trying to do exactly w/ the layout? I've typically just done layouts through tables and specified widths etc... It's always a pain but that has worked well for me
c
I have several templates that I need to modify. Just the usual. They are around 2000 lines each with heavily nested conditionals. I am removing as much of the bloat as possible and generally fixing them to meet the template requirements. The lack of formatting makes it impossible to maintain though.
I've spent a few hours with intellij and AI to knock them into shape so I can work on them.
c
That definitely sounds like a mess. No functions or macros i take it either in all of that?
c
Correct.
p
@Craig, I suggest use a javascript templating library like handlebars instead of NetSuite's Advanced PDF. I've been using it for a long time. You can generate a JSON object using SuiteQL, then have the HTML template. Combine the JSON and HTML template using handlebar.
Since you are using HTML with handlebars tag, you can format it just like a normal HTML. Plus, you can do complex logic that Advanced PDF cannot do.
💯 1
I would also recommend, prettier plugin.
c
That sounds fantasic and I will check it out. That will never get approved on this project though.