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

   This one is bugging me for years.
   
   Whenever I insert or write text to a CSL based editor the semantic coloring 
does not keep track with the document change
   and some text elements get  discolored as you type. The next parsing run 
would then set the colors right.
   
   See the discoloration of `permissions` before:
   [Screencast From 2024-12-01 
13-04-47.webm](https://github.com/user-attachments/assets/6be42a1e-e5ef-4b2e-9810-c1c2eaf923b8)
   
   After this fix:
   [Screencast From 2024-12-01 
13-07-58.webm](https://github.com/user-attachments/assets/0c94ec55-0d84-4b7b-ac61-6e566126e47f)
   
   Fortunately or Unfortunately , I had to change the code here and there in 
order to be able to understand what's going on.
   
   So this could be a one -liner, removing the `Math.min` form:
   
https://github.com/apache/netbeans/blob/c2ec6e4d37b9195017e8df82406bfab6b2d29d95/ide/csl.api/src/org/netbeans/modules/csl/editor/semantic/GsfSemanticLayer.java#L322
   
   I submitted my whole work on this though, hoping that it would simplify that 
part of CSL and makes it less cryptic.
   
   So my changes in brief (read it with the code changes):
     1. Updated the language level to Java 17
     2. Made `SequenceElement` as a record. The `ComparisonItem` got me a lot 
of headache, at the end it was only used to get the `tailSet` method work. 
Interestingly that subset just used as an optimization, the editor works even 
if the highlight sequence return the whole sequence all the time. (Tested with 
a 3500+ lines yaml, the performance overhead was barely noticeable.) Yet, I've 
copied the `SortedSet` into a list, where a simple binary search could be used 
to get a partial iterator.
     3. Using just the iterator on `GsfHighlightSequence` made it a lot simpler.
     4. Initially, I was thinking that the issue is due to some failed/garbage 
collected weak listener creation/registration, so I moved a few things to 
lambdas there.
     5. Removed a lot of commented/unused code inherited from Retouche (I think 
that was the code name of the Java Editor rewrite)


-- 
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