55 ReadOnlyHatMap ,
66 TokenHat ,
77} from "@cursorless/common" ;
8- import { hrtime } from "process" ;
98import { ide } from "../singletons/ide.singleton" ;
10- import { abs } from "../util/bigint" ;
119import { Debug } from "./Debug" ;
1210import { HatAllocator } from "./HatAllocator" ;
1311import { IndividualHatMap } from "./IndividualHatMap" ;
@@ -16,7 +14,7 @@ import { RangeUpdater } from "./updateSelections/RangeUpdater";
1614/**
1715 * Maximum age for the pre-phrase snapshot before we consider it to be stale
1816 */
19- const PRE_PHRASE_SNAPSHOT_MAX_AGE_NS = BigInt ( 6e10 ) ; // 60 seconds
17+ const PRE_PHRASE_SNAPSHOT_MAX_AGE_MS = 60000 ; // 60 seconds
2018
2119/**
2220 * Maps from (hatStyle, character) pairs to tokens
@@ -34,7 +32,7 @@ export class HatTokenMapImpl implements HatTokenMap {
3432 * hat with the same color and shape will refer to the same logical range.
3533 */
3634 private prePhraseMapSnapshot ?: IndividualHatMap ;
37- private prePhraseMapsSnapshotTimestamp : bigint | null = null ;
35+ private prePhraseMapsSnapshotTimestamp : number | null = null ;
3836
3937 private lastSignalVersion : string | null = null ;
4038 private hatAllocator : HatAllocator ;
@@ -106,8 +104,8 @@ export class HatTokenMapImpl implements HatTokenMap {
106104 }
107105
108106 if (
109- abs ( hrtime . bigint ( ) - this . prePhraseMapsSnapshotTimestamp ! ) >
110- PRE_PHRASE_SNAPSHOT_MAX_AGE_NS
107+ performance . now ( ) - this . prePhraseMapsSnapshotTimestamp ! >
108+ PRE_PHRASE_SNAPSHOT_MAX_AGE_MS
111109 ) {
112110 console . error (
113111 "Navigation map pre-phrase snapshot requested, but snapshot is more than a minute old" ,
@@ -149,6 +147,6 @@ export class HatTokenMapImpl implements HatTokenMap {
149147 }
150148
151149 this . prePhraseMapSnapshot = this . activeMap . clone ( ) ;
152- this . prePhraseMapsSnapshotTimestamp = hrtime . bigint ( ) ;
150+ this . prePhraseMapsSnapshotTimestamp = performance . now ( ) ;
153151 }
154152}
0 commit comments