Skip to content

Commit c8d1b94

Browse files
committed
Fix: remove verbose debug prints.
1 parent 38b5214 commit c8d1b94

File tree

2 files changed

+9
-14
lines changed

2 files changed

+9
-14
lines changed

client/src/CodeMirror-integration.mts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,7 @@ class DocBlockWidget extends WidgetType {
449449

450450
// See [toDom](https://codemirror.net/docs/ref/#view.WidgetType.toDOM).
451451
toDOM() {
452+
console.log("toDOM", this.delimiter, this.indent, this.contents);
452453
// Wrap this in an enclosing div.
453454
const wrap = document.createElement("div");
454455
wrap.className = "CodeChat-doc";
@@ -476,6 +477,7 @@ class DocBlockWidget extends WidgetType {
476477
// If this change was produced by a user edit, then the DOM was already
477478
// updated. Stop here.
478479
if (this.is_user_change) {
480+
console.log("updateDom - user change ignored.");
479481
return true;
480482
}
481483
(dom.childNodes[0] as HTMLDivElement).innerHTML = this.indent;
@@ -599,6 +601,7 @@ const on_dirty = (
599601
// The div that's dirty. It must be a child of the doc block div.
600602
event_target: HTMLElement,
601603
) => {
604+
console.log("on_dirty target", event_target.innerHTML);
602605
if (on_dirty_scheduled) {
603606
return;
604607
}
@@ -792,8 +795,6 @@ export const DocBlockPlugin = ViewPlugin.fromClass(
792795
// div it will replace.
793796
target.insertBefore(tinymce_div, null);
794797

795-
// Setting the content makes TinyMCE consider it dirty
796-
// -- ignore this "dirty" event.
797798
tinymce.activeEditor!.setContent(
798799
contents_div.innerHTML,
799800
);
@@ -1151,6 +1152,7 @@ export const apply_diff_str = (before: string, diffs: StringDiff[]) => {
11511152

11521153
// Return the JSON data to save from the current CodeMirror-based document.
11531154
export const CodeMirror_save = (): CodeMirrorDiffable => {
1155+
console.log("Saving...");
11541156
// This is the data to write — the source code. First, transform the HTML
11551157
// back into code and doc blocks.
11561158
const code_mirror: CodeMirror = current_view.state.toJSON(

server/src/translation.rs

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ use crate::{
242242
// -----------------------------------------------------------------------------
243243
//
244244
// The max length of a message to show in the console.
245-
const MAX_MESSAGE_LENGTH: usize = 3000;
245+
const MAX_MESSAGE_LENGTH: usize = 500;
246246

247247
lazy_static! {
248248
/// A regex to determine the type of the first EOL. See 'PROCESSINGS\`.
@@ -893,17 +893,14 @@ impl TranslationTask {
893893
};
894894
// Send a diff if possible.
895895
let client_contents = if self.sent_full {
896-
let diff = self.diff_code_mirror(
896+
self.diff_code_mirror(
897897
ccfw.metadata.clone(),
898898
self.version,
899899
ccfw.version,
900900
code_mirror_translated,
901-
);
902-
debug!("Sending diff update:\n{:#?}\n\n", diff);
903-
diff
901+
)
904902
} else {
905903
self.sent_full = true;
906-
debug!("Sending full update:\n{:#?}\n\n", ccfw);
907904
ccfw.clone()
908905
};
909906
queue_send_func!(self.to_client_tx.send(EditorMessage {
@@ -1103,7 +1100,7 @@ impl TranslationTask {
11031100
cfw_version,
11041101
&code_mirror_translated,
11051102
);
1106-
debug!("Sending re-translation update id = {} back to the Client:\n{client_contents:#?}\n", self.id);
1103+
debug!("Sending re-translation update id = {} back to the Client.", self.id);
11071104
queue_send_func!(self.to_client_tx.send(EditorMessage {
11081105
id: self.id,
11091106
message: EditorMessageContents::Update(
@@ -1129,10 +1126,6 @@ impl TranslationTask {
11291126
// Correct EOL endings for use with the IDE.
11301127
let new_source_code_eol = eol_convert(new_source_code, &self.eol);
11311128
let ccfw = if self.sent_full && self.allow_source_diffs {
1132-
debug!(
1133-
"Sending diff.\nBefore:\n{:#?}\n\nAfter:\n{:#?}\n\n",
1134-
self.source_code, new_source_code_eol
1135-
);
11361129
Some(CodeChatForWeb {
11371130
metadata: cfw.metadata,
11381131
source: CodeMirrorDiffable::Diff(CodeMirrorDiff {
@@ -1169,7 +1162,7 @@ impl TranslationTask {
11691162
}
11701163
},
11711164
};
1172-
debug!("Sending update id = {}; full contents:\n{:#?}", client_message.id, codechat_for_web);
1165+
debug!("Sending update id = {}", client_message.id);
11731166
queue_send_func!(self.to_ide_tx.send(EditorMessage {
11741167
id: client_message.id,
11751168
message: EditorMessageContents::Update(UpdateMessageContents {

0 commit comments

Comments
 (0)