08 Mar 2011 | 19:04

Twig for Netbeans

On this page I want to give you some information about my Twig plugin for Netbeans. It provides code highlighting and syntax validation for Twig and makes it a lot easier to write templates.

Features

  • Twig code highlighting
  • Configurable colors
  • Highlighting of underlying HTML markup
  • Syntax validation (unclosed blocks an so on)
  • Code folds

Links & Download

You can download the current stable package at the Netbeans plugin portal.

If you want to get the current development version, you can download it at Github. If you want to contribute or just see the source code you can visit the project page of Twig-netbeans at github.

COMMENTS

Steve 28 Jun 2011 | 09:02

Hi,

I’ve made a reinstall of netbeans and lost my twig plugin for nb 6.9. Is there a place where I can I find it in that particular version ? I don’t see it on the nb plugin portal and netbeans 7.0 isn’t working properly on my system, so I would like to switch back to my old configuration…

Regards,

Steve

Sebastian Hörl 28 Jun 2011 | 18:29

You could download the Netbeans developer package for your Netbeans version, load the source code from https://github.com/blogsh/Twig-netbeans and build your own plugin package. I’m not sure whether the plugin uses 7.0-specific stuff, but it’s worth a try. However, tell me if you can get it work. If not I’ll try myself, but at the moment I’m quite busy so it may last some days…

Steve 30 Jun 2011 | 15:12

Ok, thanks. I’ll give it a try this weekend, but I’m afraid it could exceed my abilities, as I’m just a poor PHP developer… ;) .

geo 03 Jul 2011 | 11:38

On clean istall NB 7.0 i get these errors after install:

Warning – could not install some modules: SQL Editor – The module named org.netbeans.modules.editor.deprecated.pre65formatting/0-1 was needed and not found. Editor Formatting Prior 6.5 Separation – The module Editor Library 2 was requested in implementation version “8″ but only “9″ was found. Tags Based Editors Library – The module named org.netbeans.modules.editor.deprecated.pre65formatting/0-1 was needed and not found. XML Text Editor – The module named org.netbeans.modules.editor.deprecated.pre65formatting/0-1 was needed and not found. 17 further modules could not be installed due to the above problems.

too bad, this is the only twig syntax plugin out there…

Sebastian Hörl 04 Jul 2011 | 00:01

Which version do you use? The one from the plugin portal or the git version? On which operating system do you have these errors?
However the latest version on the plugin portal should work…

geo 04 Jul 2011 | 11:30

I used the latest version from netnbeans portal. When this error occured, PHP files were no longer recognized (no specific language colors, autocomplete, error check etc.), after removing the plugin the error still occured, so I reinstalled Netbeans and installed again the Twig extension (clean install) – again the error occured. So reinstalled again netbeans… so I gave up. I am using Windows 7 Proffesional SP1 x64 and latest Netbeans 7.

Sebastian Hörl 04 Jul 2011 | 15:05

@geo Hi! I see you are right, the plugin fails to install and disables the PHP plugin on a fresh Netbeans installation. I’ve found the following workaround: When fresh Netbeans starts it will give you the advice to update some plugins. If you install the Twig plugin after you have updated the native plugins everything should work. :)
I’m not quite sure why Netbeans won’t update to the latest versions when Twig is installed first, but I have to find out. Anyway thanks for your hint!

Sebastian Hörl 04 Jul 2011 | 15:33

@Steve Hi! I tried to build the plugin with Netbeans 6.9.1 and after solving some dependency issues everything seems to work as expected. I uploadedthe plugin package at github.

geo 04 Jul 2011 | 16:21

Hi Sebastian,
this solves the issue now it works OK :) (Clean install, update of all plugins and then – twig for neatbeans installation).
Thanks for the plugin and the help!

Steve 05 Jul 2011 | 17:12

Thanks a lot, Sebastian !

That’s exactly what I needed. Thanks for your work, and for having time to devote to users !

Best regards,

Steve

Ricard 06 Jul 2011 | 13:55

Hi Sebastian

Thanks for your work, it really works nice under Netbeans 7.0

However, it seems that there is a bug that makes Netbeans hung up for some time.
It happens when I type {} and then try to type %% inside {} to create Twig markers. Netbeans just hungs up and I have to kill the process or wait for a minute or so.

Maybe this is difficult to fix as it seems that it starts looking for some autocompletion stuff.

I am using Ubuntu Narwal x64 with Java 1.6.0_22 OpenJDK.

Anyway thanks again for your hard work integrating this nice templating system into Netbeans IDE.

Jan 12 Jul 2011 | 16:12

Testing the latest stable plugin, we encountered both bugs with Netbeans 7:

1. Using a fresh netbeans install, the plugin fails to install and disables several other plugins (i.e. the php plugin). Only a complete new installation of netbeans including an update of all plugins before installing the twigs plugin solved this.

2. Typing a % inside of {} causes a freeze of netbeans (using Windows 7 and Mac OS X).

Greats from Germany
Jan

Sebastian Hörl 19 Jul 2011 | 20:13

@Ricard & Jan: I’ll try to solve these problems soon. Atm I’m writing exams so it might take some time :)

Greetings back form Germany ;)

[...] http://blogsh.de/twig-for-netbeans/ : un plugin qui gère Twig. Encore en version beta mais pleinement utilisable [...]

Christian S. 01 Sep 2011 | 17:04

Hi. I have installed the plugin from Netbeans’ Plugin Portal and it worked very finde. Thank you very much. I hope TWIG Support will be included into Netbeans soon.

[...] tan solo acude al portal de plugins para netbeans, y descarga el plugin de twig. En la página del autor, puedes encontrar más información al [...]

Manuel 06 Mar 2012 | 11:44

Hi!

Is an update planned for Netbeans 7.1? Symfony2-Support is only available for 7.1 and Twig only until 7.0…

Thanks for this great plugin!

Sebastian Hörl 06 Mar 2012 | 20:12

Have you tried to install it in Nb7.1? Currently I’m working at my quite lame netbook where I have no Nb installed at the moment. But I think I used the plugin with Nb7.1 already on my desktop pc.

Edouard 06 Apr 2012 | 09:25

I can confirm that the plugin works with NB 7.1.1.

Thanks for your work !

Peter 19 Jan 2013 | 15:26

Hi! I am looking for a RainTPL highlighting plugin for NetBeans, your project is very interesting. Would you put online the Antlr grammar for Twig, as it would be easy to adjust for RainTPL. Thanks!

Sebastian Hörl 19 Feb 2013 | 07:39

The whole source of the project can still be found on github: https://github.com/blogsh/Twig-netbeans
Though I’m not sure what you mean with “Antlr grammar”… at least I’m pretty sure I didn’t use it :)

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" cssfile="">