Migrate console to coreEvents.emitFeedback or debugLogger (#15219)

This commit is contained in:
Adib234
2025-12-29 15:46:10 -05:00
committed by GitHub
parent dcd2449b1a
commit 10ae84869a
66 changed files with 564 additions and 425 deletions
@@ -10,7 +10,12 @@ import os from 'node:os';
import pathMod from 'node:path';
import * as path from 'node:path';
import { useState, useCallback, useEffect, useMemo, useReducer } from 'react';
import { coreEvents, CoreEvent, unescapePath } from '@google/gemini-cli-core';
import {
coreEvents,
CoreEvent,
debugLogger,
unescapePath,
} from '@google/gemini-cli-core';
import {
toCodePoints,
cpLen,
@@ -1411,7 +1416,7 @@ function textBufferReducerLogic(
break;
default: {
const exhaustiveCheck: never = dir;
console.error(
debugLogger.error(
`Unknown visual movement direction: ${exhaustiveCheck}`,
);
return state;
@@ -1751,7 +1756,7 @@ function textBufferReducerLogic(
default: {
const exhaustiveCheck: never = action;
console.error(`Unknown action encountered: ${exhaustiveCheck}`);
debugLogger.error(`Unknown action encountered: ${exhaustiveCheck}`);
return state;
}
}
@@ -2173,7 +2178,11 @@ export function useTextBuffer({
newText = newText.replace(/\r\n?/g, '\n');
dispatch({ type: 'set_text', payload: newText, pushToUndo: false });
} catch (err) {
console.error('[useTextBuffer] external editor error', err);
coreEvents.emitFeedback(
'error',
'[useTextBuffer] external editor error',
err,
);
} finally {
coreEvents.emit(CoreEvent.ExternalEditorClosed);
if (wasRaw) setRawMode?.(true);