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.
to reproduce: 1) open the OTA schema file attached to issue #87024 2) put the caret to the middle of name of an element somewhere at the begining of the file 3) push a letter key and hold it for a while => CPU load is on 100% and the repaint is very slow The cause of the problem is XMLSyntaxSupport.findMatchingBlock() being called synchronously from the document change. The scan is very long in such case since there isn't such element in the document so the scan goes to the end of the file (or to the beginning if you edit and endtag). I remembed there was an attempt to call the FMB asynchronously in the editor infrastrucure, but it was reverted for some reason. Isn't it possible to do that somehow now?
I am not sure if we want to fix this in the old SyntaxSupport. We would like to prepare a new SPI for braces/tags matching and it should solve this problem.
OK, that would be cool. I suppose this won't happen in 6.0 right? In such case, we should do a workaround in the xml editor (probably by extending the ExtCaret class to use a postponed task to call FMB, and setting the ext. class in XMLKit.createCaret())????
I'm hoping to get it ready for M10, but if I can't make it then we'll have to do the workaround you suggested.
Super, thanks for the info. BTW, do you have an issue for that I could use to watch the progress?
*** Issue 103018 has been marked as a duplicate of this issue. ***
still reproducible
What's the role of findMatchingBlock() inside a xml document? Is there a way to disable this?
Don't use that. There is a new SPI in http://bits.netbeans.org/dev/javadoc/org-netbeans-modules-editor-bracesmatching/overview-summary.html. Let me know if you have any problem with using it. Thanks.
Sorry, I should have asked differently. Currently, how does the findMatchingBlock() gets invoked in xml? I mean whats the hook. I want to turn it off and see the improvement.
just commenting the body out and returning null instead should be enought.
The code in editor.bracesmatching looks for BracesMatcherFactory registerted for your document's mime type, if one is found it's asked to create a BracesMatcher instance. If there is no factory for the given mime type the code falls back to a default BracesMatcher implementation which tries to call ExtSyntaxSuport.findMatchingBlock if this method is re-implemented for the document's kit. Otherwise the default matcher uses a simple algorithm for matching certain characters (eg. brackets, etc). So, I would say that if you register BracesMatcherFactory for text/xml the instance of BracesMatcher that the factory returns will be used and ExtSytaxSupport.findMatchingBlocks will never be called again. You can then remove it. Uh, I just looked at the docs and they seem to give wrong example of a factory registration, the correct way is shown below. Please note the extra folder called 'BracesMatchers'. <folder name="Editors"> <folder name="text"> <folder name="x-something"> <folder name="BracesMatchers"> <file name="org-some-module-BMFactory.instance" /> </folder> </folder> </folder> </folder> I'll fix the docs asap. Sorry.
Thanks vstejskal, this is useful.
May be a reason for issue 139181, will try to fix it soon.
Part 1: http://hg.netbeans.org/main?cmd=changeset;node=bfd41ad8c781 Added new brach matcher, not enabled yet.
Part2: Enabled the new matcher http://hg.netbeans.org/main?cmd=changeset;node=066d52715050.
Caused http://deadlock.netbeans.org/hudson/job/trunk/2706/testReport/org.netbeans.core.projects/ValidateLayerConsistencyTest/testFolderOrdering/ No warnings relating to folder ordering in [Editors/text/xml/BracesMatchers, Editors/BracesMatchers] expected:<[]> but was:<[Not all children in / marked with the position attribute: [org-netbeans-modules-xml-text-bracematch-XMLBraceMatcherFactory.instance], but some are: [org-netbeans-modules-editor-bracesmatching-LegacyEssMatcher.instance, org-netbeans-modules-editor-bracesmatching-DefaultMatcher.instance]]>