Community
Participate
Working Groups
Build: 0712 1.5.1 I-build The HTML validator is not validating delta changes, it's re-validating the entire document. To reproduce the scenario: 1. Debug a runtime workbench 2. Create a Web project 3. Put the following JSP file into the WebContent folder 4. Open up the JSP file 5. Put a break point at the org.eclipse.wst.html.internal.validation.HTMLValidator.validate(IRegion dirtyRegion, IValidationContext helper, IReporter reporter) method. 6. In the JSP editor, go to the very top of the document 7. Hit enter 8. You'll run into the break point many times. Resume execution every time you run into the break point. Pay attention to the value of the "dirtyRegion" input argument. It goes like this: round 1 - \r\n round 2 - <%@ page contentType="text/html; charset=UTF-8" import="java.util.Hashtable, java.util.List, java.util.ArrayList, java.net.URL, javax.xml.parsers.*, org.w3c.dom.*" %> round 3 - \r\n\r\n round 4 - <jsp:useBean id="table0" class="Hashtable" scope="session"/> and so on... Basically, the HTMLValidator is re-validating the entire document every time I hit enter at the very top of the document. 9. After the HTMLValidator completes, go to the first <jsp:useBean .../>, hit enter. Again the entire document is re-validated. This is very expensive if you have a large JSP file.
I think this deserves a P2. I'll attach the sample JSP file.
Created attachment 46912 [details] JSP file
In org.eclipse.wst.sse.ui.internal.reconcile.DirtyRegionProcessor, there's a TODO: public void documentChanged(DocumentEvent event) { if (partitionsChanged(event)) { // pa_TODO // this is a simple way to ensure old // annotations are removed when partition changes // it might be a performance hit though setEntireDocumentDirty(getDocument()); } ...
The code mentioned in comment #3 still exists and it would be worth while seeing if there is a more efficient approach.
Given the complicated tree structure it maintains in the background along with embedded other languages and the limitations on which annotations can be changed by a partially-scoped validator, it's just non-trivial to properly validate the document incrementally. It's properly marked as "total" scope so that it's only run once each time we process the set of dirty regions.