Skip to content

Commit 62d205c

Browse files
committed
Fix: lints.
Add: report exceptions throw in CodeMirror extensions.
1 parent ee45699 commit 62d205c

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

client/src/CodeChatEditor.mts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ const _open_lp = async (
207207
// including the
208208
// [@ts-ignore directive](https://www.typescriptlang.org/docs/handbook/intro-to-js-ts.html#ts-check).
209209
/// @ts-expect-error("See above.")
210-
const editorMode = EditorMode[urlParams.get("mode") ?? "edit"];
210+
const _editorMode = EditorMode[urlParams.get("mode") ?? "edit"];
211211

212212
// Get the <code>[current_metadata](#current_metadata)</code> from the
213213
// provided `code_chat_for_web` struct and store it as a global variable.
@@ -436,7 +436,7 @@ export const restoreSelection = ({
436436
// [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/platform#examples),
437437
// here's the least bad way to choose between the control key and the command
438438
// key.
439-
const os_is_osx =
439+
const _os_is_osx =
440440
navigator.platform.indexOf("Mac") === 0 || navigator.platform === "iPhone"
441441
? true
442442
: false;

client/src/CodeMirror-integration.mts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,12 @@ const docBlockFreezeAnnotation = Annotation.define<boolean>();
130130
// location updates.
131131
const noAutosaveAnnotation = Annotation.define<boolean>();
132132

133+
// Define a facet called when extensions produce an error.
134+
const exceptionSink = EditorView.exceptionSink.of((exception) => {
135+
show_toast(`Error: ${exception}`);
136+
console.error(exception);
137+
});
138+
133139
// Doc blocks in CodeMirror
134140
// -----------------------------------------------------------------------------
135141
//
@@ -988,6 +994,7 @@ export const CodeMirror_load = async (
988994
parser,
989995
basicSetup,
990996
EditorView.lineWrapping,
997+
exceptionSink,
991998
autosaveExtension,
992999
// Make tab an indent per the
9931000
// [docs](https://codemirror.net/examples/tab/). TODO:

0 commit comments

Comments
 (0)