This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 268719

Summary: Strange editor behaviour on laravel blade templates (php file)
Product: editor Reporter: McPan
Component: -- Other --Assignee: Miloslav Metelka <mmetelka>
Status: REOPENED ---    
Severity: normal CC: AOndra, CyberDyne, tmysik
Priority: P3 Keywords: RANDOM
Version: 8.2   
Hardware: PC   
OS: Windows 7   
Issue Type: DEFECT Exception Reporter:
Attachments: PHP editor behaviour
netbeans 8.2 x64 log file (Win7)
example file with mostly reproducible behaviour
IndexOutOfBoundsException

Description McPan 2016-10-27 16:57:06 UTC
Created attachment 162663 [details]
PHP editor behaviour

Hi all,

I'm using Netbeans-PHP platform and got some strange editor behaviour when working on laravel blade templates.

Sometimes when typing open curly brackets it is not possible to type any more brackets. Characters can't be deleted after an opened curly bracket, nevertheless the file is marked as changed, while trying this. While typing doesn't work, copy and pasting characters do.

See comments in screenshot for details. 

This behaviour is not always reproducible. Sometimes it helps closing and re-opening the file.

Tried to switch off auto bracket completion with no effect.

Never had this behaviour with previous Netbeans-IDE versions.
Comment 1 Tomas Mysik 2016-10-31 06:30:43 UTC
Please, provide exact steps to reproduce and attach a sample file or a sample project we can use to investigate. Also, it is always a good idea to attach the IDE log [1] once any error occurs.

Simply reopen this issue, thanks.
[1] http://wiki.netbeans.org/FaqLogMessagesFile
Comment 2 McPan 2016-10-31 14:04:55 UTC
Created attachment 162700 [details]
netbeans 8.2 x64 log file (Win7)

Log file from a fresh installation of PHP-Netbeans IDE (x64/Win7Pro)
Comment 3 McPan 2016-10-31 14:16:41 UTC
Created attachment 162701 [details]
example file with mostly reproducible behaviour

Just updated PHP-Netbeans IDE from 8.1 to 8.2 on another system (x64/Win7Pro) instead of (x32/Win7Enterprise), mostly the same behaviour as described initially.

Open attached example file in PHP-Netabeans, go to nearly any line and try typing more than one { will not be possible

Go to lines 58, 66, 74, 82,  which already contains a template var statement {{ $ var }} . It's possible to type two {{ but afterwards it's not possible to type a - sign for a template comment i.e. {{-- this is a comment --}}

Type the -- anywhere else on the page, copy it, paste it after the {{ will work. But try to delete the pasted -- with backspace won't.
Comment 4 Tomas Mysik 2016-10-31 14:37:05 UTC
Thanks a lot.
Comment 5 Tomas Mysik 2016-10-31 14:39:10 UTC
I can see NPEs in the attached log - reassigning, please evaluate. Thanks.
Comment 6 Tomas Mysik 2016-10-31 14:39:56 UTC
Not sure where lexer belongs. Thanks.

SEVERE [global]
java.lang.NullPointerException
	at org.netbeans.lib.lexer.inc.TokenListListUpdate.createJoinTokenListChange(TokenListListUpdate.java:284)
Comment 7 AOndra 2016-12-20 15:17:39 UTC
I have also actually had this error myself in 8.1 and upgraded to 8.2 in the hopes it would resolve the problem, so the defect goes back a while.
Comment 8 ragavendhira 2017-03-22 05:37:34 UTC
Hi All, 

Recently switched from Netbeans PHP 8.1 to 8.2 version. When working with laravel template codes like {{ editor does not work as expected. After typing {{ braces, I unable to type other character and unable to Undo last typed charactes. I haven't faced this problem earlier 8.1 version. Please suggest me to solve this problem. 

Thanks to all
Comment 9 CyberDyne 2017-06-12 04:53:26 UTC
Hello,

I can confirm this too. 

The problem can be easly reproduced when typing two curly brackets one after another in HTML DOM attribute's section and results in "A java.lang.IndexOutOfBoundsException exception has occurred." error.

I hope this can be fixed as soon as possible because it's impossible to work with PHP files that got HTML inside of them.

Best,
Linas
Comment 10 CyberDyne 2017-06-12 04:57:30 UTC
Created attachment 164509 [details]
IndexOutOfBoundsException
Comment 11 CyberDyne 2017-06-12 05:24:31 UTC
Okay, after doing a bit more of testing with a latest snapshot (Netbeans IDE Dev 201706110001) I have noticed that after deactivating "Knockout HTML Editor" an error is no more present in some of blade templates (but it's not being resolved completely). Also, there is a strange behaviour and it seems to be happening only when typing two sequel opening curly braces in HTML DOM attribute section - two open curly braces get auto-completed with a single closing curly brace e.g. <div class="{{}"> (this only happens if no error occures). I hope this helps.
Comment 12 CyberDyne 2017-06-12 05:40:15 UTC
A follow up - it seems disabling "Knockout HTML Editor" and "Angular JS Editor" plugins prevents from error occuring... also the strange auto-complete happens mostly on class or style DOM attributes, while it's not present on other HTML DOM attributes.
Comment 13 kifter 2017-08-28 12:40:18 UTC
Just wanted to give a huge thank you to CyberDyne for finding the work around to this bug. I'm just in the process of getting to grips with Laravel and this bug certainly made the experience a lot more frustrating.

The bug also prevents a backspace input if the user inputs two instances of an open and closing curly brace {}{} and you try to delete the first closing curly brace such that the resulting text would become {{}

For what its worth you can also get around the bug by typing an opening curly brace followed by a space then the second, then go back and delete the space.
Comment 14 rwhal06 2018-11-15 19:35:35 UTC
(In reply to CyberDyne from comment #12)
> A follow up - it seems disabling "Knockout HTML Editor" and "Angular JS
> Editor" plugins prevents from error occuring... also the strange
> auto-complete happens mostly on class or style DOM attributes, while it's
> not present on other HTML DOM attributes.

Thank you! I'm using NetBeans 8.2 on Windows 10 coding a Laravel PHP project with Blade templates (.blade.php files), and they were driving me crazy because pressing Enter would never add a new line. (Sort of like reported here: https://askubuntu.com/q/137209/48214)

After deactivating plugins "Knockout HTML Editor" and "Angular JS Editor" (and restarting NetBeans), it seems to work.
Comment 15 LaurenDesouza 2019-01-31 11:26:59 UTC
All Netbeans-PHP platform users and facing got some strange editor behaviour when working on Laravel blade templates and your views behind occurring this error and tried solutions to sort out it.
Lauren,
https://www.cvfolks.co.uk/