Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 351646 - HTML end tag proposal is lost in Content Assist
Summary: HTML end tag proposal is lost in Content Assist
Status: CLOSED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: PDT (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P1 normal (vote)
Target Milestone: ---   Edit
Assignee: PHP Core CLA
QA Contact: Ilina Stefanova CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-07-09 22:11 EDT by Toshihiro Izumi CLA
Modified: 2020-05-14 10:15 EDT (History)
4 users (show)

See Also:


Attachments
patch (714 bytes, patch)
2011-07-12 19:24 EDT, Toshihiro Izumi CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Toshihiro Izumi CLA 2011-07-09 22:11:58 EDT
Steps to reproduce:

1. Create new blank php file
2. Paste following code(4 lines)
  <ul>
  
  <li>list</li>
  </ul>
3. Move cursor on line 2
4. Type "<", hit enter-key when CA appears with "<li>"
5. Type "<" and confirm "End with /li>" appears in CA, and then hit enter-key
6. Type "<","l","i",">" slowly without CA
7. Type "<". "End with /li>" does not appear in CA now


Here is my workaround for evaluation (ad hoc)
http://sourceforge.jp/projects/pdt-tools/releases/52566
Comment 1 Toshihiro Izumi CLA 2011-07-09 22:40:02 EDT
Another face of this issue.

(steps to reproduce)
6. Type "<li></li>" manually

> !ENTRY org.eclipse.wst.xml.core 4 4 2011-07-10 11:22:22.453
> !MESSAGE IStructuredDocumentRegion management failed.
> !STACK 0
> org.eclipse.wst.xml.core.internal.document.StructuredDocumentRegionManagementException: IStructuredDocumentRegion management failed.
> 	at org.eclipse.wst.xml.core.internal.document.XMLModelParser.removeStructuredDocumentRegion(XMLModelParser.java:2265)
> 	at org.eclipse.wst.xml.core.internal.document.XMLModelParser.replaceStructuredDocumentRegions(XMLModelParser.java:2339)
> 	at org.eclipse.wst.xml.core.internal.document.DOMModelImpl.nodesReplaced(DOMModelImpl.java:737)
> 	at org.eclipse.wst.sse.core.internal.text.BasicStructuredDocument._fireEvent(BasicStructuredDocument.java:600)
> 	at org.eclipse.wst.sse.core.internal.text.BasicStructuredDocument.fireStructuredDocumentEvent(BasicStructuredDocument.java:1198)
> 	at org.eclipse.wst.sse.core.internal.text.BasicStructuredDocument.internalReplaceText(BasicStructuredDocument.java:1979)
> 	at org.eclipse.wst.sse.core.internal.text.BasicStructuredDocument.replaceText(BasicStructuredDocument.java:2423)
> 	at org.eclipse.wst.sse.core.internal.text.BasicStructuredDocument.replaceText(BasicStructuredDocument.java:2408)
> 	at org.eclipse.wst.sse.core.internal.text.JobSafeStructuredDocument.access$2(JobSafeStructuredDocument.java:1)
> 	at org.eclipse.wst.sse.core.internal.text.JobSafeStructuredDocument$3.run(JobSafeStructuredDocument.java:141)
> 	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
-snip-
Comment 2 Nate CLA 2011-07-10 12:11:43 EDT
I'm going to test out the patch next week and see how it works.  Thanks Toshihiro!

By the way, great work on the PHP Formatter plug-in.  I just installed it and tried it out.  I wish I would have found this earlier!!
Comment 3 dominik CLA 2011-07-11 04:53:40 EDT
I already tested Toshihiro patch and it seems that it's working as expected, thanks! :) 

BTW: also I'll take a look at this formater, currently I'm using PEAR PHP Beautifier and it's quite good external tool (attached via eclipse external tools).
Comment 4 Toshihiro Izumi CLA 2011-07-12 19:24:16 EDT
Created attachment 199537 [details]
patch

thanks :)
Comment 5 Zhongwei Zhao CLA 2011-07-12 21:56:08 EDT
thanks very much!I was trying to fix it for 2 hours yesterday....
committed the patch;)
Comment 6 dominik CLA 2011-07-13 04:50:02 EDT
great and thanks :)
Comment 7 Nate CLA 2011-07-13 08:36:55 EDT
Works for me.  Thanks everyone
Comment 8 dominik CLA 2011-07-13 12:13:49 EDT
Hmmm.. I still see very small issue, I spent some time to get good example today of that and here it is: 

1. create blank php file 

2. insert code: 

<?php if (1): ?>

<?php else: ?>
<?php endif; ?>

3. on 2 line insert '<?' it will be expanded to '<?php ?>' (this is ok) 

4. move cursor to start of line and type again: '<?' - this one will not be expanded where it should be '<?php ?>' 

5. everything will work if there will be any char before '<?php ' and cursor

The other strange things: 

1. insert new line on the beginning and type there: '<table>', then '</table>' will appear. The strange thing is that '</table>' will not appear if there is '<?php ?>' next to that (html option to close tags automatically)

2. I'm trying to enter symfony link using built in methods and I'm writing on new, first line: '<a href="<?' -> I expect that '<?php ?>' will expand here, but nothing happened here, after manually adding: '<a href="<?php ?>">' end tag '</a>' will be expanded 
Same thing with html editor option to not close tags will work - '<?php ?>' will be expanded

3. HTML auto closing tags are not working for everything, example: 
<ul>
</ul>
then in the middle: 
  <li>
...and 'li' is not closed. Plain HTML. I don't see a reason why it should not close this tag and close table or a tag. 

Ok, maybe some of that are not PDT specific, but I found out that html auto close tag somehow interact with PDT <?php ?> tag. I think that outside PHP code it's tags should be always expanded. Users who preffer this option can mislead by this. 

And.. somewhere while writing those scenarios I got this exception: 

org.eclipse.jface.text.BadLocationException
	at org.eclipse.jface.text.TreeLineTracker.fail(TreeLineTracker.java:1055)
	at org.eclipse.jface.text.TreeLineTracker.getLineInformation(TreeLineTracker.java:1182)
	at org.eclipse.jface.text.AbstractLineTracker.getLineInformation(AbstractLineTracker.java:137)
	at org.eclipse.wst.sse.core.internal.text.BasicStructuredDocument.getLineInformation(BasicStructuredDocument.java:1459)
	at org.eclipse.php.internal.core.format.DefaultIndentationStrategy.placeMatchingBlanksForStructuredDocument(DefaultIndentationStrategy.java:332)
	at org.eclipse.php.internal.core.format.DefaultIndentationStrategy.placeMatchingBlanks(DefaultIndentationStrategy.java:263)
	at org.eclipse.php.internal.ui.autoEdit.IndentLineAutoEditStrategy.placeMatchingBlanks(IndentLineAutoEditStrategy.java:168)
	at org.eclipse.php.internal.ui.autoEdit.IndentLineAutoEditStrategy.autoIndentAfterNewLine(IndentLineAutoEditStrategy.java:46)
	at org.eclipse.php.internal.ui.autoEdit.IndentLineAutoEditStrategy.customizeDocumentCommand(IndentLineAutoEditStrategy.java:107)
	at org.eclipse.jface.text.TextViewer.customizeDocumentCommand(TextViewer.java:3752)
	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:7146)
	at org.eclipse.swt.custom.StyledText.sendKeyEvent(StyledText.java:7992)
	at org.eclipse.swt.custom.StyledText.doContent(StyledText.java:2456)
	at org.eclipse.swt.custom.StyledText.handleKey(StyledText.java:5909)
	at org.eclipse.swt.custom.StyledText.handleKeyDown(StyledText.java:5939)
	at org.eclipse.swt.custom.StyledText$7.handleEvent(StyledText.java:5633)
	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:4623)
	at org.eclipse.swt.widgets.Canvas.WM_CHAR(Canvas.java:345)
	at org.eclipse.swt.widgets.Control.windowProc(Control.java:4511)
	at org.eclipse.swt.widgets.Canvas.windowProc(Canvas.java:341)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:4957)
	at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
	at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:2525)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3737)
	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)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1386)
Comment 9 Ilina Stefanova CLA 2011-07-25 09:19:55 EDT
Still reproducible with the same error: 
!ENTRY org.eclipse.wst.xml.core 4 4 2011-07-25 16:13:46.972
!MESSAGE IStructuredDocumentRegion management failed.
!STACK 0
org.eclipse.wst.xml.core.internal.document.StructuredDocumentRegionManagementException: IStructuredDocumentRegion management failed.
	at org.eclipse.wst.xml.core.internal.document.XMLModelParser.removeStructuredDocumentRegion(XMLModelParser.java:2265)
	at org.eclipse.wst.xml.core.internal.document.XMLModelParser.replaceStructuredDocumentRegions(XMLModelParser.java:2339)
	at org.eclipse.wst.xml.core.internal.document.DOMModelImpl.nodesReplaced(DOMModelImpl.java:737)
	at org.eclipse.wst.sse.core.internal.text.BasicStructuredDocument._fireEvent(BasicStructuredDocument.java:600)
	at org.eclipse.wst.sse.core.internal.text.BasicStructuredDocument.fireStructuredDocumentEvent(BasicStructuredDocument.java:1198)
	at org.eclipse.wst.sse.core.internal.text.BasicStructuredDocument.internalReplaceText(BasicStructuredDocument.java:1979)
	at org.eclipse.wst.sse.core.internal.text.BasicStructuredDocument.replaceText(BasicStructuredDocument.java:2423)
	at org.eclipse.wst.sse.core.internal.text.BasicStructuredDocument.replaceText(BasicStructuredDocument.java:2408)
	at org.eclipse.wst.sse.core.internal.text.JobSafeStructuredDocument.access$2(JobSafeStructuredDocument.java:1)
	at org.eclipse.wst.sse.core.internal.text.JobSafeStructuredDocument$3.run(JobSafeStructuredDocument.java:141)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
...
Comment 10 Zhongwei Zhao CLA 2011-08-01 02:20:21 EDT
(In reply to comment #8)
> Hmmm.. I still see very small issue, I spent some time to get good example today
> of that and here it is:
> 
> 1. create blank php file
> 
> 2. insert code:
> 
> <?php if (1): ?>
> 
> <?php else: ?>
> <?php endif; ?>
> 
> 3. on 2 line insert '<?' it will be expanded to '<?php ?>' (this is ok)
> 
> 4. move cursor to start of line and type again: '<?' - this one will not be
> expanded where it should be '<?php ?>'
> 
> 5. everything will work if there will be any char before '<?php ' and cursor
> 
> The other strange things:
> 
> 1. insert new line on the beginning and type there: '<table>', then '</table>'
> will appear. The strange thing is that '</table>' will not appear if there is
> '<?php ?>' next to that (html option to close tags automatically)
> 
> 2. I'm trying to enter symfony link using built in methods and I'm writing on
> new, first line: '<a href="<?' -> I expect that '<?php ?>' will expand here, but
> nothing happened here, after manually adding: '<a href="<?php ?>">' end tag
> '</a>' will be expanded
> Same thing with html editor option to not close tags will work - '<?php ?>' will
> be expanded
> 
> 3. HTML auto closing tags are not working for everything, example:
> <ul>
> </ul>
> then in the middle:
> <li>
> ...and 'li' is not closed. Plain HTML. I don't see a reason why it should not
> close this tag and close table or a tag.
> 
> Ok, maybe some of that are not PDT specific, but I found out that html auto
> close tag somehow interact with PDT <?php ?> tag. I think that outside PHP code
> it's tags should be always expanded. Users who preffer this option can mislead
> by this.
> 
> And.. somewhere while writing those scenarios I got this exception:
> 
> org.eclipse.jface.text.BadLocationException
> at org.eclipse.jface.text.TreeLineTracker.fail(TreeLineTracker.java:1055)
> at
> org.eclipse.jface.text.TreeLineTracker.getLineInformation(TreeLineTracker.java:1182)
> at
> org.eclipse.jface.text.AbstractLineTracker.getLineInformation(AbstractLineTracker.java:137)
> at
> org.eclipse.wst.sse.core.internal.text.BasicStructuredDocument.getLineInformation(BasicStructuredDocument.java:1459)
> at
> org.eclipse.php.internal.core.format.DefaultIndentationStrategy.placeMatchingBlanksForStructuredDocument(DefaultIndentationStrategy.java:332)
> at
> org.eclipse.php.internal.core.format.DefaultIndentationStrategy.placeMatchingBlanks(DefaultIndentationStrategy.java:263)
> at
> org.eclipse.php.internal.ui.autoEdit.IndentLineAutoEditStrategy.placeMatchingBlanks(IndentLineAutoEditStrategy.java:168)
> at
> org.eclipse.php.internal.ui.autoEdit.IndentLineAutoEditStrategy.autoIndentAfterNewLine(IndentLineAutoEditStrategy.java:46)
> at
> org.eclipse.php.internal.ui.autoEdit.IndentLineAutoEditStrategy.customizeDocumentCommand(IndentLineAutoEditStrategy.java:107)
> at
> org.eclipse.jface.text.TextViewer.customizeDocumentCommand(TextViewer.java:3752)
> 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:7146)
> at org.eclipse.swt.custom.StyledText.sendKeyEvent(StyledText.java:7992)
> at org.eclipse.swt.custom.StyledText.doContent(StyledText.java:2456)
> at org.eclipse.swt.custom.StyledText.handleKey(StyledText.java:5909)
> at org.eclipse.swt.custom.StyledText.handleKeyDown(StyledText.java:5939)
> at org.eclipse.swt.custom.StyledText$7.handleEvent(StyledText.java:5633)
> 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:4623)
> at org.eclipse.swt.widgets.Canvas.WM_CHAR(Canvas.java:345)
> at org.eclipse.swt.widgets.Control.windowProc(Control.java:4511)
> at org.eclipse.swt.widgets.Canvas.windowProc(Canvas.java:341)
> at org.eclipse.swt.widgets.Display.windowProc(Display.java:4957)
> at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
> at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:2525)
> at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3737)
> 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)
> at org.eclipse.equinox.launcher.Main.main(Main.java:1386)

> 4. move cursor to start of line and type again: '<?' - this one will not be
> expanded where it should be '<?php ?>'
this is fixed in head.
Comment 11 Ilina Stefanova CLA 2011-08-04 03:08:51 EDT
Verified.