Skip to content
Merged

Dev #93

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ Changelog

* No changes.

Version 0.1.43 -- 2025-Dec-05
--------------------------------------------------------------------------------

* Fix cursor movement errors in the Client.
* Prevent unnecessary saves of Client data to the IDE.

Version 0.1.42 -- 2025-Dec-04
--------------------------------------------------------------------------------

Expand Down
2 changes: 1 addition & 1 deletion client/package.json5
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
url: 'https://github.com/bjones1/CodeChat_editor',
},
type: 'module',
version: '0.1.42',
version: '0.1.43',
dependencies: {
'@codemirror/commands': '^6.10.0',
'@codemirror/lang-cpp': '^6.0.3',
Expand Down
6 changes: 2 additions & 4 deletions client/src/CodeMirror-integration.mts
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,6 @@ class DocBlockWidget extends WidgetType {
// If this change was produced by a user edit, then the DOM was already
// updated. Stop here.
if (this.is_user_change) {
console.log("user change -- skipping DOM update.");
return true;
}
(dom.childNodes[0] as HTMLDivElement).innerHTML = this.indent;
Expand Down Expand Up @@ -676,7 +675,6 @@ const on_dirty = (

// Only run this after typesetting is done.
window.MathJax.whenReady(async () => {
console.log("Starting update for user change.");
on_dirty_scheduled = false;
// Find the doc block parent div.
const target = (event_target as HTMLDivElement).closest(
Expand Down Expand Up @@ -1098,10 +1096,10 @@ export const CodeMirror_load = async (
setup: (editor: Editor) => {
// See the
// [docs](https://www.tiny.cloud/docs/tinymce/latest/events/#editor-core-events).
editor.on("Dirty", (event: any) => {
editor.on("input", (event: any) => {
// Get the div TinyMCE stores edits in. TODO: find
// documentation for `event.target.bodyElement`.
const target_or_false = event.target?.bodyElement;
const target_or_false = event.target as HTMLElement;
if (target_or_false == null) {
return false;
}
Expand Down
12 changes: 6 additions & 6 deletions extensions/VSCode/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion extensions/VSCode/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ license = "GPL-3.0-only"
name = "codechat-editor-vscode-extension"
readme = "../README.md"
repository = "https://github.com/bjones1/CodeChat_Editor"
version = "0.1.42"
version = "0.1.43"

[lib]
crate-type = ["cdylib"]
Expand Down
2 changes: 1 addition & 1 deletion extensions/VSCode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"type": "git",
"url": "https://github.com/bjones1/CodeChat_Editor"
},
"version": "0.1.42",
"version": "0.1.43",
"activationEvents": [
"onCommand:extension.codeChatEditorActivate",
"onCommand:extension.codeChatEditorDeactivate"
Expand Down
38 changes: 18 additions & 20 deletions extensions/VSCode/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,14 @@ export const activate = (context: vscode.ExtensionContext) => {
ignore_active_editor_change = false;
return;
}
send_update(false);
// Skip an update if we've already sent a `CurrentFile` for this editor.
if (
current_editor ===
vscode.window.activeTextEditor
) {
return;
}
send_update(true);
}),
);

Expand All @@ -174,6 +181,9 @@ export const activate = (context: vscode.ExtensionContext) => {
ignore_selection_change = false;
return;
}
console_log(
"CodeChat Editor extension: sending updated cursor/scroll position.",
);
send_update(false);
},
),
Expand Down Expand Up @@ -246,19 +256,6 @@ export const activate = (context: vscode.ExtensionContext) => {
webview_panel = undefined;
await stop_client();
});

// Render when the webview panel is shown.
webview_panel.onDidChangeViewState(
(
_event: vscode.WebviewPanelOnDidChangeViewStateEvent,
) => {
// Only render if the webview was activated;
// this event also occurs when it's deactivated.
if (webview_panel?.active) {
send_update(true);
}
},
);
}
}

Expand Down Expand Up @@ -367,6 +364,9 @@ export const activate = (context: vscode.ExtensionContext) => {
await sendResult(id, "OutOfSync");
// Send an `Update` with the full text to
// re-sync the Client.
console_log(
"CodeChat Editor extension: sending update because Client is out of sync.",
);
send_update(true);
break;
}
Expand Down Expand Up @@ -395,10 +395,10 @@ export const activate = (context: vscode.ExtensionContext) => {
}
}
}
vscode.workspace.applyEdit(wse).then(() => {
ignore_text_document_change = false;
ignore_selection_change = false;
});
await vscode.workspace.applyEdit(wse);
ignore_text_document_change = false;
ignore_selection_change = false;

// Now that we've updated our text, update the
// associated version as well.
version = current_update.contents.version;
Expand All @@ -425,7 +425,6 @@ export const activate = (context: vscode.ExtensionContext) => {
// viewport, but a bit below it.
TextEditorRevealType.AtTop,
);
ignore_selection_change = false;
}

let cursor_line = current_update.cursor_position;
Expand All @@ -443,7 +442,6 @@ export const activate = (context: vscode.ExtensionContext) => {
cursor_position,
),
];
ignore_selection_change = false;
}
await sendResult(id);
break;
Expand Down
17 changes: 4 additions & 13 deletions server/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ license = "GPL-3.0-only"
name = "codechat-editor-server"
readme = "../README.md"
repository = "https://github.com/bjones1/CodeChat_Editor"
version = "0.1.42"
version = "0.1.43"

# This library allows other packages to use core CodeChat Editor features.
[lib]
Expand Down
3 changes: 3 additions & 0 deletions server/tests/fixtures/overall/overall_core/test_4/test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# The contents of this file don't matter -- tests will supply the content,
# instead of loading it from disk. However, it does need to exist for
# `canonicalize` to find the correct path to this file.
Loading