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.
HTML code is indented much more than it should be - cursor is move many tabs to right after pressing enter anywhere in editor scriptlet code is not indented at all - cursor is always set on first column reformat code does nothing the same problem appears in HTML editor with HTML code
It was not possible to work in it yesterday because of issue #110001. I'll fix this ASAP.
The problem with the html tags indentation is caused by several bugs: 1)a bug in Schlieman default indendent api implementation. The code in IndentFactory adds some indentation even in case when the formatted language is not handled by Schlieman. For example in an html file with embedded javascript the Schlieman implementation is called by the editor/indent infrastructure for text/x-javascript and text/x-javascript/text/x-javascript-string languages. However these calls influences formatting of pure html text when pressing enter outside of <script> tag. fixed Checking in IndentFactory.java; /cvs/languages/engine/src/org/netbeans/modules/languages/features/IndentFactory.java,v <-- IndentFactory.java new revision: 1.2; previous revision: 1.1 done
2) The mechanism of the generic Schlieman indentation indents the same code more times depending on number of embedded languages handled by Schlieman. The code tries to find the deepest embedding on the specified offset and then uses the mimeType of the embedded language to find the indentation feature and then to reindent the code. This is OK, however the infrastructure calls the IndentTask for all languages found in the file and so it happens that because of the described mechanism the file is indented several times by the same indenter. For example: If you press enter in embedded javascript code in an html file the infrastrucure calls the Schlieman's indentation twice - once of "text/x-javascript" and once for "text/x-javascript/text/x-javascript-string". However for both calls the same language "text/x-javascript" language is found and the same indentation is done. The problem is that the implementation of IndentTask factory has no possibility to check what is "its" mimetype. For handcoded IndentTask implemented per language this is not a problem - the code always knows what is its language and decide whether to reformat the file or not. This is not true for Schlieman - the same implementation of IndentTask is registered for various mimetypes and hence the code cannot determine what to indent and what to ignore in the file. To achieve this a change in editor/indent is necessary. In particular the Context class needs to have a possibility to get the mimetype. I have made the change above in the editor/indent and also fixed the described problem in the Schlieman implemenatation of IndentTask. Since the change in editor/indent is an API change I'll file a separate issue so we can do a fast track review for it.
The editor/indent api change issue #110129 has been filed.
Created attachment 45306 [details] The patch for Schlieman's IndentTask implementation
*** Issue 110128 has been marked as a duplicate of this issue. ***
3) html and jsp editor doesn't implement editor/indent SPI - fixed Checking in html/editor/src/org/netbeans/modules/html/editor/resources/layer.xml; /cvs/html/editor/src/org/netbeans/modules/html/editor/resources/layer.xml,v <-- layer.xml new revision: 1.16; previous revision: 1.15 done Checking in web/jspsyntax/src/org/netbeans/modules/web/core/syntax/formatting/JspFormatter.java; /cvs/web/jspsyntax/src/org/netbeans/modules/web/core/syntax/formatting/JspFormatter.java,v <-- JspFormatter.java new revision: 1.2; previous revision: 1.1 done RCS file: /cvs/html/editor/src/org/netbeans/modules/html/editor/indent/HtmlIndentTaskFactory.java,v done Checking in html/editor/src/org/netbeans/modules/html/editor/indent/HtmlIndentTaskFactory.java; /cvs/html/editor/src/org/netbeans/modules/html/editor/indent/HtmlIndentTaskFactory.java,v <-- HtmlIndentTaskFactory.java initial revision: 1.1 done RCS file: /cvs/html/editor/src/org/netbeans/modules/html/editor/indent/HtmlIndentTask.java,v done Checking in html/editor/src/org/netbeans/modules/html/editor/indent/HtmlIndentTask.java; /cvs/html/editor/src/org/netbeans/modules/html/editor/indent/HtmlIndentTask.java,v <-- HtmlIndentTask.java initial revision: 1.1 done Checking in web/jspsyntax/src/org/netbeans/modules/web/core/syntax/resources/layer.xml; /cvs/web/jspsyntax/src/org/netbeans/modules/web/core/syntax/resources/layer.xml,v <-- layer.xml new revision: 1.21; previous revision: 1.20 done RCS file: /cvs/web/jspsyntax/src/org/netbeans/modules/web/core/syntax/indent/JspIndentTask.java,v done Checking in web/jspsyntax/src/org/netbeans/modules/web/core/syntax/indent/JspIndentTask.java; /cvs/web/jspsyntax/src/org/netbeans/modules/web/core/syntax/indent/JspIndentTask.java,v <-- JspIndentTask.java initial revision: 1.1 done RCS file: /cvs/web/jspsyntax/src/org/netbeans/modules/web/core/syntax/indent/JspIndentTaskFactory.java,v done Checking in web/jspsyntax/src/org/netbeans/modules/web/core/syntax/indent/JspIndentTaskFactory.java; /cvs/web/jspsyntax/src/org/netbeans/modules/web/core/syntax/indent/JspIndentTaskFactory.java,v <-- JspIndentTaskFactory.java initial revision: 1.1 done Checking in html/editor/nbproject/project.xml; /cvs/html/editor/nbproject/project.xml,v <-- project.xml new revision: 1.21; previous revision: 1.20 done
Applied the patch for Schlieman's IndentTask impl. Checking in IndentFactory.java; /cvs/languages/engine/src/org/netbeans/modules/languages/features/IndentFactory.java,v <-- IndentFactory.java new revision: 1.4; previous revision: 1.3 done
verifed. Build 200707310000
*** Issue 111947 has been marked as a duplicate of this issue. ***