Polymer code completion in NetBeans IDE 8.0+
Updated for latest Polymer 1.0
This is a simple workaround to get code completion for Polymer (http://www.polymer-project.org/) in NetBeans in HTML files.
How to use it
- Close NetBeans IDE
- Download the
customs.json
(located https://github.com/ladariha/PolymerForNB/blob/master/dist/customs.json) file and place it intonbproject
folder which is located in your project folder (if you already have such file, you need to "merge" them, it is plain JSON) - Start NetBeans IDE
- Try code completion in HTML5 file, it should offer Polymer's elements and attributes
Why it works?
If you are using HTML5 in NetBeans, you can learn the editor your own custom HTML elements and their attributes. The process is following:
- Type your own custom tag in HTML file, e.g.
<myelement foo="1"></myelement>
- NetBeans will underline this element and mark it as error
- In editor, there is a bulb icon in the gutter instead of line number
- Click on the bulb icon
- IDE offers you couple of options, the intersted one is
Add element "myelement" to the project's custom elements
, click on it - NetBeans will create (if not existing already) file
[projectFolder]/nbproject/customs.json
and the error goes away - Click on the bulb icon again
- NetBeans will offer you to declare attribute
foo
as either attribute of themyelement
or as a global attribute (for all elements). Select some option - Try code completion for the
myelement
, you should see it in code completion list. The same should work for the attribute as well.
How to locally create a new customs.js file?
- Clone this repository or download it as archived ZIP
- open terminal, navigate to the cloned (or extracted ZIP) directory
- Run command
node src/index.js
- Once the command is finished, a new version of customs.js will be created in
dist
directory