     // MARK: Private Methods
     
     /// perform highlighting
-    private func highlight(string: String, range highlightRange: NSRange, completionHandler: @escaping (() -> Void) = {}) -> Progress? {
+    private func highlight(string: String, range highlightRange: NSRange, completionHandler: @escaping (() -> Void) = {}) -> Progress {
         
         assert(Thread.isMainThread)
         assert(!(string as NSString).className.contains("MutableString"))
-        
-        guard !highlightRange.isEmpty, !self.style.isNone else { return nil }
-        
-        // just clear current highlight and return if no coloring needs
-        guard self.style.hasHighlightDefinition else {
-            self.textStorage.apply(highlights: [:], range: highlightRange)
-            completionHandler()
-            return nil
-        }
-        
-        let wholeRange = string.nsRange
-        let styleName = self.style.name
+        assert(!highlightRange.isEmpty)
+        assert(!self.style.isNone)
         
         let definition = SyntaxHighlightParseOperation.ParseDefinition(extractors: self.style.highlightExtractors,
                                                                        pairedQuoteTypes: self.style.pairedQuoteTypes,

                }
                
                // cache result if whole text was parsed
                if highlightRange == wholeRange {
                    self?.highlightCache = Cache(styleName: styleName, string: string, highlights: highlights)
                }
                
                self?.textStorage.apply(highlights: highlights, range: highlightRange)
                
                progress.completedUnitCount += 1
            }
        }
        

                    highlightRange.length = effectiveRange.upperBound - highlightRange.location
                }
            }
            
            if highlightRange.upperBound < bufferLength {
                return NSRange(location: 0, length: highlightRange.upperBound)
            }
            
            return highlightRange
        }()
        
        guard !highlightRange.isEmpty else { return nil }
        
        // just clear current highlight and return if no coloring needs
        guard self.style.hasHighlightDefinition else {
            self.textStorage.apply(highlights: [:], range: highlightRange)
            completionHandler()
            return nil
        }
        
        // use cache if the content of the whole document is the same as the last
