mirror of
https://github.com/VSCodeVim/Vim.git
synced 2024-09-11 12:25:59 +03:00
Use Date.now()
rather than performance.now()
or Number(new Date())
to get timestamp
This commit is contained in:
parent
cb8097822b
commit
156022912c
@ -333,7 +333,7 @@ export async function activate(context: vscode.ExtensionContext, handleLocal: bo
|
||||
const mh = await getAndUpdateModeHandler();
|
||||
if (mh && StatusBar.lastMessageTime) {
|
||||
// TODO: Using the time elapsed works most of the time, but is a bit of a hack
|
||||
const timeElapsed = Number(new Date()) - Number(StatusBar.lastMessageTime);
|
||||
const timeElapsed = Date.now() - Number(StatusBar.lastMessageTime);
|
||||
if (timeElapsed > 100) {
|
||||
StatusBar.clear(mh.vimState, true);
|
||||
}
|
||||
|
@ -403,7 +403,7 @@ export class ModeHandler implements vscode.Disposable, IModeHandler {
|
||||
}
|
||||
|
||||
public async handleKeyEvent(key: string): Promise<void> {
|
||||
const now = Number(new Date());
|
||||
const now = Date.now();
|
||||
const printableKey = Notation.printableKey(key, configuration.leader);
|
||||
|
||||
// Check forceStopRemapping
|
||||
@ -552,9 +552,7 @@ export class ModeHandler implements vscode.Disposable, IModeHandler {
|
||||
// with the next remapper check.
|
||||
this.vimState.recordedState.resetCommandList();
|
||||
|
||||
ModeHandler.logger.debug(
|
||||
`handleKeyEvent('${printableKey}') took ${Number(new Date()) - now}ms`
|
||||
);
|
||||
ModeHandler.logger.debug(`handleKeyEvent('${printableKey}') took ${Date.now() - now}ms`);
|
||||
|
||||
// If we are handling a remap and the last movement failed stop handling the remap
|
||||
// and discard the rest of the keys. We throw an Exception here to stop any other
|
||||
|
@ -1,5 +1,4 @@
|
||||
import { alt, any, lazy, noneOf, oneOf, Parser, seq, string, seqMap, eof } from 'parsimmon';
|
||||
import { performance } from 'perf_hooks';
|
||||
import { Position, Range, TextDocument } from 'vscode';
|
||||
import { configuration } from '../configuration/configuration';
|
||||
import { VimState } from '../state/vimState';
|
||||
@ -125,7 +124,7 @@ export class Pattern {
|
||||
|
||||
this.regex.lastIndex = startOffset;
|
||||
|
||||
const start = performance.now();
|
||||
const start = Date.now();
|
||||
|
||||
const matchRanges = {
|
||||
beforeWrapping: [] as PatternMatch[],
|
||||
@ -158,7 +157,7 @@ export class Pattern {
|
||||
groups: match,
|
||||
});
|
||||
|
||||
if (performance.now() - start > Pattern.MAX_SEARCH_TIME) {
|
||||
if (Date.now() - start > Pattern.MAX_SEARCH_TIME) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user