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.
Summary: | CodeTemplate: formatting is incorrect (extra CR) | ||
---|---|---|---|
Product: | javafx | Reporter: | Lark Fitzgerald <lfitzgerald> |
Component: | Editor | Assignee: | David Strupl <dstrupl> |
Status: | VERIFIED FIXED | ||
Severity: | blocker | CC: | moonko, vvg |
Priority: | P3 | ||
Version: | 6.x | ||
Hardware: | All | ||
OS: | Windows XP | ||
URL: | http://openjfx.java.sun.com/jira/browse/JFXC-1389 | ||
Issue Type: | DEFECT | Exception Reporter: | |
Bug Depends on: | 132764, 133460 | ||
Bug Blocks: | |||
Attachments: |
exception text
The incomming text in AST for this. Reatached as image :), sorry |
Description
Lark Fitzgerald
2008-04-14 16:24:42 UTC
I also see the extra CR with: eli for if ife tr wh I think this issues belongs to you. Indentation issues will be fixed with finishing issue #130588 OK It seems a problem with the file format. The current version of the javafx.editor\src\org\netbeans\modules\javafx\dataloader\DefaultAbbrevs.xml file contains Windows-like End Of Lines (CR LF) instead of Unix-like EOL (LF). That is strange for me, why a Mercurial hook doesn't fix it automatically. It will be fixed manually. It seems the problem is here: org.netbeans.modules.javafx.editor.JFXIndentTask.reformat(JFXIndentTask.java:260) org.netbeans.modules.editor.indent.TaskHandler$MimeItem.runTask(TaskHandler.java:504) org.netbeans.modules.editor.indent.TaskHandler.runTasks(TaskHandler.java:271) org.netbeans.modules.editor.indent.IndentImpl.reformat(IndentImpl.java:293) org.netbeans.modules.editor.indent.FormatterImpl.reformat(FormatterImpl.java:161) org.netbeans.lib.editor.codetemplates.CodeTemplateInsertHandler.insertTemplate(CodeTemplateInsertHandler.java:298) org.netbeans.lib.editor.codetemplates.CodeTemplateInsertHandler.processTemplate(CodeTemplateInsertHandler.java:220) org.netbeans.lib.editor.codetemplates.CodeTemplateManagerOperation.insert(CodeTemplateManagerOperation.java:238) org.netbeans.lib.editor.codetemplates.api.CodeTemplate.insert(CodeTemplate.java:104) org.netbeans.lib.editor.codetemplates.AbbrevDetection.expand(AbbrevDetection.java:404) org.netbeans.lib.editor.codetemplates.AbbrevDetection.expand(AbbrevDetection.java:360) org.netbeans.lib.editor.codetemplates.AbbrevDetection.checkExpansionKeystroke(AbbrevDetection.java:264) org.netbeans.lib.editor.codetemplates.AbbrevDetection.keyPressed(AbbrevDetection.java:224) ... All mentioned code templates have the same format of definitions as in modules for other languages, including a code template for the "fi" abbreviation. Windows EOLs are not an issue (it is fixed now). update schedule. 1. If I type: var exp : Boolean = true; 2. then type: wh 3. then press TAB I get: while (exp) { } The spacing is wrong but the AST is not empty. The same is true for tr, ife, if, or for. I do however get the empty AST for el and eli but this looks like it happens because the if part of the statement is missing. In Java, this gives a very helpful error: else without if. Will log jira for this case. tested using build: Product Version: NetBeans IDE 6.1 (Build 200804211638) Java: 1.6.0_10-beta; Java HotSpot(TM) Client VM 11.0-b11 System: Windows Vista version 6.0 running on x86; Cp1252; en_US (nb) fx NB61 nighly plugin: 269 Logged jira for el and eli http://openjfx.java.sun.com/jira/browse/JFXC-1389 The spacing issues still need to be resolved separately since the AST does not appear to affect them. Fixed. If AST is OK the spacing works corrctly. el + TAB not throws an exception: javax.swing.text.BadLocationException: offset=-1 < 0 at org.netbeans.modules.editor.indent.IndentImpl.checkOffsetInDocument(IndentImpl.java:322) Full exception attached. Created attachment 63178 [details]
exception text
Tested using: Product Version: NetBeans IDE 6.1 (Build 200804211638) Java: 1.6.0_10-beta; Java HotSpot(TM) Client VM 11.0-b11 System: Windows Vista version 6.0 running on x86; Cp1252; en_US (nb) fx NB61 nighly plugin: 271 The issue with bad position fixed. - Type if - Press the tab key The result is ------------------------- if (exp) { } -------------------------- It contains extra cr: if (exp) { // extra cr } This is not an issue for reformat. I already get this with 2 new lines. See attachment. Lark, please try to find correct assignee for this issue. Created attachment 63585 [details]
The incomming text in AST for this.
Assigning to david, Possibly related to the templates themselves? Rasto, please don't attach images as text/plain. I think the problem is in the templates --- Victor what do you think? Created attachment 64150 [details]
Reatached as image :), sorry
In the FX templates there is ${selection line}${cursor} while in java there is ${selection}${cursor} Could that be the problem? Fixed by fixing the templates in 847:a2d7040e9f70 Verified using cb333. |