matthiasblaesing opened a new pull request, #8844:
URL: https://github.com/apache/netbeans/pull/8844

   The CSL/GSF infrastructure of NetBeans provides the basic infrastructure for 
the editor to highlight other occurrences corresponding to the element the 
caret is currently being placed on.
   
   For Java and PHP there is an option offered to keep the occurrences, even 
when the caret is moved of the highlightable element. The occurrences 
hightlights are then retained until another highlightable element is selected. 
This is called "Keep Marks" in NetBeans options.
   
   In NB27 for PHP the option to switch "Keep Marks" was wired up, but proved 
to be problematic. The OccurrenceFinder class, GSF/CSL implementors have to 
implement, returns highlighting areas. The return consists of indexes into the 
text content. For normal operation the finder can trivially be run again when 
the text is modified to update the highlights, this is not the case for the 
"Keep Marks" case. As the positions of the characters change, caused by 
deletions and insertions, the highlights can't be updated, as the originating 
element is not accessible anymore (the caret was moved of it).
   
   The Swing Document class has a solution for this: javax.swing.text.Position. 
Under the hood CSL/GSF already uses this in the GsfSemanticLayer, so the 
problem is solved there.
   
   To support "Keep Marks", handling of this configuration has to move to the 
CSL/GSF level.
   
   In addition to this there is no need to scan for occurrences if the 
highlighting is disabled, so that also moves to the CSL/GSF layer.
   
   With the infrastructure in place, in addition to Java and PHP (now fixed), 
support is added for:
   
   - ANTLR 3
   - ANTLR 4
   - Groovy
   - Expression Language (JSF/JSP)
   - CSS
   - Javascript
   - JSON
   
   <img width="482" height="324" alt="grafik" 
src="https://github.com/user-attachments/assets/84361cb8-851e-4d39-a564-f797a93c8e10";
 />
   
   <img width="482" height="324" alt="grafik" 
src="https://github.com/user-attachments/assets/376a5f8b-fc87-4253-b4e7-6014fe118c60";
 />
   
   Closes: #8803


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to