UI5ers Buzz #18: Useful Little Helpers — Faster SAPUI5 Development in WebStorm
Fortunately the dark days of SAPUI5 Development lie way behind us and we have reasonable tool support today. Everybody can get going quickly using SAP Web IDE.
However many choose alternative Editors or IDEs. Today we will be looking into the ‘why’ and ‘how’ to do that. We will concentrate on WebStorm and introduce some useful helpers to improve your SAPUI5 development experience in this great IDE.
SAP Web IDE – To Use Or Not To Use
SAP Web IDE is certainly a huge step forward coming from SAPUI5 Tools for Eclipse. It let’s you start SAPUI5 Development in no time with zero setup or configuration effort. You can even write plugins for it, run it locally and what not.
But most importantly it comes with a whole lot of cool features. Think of app templates, WYSIWYG editing of views, bindings and extensions, mock data generation, test frames, eslint, grunt, deployment and last not least code completion.
And therefore I do use SAP Web IDE for certain tasks. But – just like many fellow devs – for the real development work I very prefer a different solution. Because here are some problems I discovered with SAP Web IDE:
- limited editor features
- limited code completion
- no code navigation
- limited freedom to use the tools I want
- limited control of the environment
- performance – well, the lack of it…
- session timeouts
Why I Prefer WebStorm
Downside: It takes about half a day to manually configure it for SAPUI5 development!
Just kidding. The great and active SAPUI5 community has you covered with some nice little helpers that make SAPUI5 development in WebStorm quite convenient. And they are all free and open-source (contributions welcome)!
DANGER: Node.js needed from here on
WebStorm on SAPUI5 Community Steroids
Probably the most essential thing to have is code completion. So let’s get that configured quickly.
Here is how to get JS Code Completion with UI5 codecompletion (thanks to Volker Buzek).
$ npm install -g ui5-codecompletion $ ui5-codecompletion install
Unfortunately WebStorm is not supporting SAPUI5 AMD and particularly not sap.ui.define (it does support require.js and define though…). Therefore code completion and navigation is inaccurate. You can improve that behavior by using JSDoc @type which admittedly is awkward and only works for vars not for function parameters D:
XMLView and XMLFragment Code Completion
Configuring XML Code Completion with UI5 Schemas (that’s the little
thingy I wrote) is just as easy.
$ npm install -g ui5-schemas $ ui5-schemas
Another nice feature of WebStorm is custom File Templates. Hans-Peter Seitz has written a good one on that topic. There are also Live Templates which are definitely worth looking at.
For more OpenUI5 related community projects visit openui5.org.
Previous Post: UI5ers Buzz #17
Christian is neither associated nor paid by JetBrains 😉
you can work around the missing sap.ui.define support by adding @lends at the relevant parts, e.g.
Then at least navigation between custom controllers/controls is possible.
Thanks for the tip. Will try!
Nice post, thanks! I will definitely try this out!
Is there any module or configuration that lets me beautify the code exact the same way as in SAP Web IDE?
Code > Reformat Code (ALT+CMD+L on OS X)
Yes, but WebIDE has its own "beautifier".
I was wondering if it is possible to have the EXACT SAME formatting in WebStorm as in WebIDE?
Would be easy to configure or export/import if SAP would provide an open ecosystem...
Finally found the Beautifier Settings… It is 8 (in words: eight) settings Shouldn’t be that hard to transfer.