Skip to content

Commit 553641e

Browse files
committed
Clean: prettier.
1 parent ff3d80f commit 553641e

File tree

4 files changed

+59
-50
lines changed

4 files changed

+59
-50
lines changed

client/src/CodeChatEditor.mts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,10 @@ const _open_lp = async (
291291
// However, this doesn't seem to work for the cursor location.
292292
// Perhaps when TinyMCE normalizes the document, this gets lost?
293293
const bm = tinymce.activeEditor!.selection.getBookmark();
294-
doc_content = "Plain" in source ? source.Plain.doc : apply_diff_str(doc_content, source.Diff.doc);
294+
doc_content =
295+
"Plain" in source
296+
? source.Plain.doc
297+
: apply_diff_str(doc_content, source.Diff.doc);
295298
tinymce.activeEditor!.setContent(doc_content);
296299
tinymce.activeEditor!.selection.moveToBookmark(bm);
297300
}

client/src/CodeMirror-integration.mts

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -222,9 +222,9 @@ export const docBlockField = StateField.define<DecorationSet>({
222222
typeof effect.value.contents === "string"
223223
? effect.value.contents
224224
: apply_diff_str(
225-
prev.spec.widget.contents,
226-
effect.value.contents,
227-
),
225+
prev.spec.widget.contents,
226+
effect.value.contents,
227+
),
228228
effect.value.dom ?? prev.spec.widget.dom,
229229
),
230230
...decorationOptions,
@@ -467,7 +467,7 @@ export const mathJaxTypeset = async (
467467
// The node to typeset.
468468
node: HTMLElement,
469469
// An optional function to run when the typeset finishes.
470-
afterTypesetFunc: () => void = () => { },
470+
afterTypesetFunc: () => void = () => {},
471471
) => {
472472
try {
473473
await window.MathJax.typesetPromise([node]);
@@ -570,8 +570,8 @@ const on_dirty = (
570570

571571
export const DocBlockPlugin = ViewPlugin.fromClass(
572572
class {
573-
constructor(view: EditorView) { }
574-
update(update: ViewUpdate) { }
573+
constructor(view: EditorView) {}
574+
update(update: ViewUpdate) {}
575575
},
576576
{
577577
eventHandlers: {
@@ -644,7 +644,7 @@ export const DocBlockPlugin = ViewPlugin.fromClass(
644644
// containing div.
645645
for (
646646
let current_node = sel.anchorNode,
647-
is_first = true;
647+
is_first = true;
648648
// Continue until we find the div which contains
649649
// the doc block contents: either it's not an
650650
// element (such as a div), ...
@@ -654,7 +654,7 @@ export const DocBlockPlugin = ViewPlugin.fromClass(
654654
"CodeChat-doc-contents",
655655
);
656656
current_node = current_node.parentNode!,
657-
is_first = false
657+
is_first = false
658658
) {
659659
// Store the index of this node in its' parent
660660
// list of child nodes/children. Use
@@ -726,14 +726,14 @@ export const DocBlockPlugin = ViewPlugin.fromClass(
726726
;
727727
selection_path.length;
728728
selection_node =
729-
// As before, use the more-consistent `children`
730-
// except for the last element, where we might
731-
// be selecting a `text` node.
732-
(
733-
selection_path.length > 1
734-
? selection_node.children
735-
: selection_node.childNodes
736-
)[selection_path.shift()!]! as HTMLElement
729+
// As before, use the more-consistent `children`
730+
// except for the last element, where we might
731+
// be selecting a `text` node.
732+
(
733+
selection_path.length > 1
734+
? selection_node.children
735+
: selection_node.childNodes
736+
)[selection_path.shift()!]! as HTMLElement
737737
);
738738
// Use that to set the selection.
739739
tinymce_singleton!.selection.setCursorLocation(

client/src/shared_types.mts

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -31,39 +31,39 @@ export type ResultOkTypes = {
3131

3232
export type MessageResult =
3333
| {
34-
Ok: "Void" | ResultOkTypes;
35-
}
34+
Ok: "Void" | ResultOkTypes;
35+
}
3636
| {
37-
Err: string;
38-
};
37+
Err: string;
38+
};
3939

4040
export type EditorMessageContents =
4141
| {
42-
Update: UpdateMessageContents;
43-
}
42+
Update: UpdateMessageContents;
43+
}
4444
| {
45-
CurrentFile: [string, boolean?];
46-
}
45+
CurrentFile: [string, boolean?];
46+
}
4747
| {
48-
Opened: IdeType;
49-
}
48+
Opened: IdeType;
49+
}
5050
| {
51-
RequestClose: null;
52-
}
51+
RequestClose: null;
52+
}
5353
| {
54-
OpenUrl: string;
55-
}
54+
OpenUrl: string;
55+
}
5656
| {
57-
LoadFile: string;
58-
}
57+
LoadFile: string;
58+
}
5959
| {
60-
ClientHtml: string;
61-
// Not included, since this is server->server only.
62-
//Closed?: null;
63-
}
60+
ClientHtml: string;
61+
// Not included, since this is server->server only.
62+
//Closed?: null;
63+
}
6464
| {
65-
Result: MessageResult;
66-
};
65+
Result: MessageResult;
66+
};
6767

6868
export type EditorMessage = {
6969
id: number;
@@ -79,11 +79,11 @@ export type CodeChatForWeb = {
7979

8080
export type CodeMirrorDiffable =
8181
| {
82-
Plain: CodeMirror;
83-
}
82+
Plain: CodeMirror;
83+
}
8484
| {
85-
Diff: CodeMirrorDiff;
86-
};
85+
Diff: CodeMirrorDiff;
86+
};
8787

8888
export type CodeMirror = {
8989
doc: string;
@@ -108,14 +108,14 @@ export type StringDiff = {
108108

109109
export type CodeMirrorDocBlockTransaction =
110110
| {
111-
Add: CodeMirrorDocBlockJson;
112-
}
111+
Add: CodeMirrorDocBlockJson;
112+
}
113113
| {
114-
Update: CodeMirrorDocBlockUpdate;
115-
}
114+
Update: CodeMirrorDocBlockUpdate;
115+
}
116116
| {
117-
Delete: CodeMirrorDocBlockDelete;
118-
};
117+
Delete: CodeMirrorDocBlockDelete;
118+
};
119119

120120
// How a doc block is stored using CodeMirror.
121121
export type CodeMirrorDocBlockJson = [

extensions/VSCode/src/extension.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,13 @@ const send_message = (
562562
};
563563

564564
// Format a complex data structure as a string when in debug mode.
565-
const format_struct = (complex_data_structure: any): string => DEBUG_ENABLED ? JSON.stringify(complex_data_structure).substring(0, MAX_MESSAGE_LENGTH) : "";
565+
const format_struct = (complex_data_structure: any): string =>
566+
DEBUG_ENABLED
567+
? JSON.stringify(complex_data_structure).substring(
568+
0,
569+
MAX_MESSAGE_LENGTH,
570+
)
571+
: "";
566572

567573
// Report an error from the server.
568574
const report_server_timeout = (message_id: number) => {

0 commit comments

Comments
 (0)