Coder Social home page Coder Social logo

twig-eclipse-plugin's Introduction

Twig Eclipse Plugin

Build Status

Requirements

  • Eclipse >= 4.10.0 (aka 2019-06)
  • Java >= 8

INSTALLATION

You can choose between the stable and the nightly build. Stable version is released in sync with PDT.

The nightly updatesite is build once a day automatically and published if all tests succeed. I'm using the nightly version myself for my production projects, so you can be quite certain that no major bugs make it into the nightly updatesite ;)

If you want to use the nightly build, make sure to also add the PDT nightly updatesite: http://download.eclipse.org/tools/pdt/updates/latest-nightly!

Updatesite

It's inside the "Text Editors / Productivity Tools" category:

http://p2.pdt-extensions.org/

Nightly Updatesite

It's inside the "Text Editors / Productivity Tools" category:

http://p2-dev.pdt-extensions.org/

twig-eclipse-plugin's People

Contributors

maoueh avatar michaelklishin avatar pulse00 avatar zulus avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

twig-eclipse-plugin's Issues

Twig-Editor fails to initialize after update

The Twig-Editor cannot be initialized anymore, see this stack trace:

java.lang.NoClassDefFoundError: org/eclipse/dltk/compiler/problem/ProblemSeverity
    at org.eclipse.twig.core.TwigCorePreferences.getSyntaxErrorSeverity(TwigCorePreferences.java:35)
    at org.eclipse.twig.core.compiler.ast.parser.error.TwigErrorReporter.reportError(TwigErrorReporter.java:45)
    at org.eclipse.twig.core.compiler.ast.parser.TwigParser.displayRecognitionError(TwigParser.java:111)
    at org.antlr.runtime.BaseRecognizer.reportError(BaseRecognizer.java:186)
    at org.eclipse.twig.core.compiler.ast.parser.TwigParser.method(TwigParser.java:3528)
    at org.eclipse.twig.core.compiler.ast.parser.TwigParser.twig_if(TwigParser.java:2054)
    at org.eclipse.twig.core.compiler.ast.parser.TwigParser.twig_control(TwigParser.java:425)
    at org.eclipse.twig.core.compiler.ast.parser.TwigParser.twig_control_statement(TwigParser.java:250)
    at org.eclipse.twig.core.compiler.ast.parser.TwigParser.twig_source(TwigParser.java:190)
    at org.eclipse.twig.core.compiler.ast.parser.TwigSourceParser.parseTwig(TwigSourceParser.java:121)
    at org.eclipse.twig.core.compiler.ast.parser.TwigSourceParser.parseStatement(TwigSourceParser.java:95)
    at org.eclipse.twig.core.compiler.ast.parser.TwigSourceParser.parse(TwigSourceParser.java:70)
    at org.eclipse.php.internal.core.compiler.ast.parser.AbstractPHPSourceParser.parse(AbstractPHPSourceParser.java:41)
    at org.eclipse.twig.core.TwigSourceParserFactory.parse(TwigSourceParserFactory.java:37)
    at org.eclipse.dltk.core.SourceParserUtil.parse(SourceParserUtil.java:137)
    at org.eclipse.dltk.core.SourceParserUtil.getModuleDeclaration(SourceParserUtil.java:197)
    at org.eclipse.dltk.core.SourceParserUtil.getModuleDeclaration(SourceParserUtil.java:183)
    at org.eclipse.dltk.core.SourceParserUtil.getModuleDeclaration(SourceParserUtil.java:174)
    at org.eclipse.dltk.core.AbstractSourceElementParser.parse(AbstractSourceElementParser.java:42)
    at org.eclipse.dltk.core.AbstractSourceElementParser.parseSourceModule(AbstractSourceElementParser.java:26)
    at org.eclipse.php.internal.core.compiler.ast.parser.PHPSourceElementParser.parseSourceModule(PHPSourceElementParser.java:26)
    at org.eclipse.dltk.internal.core.AbstractSourceModule.buildStructure(AbstractSourceModule.java:507)
    at org.eclipse.dltk.internal.core.Openable.generateInfos(Openable.java:188)
    at org.eclipse.dltk.internal.core.ModelElement.openWhenClosed(ModelElement.java:184)
    at org.eclipse.dltk.internal.core.BecomeWorkingCopyOperation.executeOperation(BecomeWorkingCopyOperation.java:45)
    at org.eclipse.dltk.internal.core.ModelOperation.run(ModelOperation.java:698)
    at org.eclipse.dltk.internal.core.ModelOperation.runOperation(ModelOperation.java:764)
    at org.eclipse.dltk.internal.core.SourceModule.becomeWorkingCopy(SourceModule.java:68)
    at org.eclipse.dltk.internal.ui.editor.SourceModuleDocumentProvider.createFileInfo(SourceModuleDocumentProvider.java:1257)
    at org.eclipse.ui.editors.text.TextFileDocumentProvider.connect(TextFileDocumentProvider.java:478)
    at org.eclipse.dltk.internal.ui.editor.SourceModuleDocumentProvider.connect(SourceModuleDocumentProvider.java:1490)
    at org.eclipse.ui.texteditor.AbstractTextEditor.doSetInput(AbstractTextEditor.java:4056)
    at org.eclipse.ui.texteditor.StatusTextEditor.doSetInput(StatusTextEditor.java:217)
    at org.eclipse.ui.texteditor.AbstractDecoratedTextEditor.doSetInput(AbstractDecoratedTextEditor.java:1444)
    at org.eclipse.ui.editors.text.TextEditor.doSetInput(TextEditor.java:169)
    at org.eclipse.wst.sse.ui.StructuredTextEditor.doSetInput(StructuredTextEditor.java:1908)
    at org.eclipse.php.internal.ui.editor.PHPStructuredEditor.doSetInput(PHPStructuredEditor.java:2334)
    at org.eclipse.ui.texteditor.AbstractTextEditor$19.run(AbstractTextEditor.java:3043)
    at org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:464)
    at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:372)
    at org.eclipse.jface.window.ApplicationWindow$1.run(ApplicationWindow.java:759)
    at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
    at org.eclipse.jface.window.ApplicationWindow.run(ApplicationWindow.java:756)
    at org.eclipse.ui.internal.WorkbenchWindow.run(WorkbenchWindow.java:2606)
    at org.eclipse.ui.texteditor.AbstractTextEditor.internalInit(AbstractTextEditor.java:3061)
    at org.eclipse.ui.texteditor.AbstractTextEditor.init(AbstractTextEditor.java:3088)
    at org.eclipse.wst.sse.ui.StructuredTextEditor.init(StructuredTextEditor.java:2553)
    at org.eclipse.php.internal.ui.editor.PHPStructuredEditor.init(PHPStructuredEditor.java:1196)
    at org.eclipse.ui.internal.EditorManager.createSite(EditorManager.java:798)
    at org.eclipse.ui.internal.EditorReference.createPartHelper(EditorReference.java:647)
    at org.eclipse.ui.internal.EditorReference.createPart(EditorReference.java:465)
    at org.eclipse.ui.internal.WorkbenchPartReference.getPart(WorkbenchPartReference.java:595)
    at org.eclipse.ui.internal.EditorReference.getEditor(EditorReference.java:289)
    at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditorBatched(WorkbenchPage.java:2863)
    at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(WorkbenchPage.java:2768)
    at org.eclipse.ui.internal.WorkbenchPage.access$11(WorkbenchPage.java:2760)
    at org.eclipse.ui.internal.WorkbenchPage$10.run(WorkbenchPage.java:2711)
    at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
    at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2707)
    at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2691)
    at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2682)
    at org.eclipse.dltk.internal.ui.editor.EditorUtility.openInEditor(EditorUtility.java:405)
    at org.eclipse.dltk.internal.ui.editor.EditorUtility.openInEditor(EditorUtility.java:166)
    at org.eclipse.php.internal.ui.actions.OpenActionUtil.open(OpenActionUtil.java:54)
    at org.eclipse.php.internal.ui.actions.OpenAction.run(OpenAction.java:177)
    at org.eclipse.php.internal.ui.actions.OpenAction.run(OpenAction.java:151)
    at org.eclipse.php.internal.ui.actions.SelectionDispatchAction.dispatchRun(SelectionDispatchAction.java:190)
    at org.eclipse.php.internal.ui.actions.SelectionDispatchAction.run(SelectionDispatchAction.java:168)
    at org.eclipse.php.internal.ui.actions.PHPExplorerActionGroup.handleOpen(PHPExplorerActionGroup.java:144)
    at org.eclipse.dltk.internal.ui.scriptview.ScriptExplorerPart$4.open(ScriptExplorerPart.java:667)
    at org.eclipse.jface.viewers.StructuredViewer$2.run(StructuredViewer.java:845)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
    at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:49)
    at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:175)
    at org.eclipse.jface.viewers.StructuredViewer.fireOpen(StructuredViewer.java:843)
    at org.eclipse.jface.viewers.StructuredViewer.handleOpen(StructuredViewer.java:1131)
    at org.eclipse.jface.viewers.StructuredViewer$6.handleOpen(StructuredViewer.java:1235)
    at org.eclipse.jface.util.OpenStrategy.fireOpenEvent(OpenStrategy.java:264)
    at org.eclipse.jface.util.OpenStrategy.access$2(OpenStrategy.java:258)
    at org.eclipse.jface.util.OpenStrategy$1.handleEvent(OpenStrategy.java:298)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1258)
    at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3540)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3161)
    at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2640)
    at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2604)
    at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2438)
    at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:671)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:664)
    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
    at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:115)
    at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:620)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:575)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1408)
    at org.eclipse.equinox.launcher.Main.main(Main.java:1384)

Indent and outdent doesn't work

Hi,
first : thanks for your plugin! Really usefull.

I have encounter a strange bug with your plugin (latest release), when I hit "tab" or "shift + tab" to indent more than one line (as I do on all my files in eclipse) : nothing happens.

The release 1.0.72.2011062910 works well, but 1.0.75.201107071532 don't.

I try it on MacOS, in Eclipse 3.6 (I'm using ZendStudio) & Eclipse 3.7.

Thanks.

Eric

Plugin crashes eclipse >= 3.7 indigo + (Flash builder + PHP bundle "Zend Studio")

eclipse.buildId=M20110909-1335
java.version=1.6.0_29
java.vendor=Apple Inc.
BootLoader constants: OS=macosx, ARCH=x86, WS=cocoa, NL=en_US
Framework arguments: -product org.eclipse.epp.package.jee.product -keyring /Users/O/.eclipse_keyring -showlocation
Command-line arguments: -os macosx -ws cocoa -arch x86 -product org.eclipse.epp.package.jee.product -keyring /Users/O/.eclipse_keyring -showlocation

Error
Tue Feb 21 19:35:36 SAST 2012
Errors running builder 'Script Builder' on project 'project_name'.

java.lang.AbstractMethodError
at org.eclipse.dltk.internal.core.builder.ScriptBuilder.getScriptBuilders(ScriptBuilder.java:711)
at org.eclipse.dltk.internal.core.builder.ScriptBuilder.fullBuild(ScriptBuilder.java:432)
at org.eclipse.dltk.internal.core.builder.ScriptBuilder.build(ScriptBuilder.java:156)
at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:728)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:199)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:239)
at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:292)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:295)
at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:351)
at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:374)
at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:143)
at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:241)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)

Paste impossible in twig tag

(Sorry to add another issue!)

Using 1.0.81 :
In a tag like this :
{{ url('_manager') }}

I try to paste something in it, and it does nothing. Outside the tag no problem.

Same in all twig tag.

Hash inside comment breaks highlighting

{% if close %}
    {# <a class="close" href="#">×</a>#}
{% endif %}

when inserting a whitespace after the hash it works again:

{% if close %}
    {# <a class="close" href="# ">×</a>#}
{% endif %}

File association

We are using in project *.html files, I associated them with twig editor, but document still not recognized as Twig template

I noticed that there is a check for extenion can cause this problem
src / org / eclipse / twig / ui / editor / TwigStructuredEditor.java

if ("twig".equals(resource.getFullPath().getFileExtension())) {
TwigSourceParser.editFile.set(resource);
super.doSetInput(input);
} else {
super.doSetInput(input);
}

Add formatting support

Currently, formatting (ctrl + I) of twig regions does not work. This should be implemented.

Exception.

Details:

3004: Unexpected error occurred.
  java.lang.NullPointerException
    at com.dubture.twig.core.format.FormatterUtils.getPartitionType(FormatterUtils.java:91)
    at com.dubture.twig.core.format.FormatterUtils.getPartitionType(FormatterUtils.java:140)
    at com.dubture.twig.ui.editor.autoEdit.QuotesAutoEditStrategy.isMatchingCharNeeded(QuotesAutoEditStrategy.java:235)
    at com.dubture.twig.ui.editor.autoEdit.QuotesAutoEditStrategy.autoAddPairQuote(QuotesAutoEditStrategy.java:126)
    at com.dubture.twig.ui.editor.autoEdit.QuotesAutoEditStrategy.customizeDocumentCommand(QuotesAutoEditStrategy.java:54)
    at com.dubture.twig.ui.editor.autoEdit.MainAutoEditStrategy.customizeDocumentCommand(MainAutoEditStrategy.java:62)
    at org.eclipse.jface.text.TextViewer.customizeDocumentCommand(TextViewer.java:3745)
    at org.eclipse.jface.text.TextViewer.handleVerifyEvent(TextViewer.java:3782)
    at org.eclipse.jface.text.source.projection.ProjectionViewer.handleVerifyEvent(ProjectionViewer.java:1277)
    at org.eclipse.wst.sse.ui.internal.StructuredTextViewer.handleVerifyEvent(StructuredTextViewer.java:715)
    at org.eclipse.jface.text.TextViewer$TextVerifyListener.verifyText(TextViewer.java:435)
    at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:265)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1077)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1062)
    at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:774)
    at org.eclipse.swt.custom.StyledText.modifyContent(StyledText.java:7148)
    at org.eclipse.swt.custom.StyledText.sendKeyEvent(StyledText.java:7994)
    at org.eclipse.swt.custom.StyledText.doContent(StyledText.java:2456)
    at org.eclipse.swt.custom.StyledText.handleKey(StyledText.java:5911)
    at org.eclipse.swt.custom.StyledText.handleKeyDown(StyledText.java:5941)
    at org.eclipse.swt.custom.StyledText$7.handleEvent(StyledText.java:5635)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1077)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1062)
    at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1104)
    at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1100)
    at org.eclipse.swt.widgets.Widget.wmChar(Widget.java:1509)
    at org.eclipse.swt.widgets.Control.WM_CHAR(Control.java:4640)
    at org.eclipse.swt.widgets.Canvas.WM_CHAR(Canvas.java:345)
    at org.eclipse.swt.widgets.Control.windowProc(Control.java:4528)
    at org.eclipse.swt.widgets.Canvas.windowProc(Canvas.java:341)
    at org.eclipse.swt.widgets.Display.windowProc(Display.java:4972)
    at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
    at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:2530)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3752)
    at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2696)
    at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2660)
    at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2494)
    at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:674)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:667)
    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
    at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:123)
    at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1410)

This exception occurred when typing this:

{% extends '

I know that's not valid, but I was in the middle of typing, and this still shouldn't throw the exception.

plugin crash on .twig file open

Today (29.11.2011) I reinstalled a fresh Wamp (PHP 5.3.8), with a fresh Eclipse-PDT (Eclipse for PHP Developers Version 3.0.2)

I installed the latest Twig plugin, opened a .twig file, played around a little bit on this one file, had a silent error with a messagebox saying "Java null pointer exception", then and from now on, even after an Eclipse restart, trying to open any .twig file gives me this stack trace:

java.lang.NullPointerException
    at org.eclipse.dltk.internal.core.index.sql.SqlSearchEngine.search(SqlSearchEngine.java:71)
    at com.dubture.twig.core.model.TwigModelAccess.isTag(TwigModelAccess.java:313)
    at com.dubture.twig.core.model.TwigModelAccess.isStartTag(TwigModelAccess.java:194)
    at com.dubture.twig.core.model.TwigModelAccess.isTwigTag(TwigModelAccess.java:341)
    at com.dubture.twig.core.documentModel.dom.ElementImplForTwig.isTwigTag(ElementImplForTwig.java:109)
    at com.dubture.twig.core.documentModel.dom.ElementImplForTwig.getExistingAdapter(ElementImplForTwig.java:118)
    at org.eclipse.php.internal.ui.folding.StructuredTextFoldingProviderPHP.addAdapterToNodeAndChildrenHTML(StructuredTextFoldingProviderPHP.java:1102)
    at org.eclipse.php.internal.ui.folding.StructuredTextFoldingProviderPHP.addAllAdapters(StructuredTextFoldingProviderPHP.java:1074)
    at org.eclipse.php.internal.ui.folding.StructuredTextFoldingProviderPHP.initialize(StructuredTextFoldingProviderPHP.java:1033)
    at org.eclipse.php.internal.ui.folding.StructuredTextFoldingProviderPHP.handleProjectionEnabled(StructuredTextFoldingProviderPHP.java:919)
    at org.eclipse.php.internal.ui.folding.StructuredTextFoldingProviderPHP.projectionEnabled(StructuredTextFoldingProviderPHP.java:1926)
    at org.eclipse.php.internal.ui.folding.PHPFoldingStructureProviderProxy.projectionEnabled(PHPFoldingStructureProviderProxy.java:43)
    at org.eclipse.php.internal.ui.editor.PHPStructuredEditor.installProjectionSupport(PHPStructuredEditor.java:2241)
    at org.eclipse.php.internal.ui.editor.PHPStructuredEditor.createPartControl(PHPStructuredEditor.java:2250)
    at org.eclipse.ui.internal.EditorReference.createPartHelper(EditorReference.java:670)
    at org.eclipse.ui.internal.EditorReference.createPart(EditorReference.java:465)
    at org.eclipse.ui.internal.WorkbenchPartReference.getPart(WorkbenchPartReference.java:595)
    at org.eclipse.ui.internal.EditorReference.getEditor(EditorReference.java:289)
    at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditorBatched(WorkbenchPage.java:2945)
    at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(WorkbenchPage.java:2850)
    at org.eclipse.ui.internal.WorkbenchPage.access$11(WorkbenchPage.java:2842)
    at org.eclipse.ui.internal.WorkbenchPage$10.run(WorkbenchPage.java:2793)
    at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
    at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2789)
    at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2773)
    at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2756)
    at org.eclipse.ui.ide.IDE.openEditorOnFileStore(IDE.java:1155)
    at org.eclipse.ui.internal.ide.actions.OpenLocalFileAction.run(OpenLocalFileAction.java:107)
    at org.eclipse.ui.internal.ide.actions.OpenLocalFileAction.run(OpenLocalFileAction.java:76)
    at org.eclipse.ui.internal.PluginAction.runWithEvent(PluginAction.java:251)
    at org.eclipse.ui.internal.WWinPluginAction.runWithEvent(WWinPluginAction.java:229)
    at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:584)
    at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:501)
    at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:411)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
    at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4165)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3754)
    at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2696)
    at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2660)
    at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2494)
    at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:674)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:667)
    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
    at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:123)
    at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1410)

Editor not working when files do not end with *.twig but *.tpl

Hello,
When opening a *.tpl-file using the Twig-Editor i.e. using "Open With => Twig Editor" or by setting it up as the default editor using "General => Content Types" and "General => Editor => File Associations" the editor acts like the standard PHP editor (no twig-highlighting or completion).
Renaming the template to *.twig makes it work.

Exception.


3004: Unexpected error occurred.
  java.lang.NullPointerException
    at com.dubture.twig.core.search.NodeFinder.parseTwig(NodeFinder.java:126)
    at com.dubture.twig.core.search.NodeFinder.parseStatement(NodeFinder.java:97)
    at com.dubture.twig.core.search.NodeFinder.find(NodeFinder.java:56)
    at com.dubture.twig.ui.editor.TwigStructuredEditor.updateOccurrenceAnnotations(TwigStructuredEditor.java:273)
    at org.eclipse.php.internal.ui.editor.PHPStructuredEditor$ActivationListener.windowActivated(PHPStructuredEditor.java:726)
    at org.eclipse.ui.internal.Workbench$14.run(Workbench.java:1002)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
    at org.eclipse.ui.internal.Workbench.fireWindowActivated(Workbench.java:1000)
    at org.eclipse.ui.internal.WorkbenchWindow$28.shellActivated(WorkbenchWindow.java:3141)
    at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:88)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1077)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1058)
    at org.eclipse.swt.widgets.Decorations.WM_ACTIVATE(Decorations.java:1647)
    at org.eclipse.swt.widgets.Shell.WM_ACTIVATE(Shell.java:2137)
    at org.eclipse.swt.widgets.Control.windowProc(Control.java:4525)
    at org.eclipse.swt.widgets.Canvas.windowProc(Canvas.java:341)
    at org.eclipse.swt.widgets.Decorations.windowProc(Decorations.java:1610)
    at org.eclipse.swt.widgets.Shell.windowProc(Shell.java:2061)
    at org.eclipse.swt.widgets.Display.windowProc(Display.java:4972)
    at org.eclipse.swt.internal.win32.OS.DestroyWindow(Native Method)
    at org.eclipse.swt.widgets.Control.destroyWidget(Control.java:780)
    at org.eclipse.swt.widgets.Shell.destroyWidget(Shell.java:698)
    at org.eclipse.swt.widgets.Widget.release(Widget.java:818)
    at org.eclipse.swt.widgets.Widget.dispose(Widget.java:446)
    at org.eclipse.swt.widgets.Decorations.dispose(Decorations.java:447)
    at org.eclipse.swt.widgets.Shell.dispose(Shell.java:715)
    at org.eclipse.jface.window.Window.close(Window.java:335)
    at org.eclipse.jface.dialogs.Dialog.close(Dialog.java:979)
    at org.eclipse.jface.dialogs.ErrorDialog.close(ErrorDialog.java:695)
    at org.eclipse.jface.dialogs.Dialog.okPressed(Dialog.java:940)
    at org.eclipse.jface.dialogs.Dialog.buttonPressed(Dialog.java:472)
    at org.eclipse.jface.dialogs.ErrorDialog.buttonPressed(ErrorDialog.java:163)
    at org.eclipse.jface.dialogs.Dialog$2.widgetSelected(Dialog.java:624)
    at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:240)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
    at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4165)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3754)
    at org.eclipse.jface.window.Window.runEventLoop(Window.java:825)
    at org.eclipse.jface.window.Window.open(Window.java:801)
    at org.eclipse.jface.dialogs.ErrorDialog.open(ErrorDialog.java:360)
    at org.eclipse.jubula.client.ui.utils.Utils.createMessageDialog(Utils.java:475)
    at org.eclipse.jubula.client.ui.utils.Utils$3.run(Utils.java:386)
    at org.eclipse.swt.widgets.Synchronizer.syncExec(Synchronizer.java:180)
    at org.eclipse.ui.internal.UISynchronizer.syncExec(UISynchronizer.java:150)
    at org.eclipse.swt.widgets.Display.syncExec(Display.java:4683)
    at org.eclipse.jubula.client.ui.utils.Utils.createMessageDialog(Utils.java:384)
    at org.eclipse.jubula.client.ui.utils.Utils.createMessageDialog(Utils.java:327)
    at org.eclipse.jubula.client.ui.Plugin$5.run(Plugin.java:1122)
    at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
    at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:135)
    at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4140)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3757)
    at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2696)
    at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2660)
    at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2494)
    at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:674)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:667)
    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
    at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:123)
    at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1410)

Occured when typing:

{% extends ':CURSOR_HERE%}

'{% ' double

tipp => {% b + press enter

example

{% {% block name %}

{% endblock %}

Exeption when editing PHP files.

I get an exception related to this plugin when editing PHP files, I don't know why it should even be on during editing PHP files:

3004: Unexpected error occurred.
  java.lang.NullPointerException
    at com.dubture.twig.core.codeassist.context.AbstractTwigCompletionContext.isValid(AbstractTwigCompletionContext.java:103)
    at org.eclipse.php.internal.core.codeassist.contexts.CompletionContextResolver.resolve(CompletionContextResolver.java:114)
    at org.eclipse.php.internal.core.codeassist.PHPCompletionEngine.complete(PHPCompletionEngine.java:99)
    at org.eclipse.php.internal.core.codeassist.PHPCompletionEngine.complete(PHPCompletionEngine.java:66)
    at org.eclipse.dltk.internal.core.Openable$CompletionThread.run(Openable.java:501)
    at org.eclipse.dltk.internal.core.Openable$CompletionThread.run(Openable.java:482)

java.lang.NullPointerException

Hello.

Updated from Eclipse to version 1.0.92

Eclipse > Help > Install New Software ...

Work with : TWIG plugin - http://pulse00.github.com/Twig-Eclipse-Plugin/

I get this error while clicking on TWIG code (example : block) or while writing TWIG code.

"An error has occurred. See error log for more details.
java.lang.NullPointerException"

From log :

!ENTRY org.eclipse.wst.sse.ui 4 2 2011-12-27 18:33:58.454
!MESSAGE Problems occurred when invoking code from plug-in: "org.eclipse.wst.sse.ui".
!STACK 0
java.lang.NullPointerException
at org.eclipse.dltk.internal.core.index.sql.SqlSearchEngine.search(SqlSearchEngine.java:71)
at com.dubture.twig.core.model.TwigModelAccess.isTag(TwigModelAccess.java:313)
at com.dubture.twig.core.model.TwigModelAccess.isStartTag(TwigModelAccess.java:194)
at com.dubture.twig.core.model.TwigModelAccess.isTwigTag(TwigModelAccess.java:341)
at com.dubture.twig.core.documentModel.dom.ElementImplForTwig.isTwigTag(ElementImplForTwig.java:109)
at com.dubture.twig.core.documentModel.dom.ElementImplForTwig.getExistingAdapter(ElementImplForTwig.java:118)
at org.eclipse.wst.sse.core.internal.provisional.AbstractNotifier.getAdapterFor(AbstractNotifier.java:85)
at org.eclipse.wst.xml.ui.internal.contentoutline.JFaceNodeLabelProvider.getAdapter(JFaceNodeLabelProvider.java:40)
at org.eclipse.wst.xml.ui.internal.contentoutline.JFaceNodeLabelProvider.getText(JFaceNodeLabelProvider.java:66)
at org.eclipse.wst.html.ui.StructuredTextViewerConfigurationHTML$1.getText(StructuredTextViewerConfigurationHTML.java:233)
at org.eclipse.wst.sse.ui.StructuredTextEditor.updateStatusLine(StructuredTextEditor.java:3512)
at org.eclipse.wst.sse.ui.StructuredTextEditor$11.selectionChanged(StructuredTextEditor.java:2320)
at org.eclipse.wst.sse.ui.StructuredTextEditor$4.run(StructuredTextEditor.java:592)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.wst.sse.ui.StructuredTextEditor$StructuredSelectionProvider.fireSelectionChanged(StructuredTextEditor.java:590)
at org.eclipse.wst.sse.ui.StructuredTextEditor$StructuredSelectionProvider.handlePostSelectionChanged(StructuredTextEditor.java:671)
at org.eclipse.wst.sse.ui.StructuredTextEditor$3.selectionChanged(StructuredTextEditor.java:564)
at org.eclipse.jface.text.TextViewer.firePostSelectionChanged(TextViewer.java:2749)
at org.eclipse.jface.text.TextViewer.firePostSelectionChanged(TextViewer.java:2697)
at org.eclipse.jface.text.TextViewer$5.run(TextViewer.java:2676)
at org.eclipse.swt.widgets.Display.runTimer(Display.java:4266)
at org.eclipse.swt.widgets.Display.messageProc(Display.java:3353)
at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:2531)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3752)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2696)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2660)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2494)
at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:674)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:667)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:123)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
at org.eclipse.equinox.launcher.Main.run(Main.java:1410)

NullPointerException

I'm getting these NullPointerException error popups almost all the time when viewing through my twig document.

Infos from error log:

java.lang.NullPointerException
    at org.eclipse.dltk.internal.core.index.sql.SqlSearchEngine.search(SqlSearchEngine.java:71)
    at com.dubture.twig.core.model.TwigModelAccess.isTag(TwigModelAccess.java:305)
    at com.dubture.twig.core.model.TwigModelAccess.isStartTag(TwigModelAccess.java:186)
    at com.dubture.twig.core.model.TwigModelAccess.isTwigTag(TwigModelAccess.java:332)
    at com.dubture.twig.core.documentModel.dom.ElementImplForTwig.isTwigTag(ElementImplForTwig.java:101)
    at com.dubture.twig.core.documentModel.dom.ElementImplForTwig.getExistingAdapter(ElementImplForTwig.java:110)
    at org.eclipse.wst.sse.core.internal.provisional.AbstractNotifier.getAdapterFor(AbstractNotifier.java:85)
    at org.eclipse.wst.xml.ui.internal.contentoutline.JFaceNodeLabelProvider.getAdapter(JFaceNodeLabelProvider.java:40)
    at org.eclipse.wst.xml.ui.internal.contentoutline.JFaceNodeLabelProvider.getText(JFaceNodeLabelProvider.java:66)
    at org.eclipse.wst.html.ui.StructuredTextViewerConfigurationHTML$1.getText(StructuredTextViewerConfigurationHTML.java:233)
    at org.eclipse.wst.sse.ui.StructuredTextEditor.updateStatusLine(StructuredTextEditor.java:3512)
    at org.eclipse.wst.sse.ui.StructuredTextEditor$11.selectionChanged(StructuredTextEditor.java:2320)
    at org.eclipse.wst.sse.ui.StructuredTextEditor$4.run(StructuredTextEditor.java:592)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
    at org.eclipse.wst.sse.ui.StructuredTextEditor$StructuredSelectionProvider.fireSelectionChanged(StructuredTextEditor.java:590)
    at org.eclipse.wst.sse.ui.StructuredTextEditor$StructuredSelectionProvider.handlePostSelectionChanged(StructuredTextEditor.java:671)
    at org.eclipse.wst.sse.ui.StructuredTextEditor$3.selectionChanged(StructuredTextEditor.java:564)
    at org.eclipse.jface.text.TextViewer.firePostSelectionChanged(TextViewer.java:2749)
    at org.eclipse.jface.text.TextViewer.firePostSelectionChanged(TextViewer.java:2697)
    at org.eclipse.jface.text.TextViewer$5.run(TextViewer.java:2676)
    at org.eclipse.swt.widgets.Display.runTimer(Display.java:4266)
    at org.eclipse.swt.widgets.Display.messageProc(Display.java:3353)
    at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
    at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:2531)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3752)
    at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2696)
    at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2660)
    at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2494)
    at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:674)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:667)
    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
    at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:123)
    at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1410)

Session data:

eclipse.buildId=M20110909-1335
java.version=1.6.0_29
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=fi_FI
Command-line arguments:  -os win32 -ws win32 -arch x86

Twig Editor Feature 1.0.89.201111031715
PHP Development Tools (PDT) Runtime Feature 3.0.0.201111031640

Some parsing mistakes

Hi,

Consider the template at http://pastie.org/2954801. There's a couple of things going wrong here:

  1. the outline isn't correct, because the parser cannot distinguish between single tags, and ranged tags, for example:

{% set test = 5 %} is parsed as an opening tag, even though it has no closing tag.
{% set test %}5{% set %} is parsed correctly

The same goes for blocks:
{% block pageTitle "test" %}
{% block pageTitle %}test{% endblock %}

  1. I'm getting some obscure warning on line 27, {{ (labour.financialStatus.id is sameas(30))|tick }}:
    "mismatched input '(' expecting PRINT_CLOSE"

  2. Lines 30 and 31 also gives a strange warning {% set projectHours = projectHours + labour.hours %}
    "no viable alternative at character '+'"

Regards

Lost syntax highlighting with path or url

Hello!
Thanks a lot for this helpfull contribution.
I am using Symfony2 and Twig in Eclipse.

There is no problem with writing :

<a href="{{ path('_ipsum') }}">ipsum</a>

But if I add some parameters, syntax highlighting is lost.

<a href="{{ path('_ipsum', {'foo': 'bar'}) }}">ipsum</a>

Twig Editor assumes ordinary PHP files to be Twig files

Not sure, this is a misconfiguration on my part (I just installed the plugin as you described and restarted Eclipse), but ordinary ".php" files are considered Twig templates. So, now I don't have PHP autocompletion anymore, but only Twig autocompletion in PHP code :)

Syntax error

{% metaHttpEquiv 'Content-Type' with 'text/html; charset=utf-8' %}

Detected as a syntax error:
Multiple annotations found at this line:

  • mismatched character '}' expecting ''
  • no viable alternative at character '-'-
  • mismatched input 'with' expecting CTRL_CLOSE
  • mismatched character ';' expecting '''

Error if file is empty

I create new empty file and got alert:

An error has occurred. See error log for more details.
validator cannot be null

Replace jflex hack for matching TWIG_OPEN tags with native jflex rule

The smarty-base of the jflex grammar used a "hack" to detect openening Smarty/Twig tags (TWIG_OPEN):

.jflex:
https://github.com/pulse00/Twig-Eclipse-Plugin/blob/master/org.eclipse.twig.core/Resources/parserTools/TwigTokenizer.jflex#L1951

skeleton:
https://github.com/pulse00/Twig-Eclipse-Plugin/blob/master/org.eclipse.twig.core/Resources/parserTools/skeleton.sse#L233

The reason seems to be that the jflex rule for XML_CONTENT always overrides the rule for opening Twig tags, as more characters match in that rule than in the one from the opening twig tags:

// should match any twig opening tag
// does so for plain "{{", but not for "{{ foo"
// as the latter one has more matches in the next
// rule
<YYINITIAL> "{{"{Whitespace}* {

  yybegin(ST_TWIG_CONTENT);
  return TWIG_OPEN;
}

<YYINITIAL> [^<&%]*|[&%]{S}+{Name}[^&%<]*|[&%]{Name}([^;&%<]*|{S}+;*) {

    final String text = yytext();
    assert text != null;

    // checks the twig case
    // and returns TWIG_OPEN
    // and sets state to ST_TWIG_CONTENT
    // if {{ is found
    return findTwigDelimiter(text, XML_CONTENT, twigLeftDelim, TWIG_OPEN, ST_TWIG_CONTENT);

} 

This "manual" matching via custom java code seems to be the source of a couple of bugs and probably doesn't perform as well as the jflex matching mechanism.

Should be fixed before implementing new features.

Plugin doesn't work with latest Zend Studio

when i add the repository url (http://pulse00.github.com/p2/) and try to install the Twig plugin i get the following dependency conflict:

Cannot complete the install because of a conflicting dependency.
  Software being installed: Twig Editor Feature 1.0.96.201201111457 (com.dubture.twig.feature.feature.group 1.0.96.201201111457)
  Software currently installed: Zend Studio 9.0.1.v20111214366 (com.zend.php.ide 9.0.1.v20111214366)
  Only one of the following can be installed at once: 
    Dynamic Languages Toolkit Core 3.0.0.v20110904-1100 (org.eclipse.dltk.core 3.0.0.v20110904-1100)
    Dynamic Languages Toolkit Core 4.0.0.201201111457 (org.eclipse.dltk.core 4.0.0.201201111457)
  Cannot satisfy dependency:
    From: com.dubture.twig.core 1.0.96.201201111457 (com.dubture.twig.core 1.0.96.201201111457)
    To: bundle org.eclipse.dltk.core 4.0.0
  Cannot satisfy dependency:
    From: Twig Editor Feature 1.0.96.201201111457 (com.dubture.twig.feature.feature.group 1.0.96.201201111457)
    To: com.dubture.twig.core [1.0.96.201201111457]
  Cannot satisfy dependency:
    From: Zend Studio 9.0.1.v20111214366 (com.zend.php.ide 9.0.1.v20111214366)
    To: org.eclipse.dltk.core.feature.group [3.0.0.v20101211-0331-7m--FE-z0Vkh_JYSEiiWT]
  Cannot satisfy dependency:
    From: Dynamic Languages Toolkit - Core Frameworks 3.0.0.v20101211-0331-7m--FE-z0Vkh_JYSEiiWT (org.eclipse.dltk.core.feature.group 3.0.0.v20101211-0331-7m--FE-z0Vkh_JYSEiiWT)
    To: org.eclipse.dltk.core [3.0.0.v20110904-1100]

TwigSourceParser stack overflow error

I have a few twig files that I can't open with the Twig plugin installed.

I'm using Zend Studio 9.1 with the Symfony add-on.

The files will throw this error when I attempt to open them...

com.dubture.twig.core.documentModel.parser.TwigSourceParser: input could not be parsed correctly at position 14234
java.lang.StackOverflowError

Add Extension View

Add a view which shows a tree of Extensions for each project. Each extension node should show all registered functions, methods, tokenparsers, etc to get an overview of which funcionality each extension provides.

Syntax highlighting issues.

Seems like the plugin doesn't like closed curly brackets being together.

Wrong highlighting

{{ foo(bar, {'attr': {}}) }}

Correct highlighting

{{ foo(bar, {'attr': { } } ) }}

An illustrative screenshot can be found here (lines 36 - 40 for example).

Some opening/closing tags are not recognized

It seems like the editor doesn't pick up some opening/closing tags, or at least doesn't highlight them as such (red):

<!-- do something tag -->
{% %}

<!-- do something with whitespace control -->
{%- %}
{% -%}

<!-- comment -->
{# #}

Bug every second

!ENTRY org.eclipse.wst.sse.ui 4 2 2011-11-22 16:51:24.579
!MESSAGE Problems occurred when invoking code from plug-in: "org.eclipse.wst.sse.ui".
!STACK 0
java.lang.NullPointerException
at org.eclipse.dltk.internal.core.index.sql.SqlSearchEngine.search(SqlSearchEngine.java:71)
at com.dubture.twig.core.model.TwigModelAccess.isTag(TwigModelAccess.java:313)
at com.dubture.twig.core.model.TwigModelAccess.isStartTag(TwigModelAccess.java:194)
at com.dubture.twig.core.model.TwigModelAccess.isTwigTag(TwigModelAccess.java:341)
at com.dubture.twig.core.documentModel.dom.ElementImplForTwig.isTwigTag(ElementImplForTwig.java:109)
at com.dubture.twig.core.documentModel.dom.ElementImplForTwig.getExistingAdapter(ElementImplForTwig.java:118)
at org.eclipse.wst.sse.core.internal.provisional.AbstractNotifier.getAdapterFor(AbstractNotifier.java:85)
at org.eclipse.wst.xml.ui.internal.contentoutline.JFaceNodeLabelProvider.getAdapter(JFaceNodeLabelProvider.java:40)
at org.eclipse.wst.xml.ui.internal.contentoutline.JFaceNodeLabelProvider.getText(JFaceNodeLabelProvider.java:66)
at org.eclipse.wst.html.ui.StructuredTextViewerConfigurationHTML$1.getText(StructuredTextViewerConfigurationHTML.java:233)
at org.eclipse.wst.sse.ui.StructuredTextEditor.updateStatusLine(StructuredTextEditor.java:3512)
at org.eclipse.wst.sse.ui.StructuredTextEditor$11.selectionChanged(StructuredTextEditor.java:2320)
at org.eclipse.wst.sse.ui.StructuredTextEditor$4.run(StructuredTextEditor.java:592)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.wst.sse.ui.StructuredTextEditor$StructuredSelectionProvider.fireSelectionChanged(StructuredTextEditor.java:590)
at org.eclipse.wst.sse.ui.StructuredTextEditor$StructuredSelectionProvider.handlePostSelectionChanged(StructuredTextEditor.java:671)
at org.eclipse.wst.sse.ui.StructuredTextEditor$3.selectionChanged(StructuredTextEditor.java:564)
at org.eclipse.jface.text.TextViewer.firePostSelectionChanged(TextViewer.java:2749)
at org.eclipse.jface.text.TextViewer.firePostSelectionChanged(TextViewer.java:2697)
at org.eclipse.jface.text.TextViewer$5.run(TextViewer.java:2676)
at org.eclipse.swt.widgets.Display.runTimer(Display.java:4266)
at org.eclipse.swt.widgets.Display.messageProc(Display.java:3353)
at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:2531)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3752)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2696)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2660)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2494)
at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:674)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:667)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:123)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
at org.eclipse.equinox.launcher.Main.run(Main.java:1410)

Cannot update to fix java.lang.NullPointerException

My eclipse SDK is 3.7.1 on Mac 10.6.8
and I've install
PDT extensions
PDT developement tools (dev build)
Symfony
Twig
Yedit

The above error message kept pumping up while i was editing a twig file!!!
I knew this bug had been fxied, but I've try to update the plugin but I failed all the time due to conflicting dependency.

I tried to figure out how to remove the plugin and reinstall the newer version but just could not find a way!!!

I love twig and appreciate the twig editor, please help me to work it out, thanks a lot!!!

Twig-Highlighting inside Javascript

It seems like highlighting doesn't work when inside a <script> tag. Some example code:

{% block javascripts %}
    {{ parent() }}

    <script language="javascript" type="text/javascript">
        init_profile({{ path("latest_posts")|json_encode|raw }});
    </script>
{% endblock %}

In the above example {{ path("latest_posts")|json_encode|raw }} is not highlighted as Twig code.

Autoclose blocks.

When you type {% block myblock %}, Twig eclipse plugin should automatically replace it with {% block myblock %}PLACE_CURSOR_HERE{% endblock %}.

Use standard 'Colors & Fonts'

Right now, only the background color of the editor is provided by the default 'Colors & Fonts' (or the color theme, if using the Color Theme Plugin). This means syntax coloring is different from other editors and, if using a dark background, hard to read.

It would be nice if the Twig Editor would use the colors from 'Colors & Fonts'.

Syntax Error

I'm using Twig with Zend Framework and have mapped Zend Framework's view helpers to Twig functions. The following produces an error (mismatched input '.' expecting PRINT_CLOSE) when it is in fact valid. I think Twig-Eclipse-Plugin expects a "|" or "}}" following any function and doesn't allow them to be chained.

{{ headLink().setStylesheet("/css/site.css")|raw }}

Internal ui editor error

Using Eclipse 3.6 (with Zend Studio v8.0)

All Install steps completed fine.

In preferences, I see:

Twig
Editor
Code Assist
Syntax Colors (not connected yet)
Templates

Clicking on Syntax Colors gives:

An error has occurred. See error log for more details.
org.eclipse.php.internal.ui.editor.highlighter.AbstractSemanticHighlighting.getBackgroundColorPreferenceKey()Ljava/lang/String;

None of Code Assist, AutoClose or (obviously) syntax highlighting are working, even after a restart.

New Twig template dialog does not let one create non *.twig-files

The "New Twig template" dialog only allows the creation of *.twig files. When trying to create a file with a different extension like *.tpl an error-msg stating it must be called *.twig is displayed.

This is odd since the plugin already advertises itself as a possible editor for *.tpl-files.

Is there any technical reason for this?

Can't install plugin with Aptana Studio 3

When I try to install the plugin, Aptana Studio 3 tells me:

Cannot complete the install because one or more required items could not be found.
  Software being installed: Twig Editor Feature 1.0.96.201201111457 (com.dubture.twig.feature.feature.group 1.0.96.201201111457)
  Missing requirement: Twig UI Plugin 1.0.96.201201111457 (com.dubture.twig.ui 1.0.96.201201111457) requires 'bundle org.eclipse.wst.html.core 0.0.0' but it could not be found
  Cannot satisfy dependency:
    From: Twig Editor Feature 1.0.96.201201111457 (com.dubture.twig.feature.feature.group 1.0.96.201201111457)
    To: com.dubture.twig.ui [1.0.96.201201111457]

Yet, I can't seem to find that eclipse bundle anywhere, not even in a clean install of a regular eclipse...

Improve template wizard

The template wizard could be improved in the following way:

  • Add a TextField extends with autocompletion of available parent templates
  • When a parent template is selected, display the checkbox-list of available blocks to implement

The new template should then generate the extends statement and all the selected blocks.

The extends autocompletion should add an extension point to enable framework extendenders to provide
parent template proposals.

jQuery Templates Validated Inside Raw Tag

Stuff inside the {% raw %} tag is still being validated.

{% raw %}
    <script id="template-upload" type="text/x-jquery-tmpl">
      <tr class="template-upload{{if error}} ui-state-error{{/if}}">
        <td class="preview"></td>
        <td class="name">{{if name}}${name}{{else}}Untitled{{/if}}</td>
        <td class="size">${sizef}</td>
        {{if error}}
        <td class="error" colspan="2">Error:
            {{if error === 'maxFileSize'}}File is too big
            {{else error === 'minFileSize'}}File is too small
            {{else error === 'acceptFileTypes'}}Filetype not allowed
            {{else error === 'maxNumberOfFiles'}}Max number of files exceeded
            {{else}}${error}
            {{/if}}
        </td>
        {{else}}
        <td class="progress"><div></div></td>
        <td class="start"><button>Start</button></td>
        {{/if}}
        <td class="cancel"><button>Cancel</button></td>
      </tr>
    </script>
    <script id="template-download" type="text/x-jquery-tmpl">
      <tr class="template-download{{if error}} ui-state-error{{/if}}">
        {{if error}}
        <td></td>
        <td class="name">${name}</td>
        <td class="size">${sizef}</td>
        <td class="error" colspan="2">Error:
          {{if error === 1}}File exceeds upload_max_filesize (php.ini directive)
          {{else error === 2}}File exceeds MAX_FILE_SIZE (HTML form directive)
          {{else error === 3}}File was only partially uploaded
          {{else error === 4}}No File was uploaded
          {{else error === 5}}Missing a temporary folder
          {{else error === 6}}Failed to write file to disk
          {{else error === 7}}File upload stopped by extension
          {{else error === 'maxFileSize'}}File is too big
          {{else error === 'minFileSize'}}File is too small
          {{else error === 'acceptFileTypes'}}Filetype not allowed
          {{else error === 'maxNumberOfFiles'}}Max number of files exceeded
          {{else error === 'uploadedBytes'}}Uploaded bytes exceed file size
          {{else error === 'emptyResult'}}Empty file upload result
          {{else}}${error}
          {{/if}}
        </td>
        {{else}}
        <td class="preview">
          {{if thumbnail_url}}
          <a href="${url}" title="${name}" rel="gallery"><img src="${thumbnail_url}"></a>
          {{/if}}
        </td>
        <td class="name">
          <a href="${url}" title="${name}"{{if thumbnail_url}} rel="gallery"{{/if}}>${name}</a>
        </td>
        <td class="size">${sizef}</td>
        <td colspan="2"></td>
        {{/if}}
        <td class="delete">
          <button data-type="${delete_type}" data-url="${delete_url}">Delete</button>
          <input type="checkbox" name="delete" value="1">
        </td>
      </tr>
    </script>
{% endraw %}

Create preference for default twig extension

As some people use different file extensions for their twig templates, a preference setting is needed to setup a default twig template extension.

This setting should have a workspace and be overridden on a project scope.

Twig highlighting sometimes broken

The Twig highlighting is broken sometimes. For example, if you use Twig code inside an attribute, it's not picked up as Twig code.

In the following example, {{ path("profile") }} is not highlighted:

<a href="{{ path("profile") }}">{{ "link.back_to_profile"|trans }}</a>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.