@@ -139,7 +139,7 @@ private final class TokenizerThread extends Thread {
139139 private static final Duration MAX_TIME_PER_LINE_TOKENIZATION = Duration .ofSeconds (1 );
140140
141141 /** max time in milliseconds for multi-line validations before a consolidated {@link ModelTokensChangedEvent} is emitted */
142- private static final int MAX_TIME_PER_MULTI_LINE_VALIDATIONS = 200 ;
142+ private static final int MAX_TIME_PER_MULTI_LINE_VALIDATIONS = Duration . ofMillis ( 200 ). getNano () ;
143143
144144 /** Creates a new background thread. The thread runs with minimal priority. */
145145 TokenizerThread () {
@@ -200,7 +200,7 @@ private void revalidateTokens() {
200200 logDebug ("(%d)" , startLineNumber );
201201 }
202202
203- long startTime = System .currentTimeMillis ();
203+ long startNanoTime = System .nanoTime ();
204204 var changedRanges = new ArrayList <Range >();
205205 Range prevRange = null ;
206206 var prevLineTokens = getLineTokensOrNull (startLineIndex - 1 );
@@ -275,14 +275,14 @@ private void revalidateTokens() {
275275 }
276276
277277 // if MAX_TIME_PER_MULTI_LINE_VALIDATIONS reached, notify listeners about line changes
278- if (System .currentTimeMillis () - startTime >= MAX_TIME_PER_MULTI_LINE_VALIDATIONS ) {
278+ if (System .nanoTime () - startNanoTime >= MAX_TIME_PER_MULTI_LINE_VALIDATIONS ) {
279279 if (DEBUG_LOGGING ) {
280280 logDebug ("(%d) >> changedRanges: %s" , startLineNumber , changedRanges );
281281 }
282282 listeners .dispatchEvent (changedRanges , TMModel .this );
283283 changedRanges = new ArrayList <>();
284284 prevRange = null ;
285- startTime = System .currentTimeMillis ();
285+ startNanoTime = System .nanoTime ();
286286 }
287287 }
288288
0 commit comments