Skip to content

Commit 22dd878

Browse files
committed
Fix: Typescript/Rust ts-rs.
1 parent 2810c02 commit 22dd878

File tree

4 files changed

+14
-15
lines changed

4 files changed

+14
-15
lines changed

builder/src/main.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -392,14 +392,15 @@ fn run_test() -> io::Result<()> {
392392
}
393393

394394
fn run_build() -> io::Result<()> {
395-
// Clean out all bundled files before the rebuild.
396-
remove_dir_all_if_exists("../client/static/bundled")?;
397-
run_client_build(false, false)?;
398-
run_script("npm", &["run", "compile"], "../extensions/VSCode", true)?;
399395
run_cmd!(
400396
cargo build --manifest-path=../builder/Cargo.toml;
401397
cargo build;
398+
cargo test export_bindings;
402399
)?;
400+
// Clean out all bundled files before the rebuild.
401+
remove_dir_all_if_exists("../client/static/bundled")?;
402+
run_client_build(false, false)?;
403+
run_script("npm", &["run", "compile"], "../extensions/VSCode", true)?;
403404
Ok(())
404405
}
405406

client/src/CodeChatEditorFramework.mts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -275,12 +275,9 @@ class WebSocketComm {
275275
current_file = (url: URL) => {
276276
// If this points to the Server, then tell the IDE to load a new file.
277277
if (url.host === window.location.host) {
278-
this.send_message(
279-
{ CurrentFile: [url.toString(), null] },
280-
() => {
281-
this.set_root_iframe_src(url.toString());
282-
},
283-
);
278+
this.send_message({ CurrentFile: [url.toString(), null] }, () => {
279+
this.set_root_iframe_src(url.toString());
280+
});
284281
} else {
285282
this.set_root_iframe_src(url.toString());
286283
}

client/src/shared_types.mts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,10 @@ import { CodeMirror } from "./rust-types/CodeMirror.js";
3030
import { StringDiff } from "./rust-types/StringDiff.js";
3131
import { CodeMirrorDocBlockTuple } from "./rust-types/CodeMirrorDocBlockTuple.js";
3232
import { UpdateMessageContents } from "./rust-types/UpdateMessageContents.js";
33+
import { ResultOkTypes } from "./rust-types/ResultOkTypes.js";
3334

3435
// Manually define this, since `ts-rs` can't export `webserver.MessageResult`.
35-
type MessageResult = Extract<EditorMessageContents, { Result: any }>;
36+
type MessageResult = { Ok: ResultOkTypes } | { Err: string };
3637

3738
export type {
3839
EditorMessageContents,

extensions/VSCode/src/extension.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ export const activate = (context: vscode.ExtensionContext) => {
369369
});
370370
break;
371371
}
372-
if (current_update.contents !== undefined) {
372+
if (current_update.contents !== null) {
373373
const source =
374374
current_update.contents.source;
375375
// Is this plain text, or a diff?
@@ -624,8 +624,8 @@ const start_render = () => {
624624
},
625625
},
626626
},
627-
cursor_position: undefined,
628-
scroll_position: undefined,
627+
cursor_position: null,
628+
scroll_position: null,
629629
},
630630
});
631631
}
@@ -639,7 +639,7 @@ const current_file = () => {
639639
if (can_render() && ate !== current_editor) {
640640
current_editor = ate;
641641
send_message({
642-
CurrentFile: [ate!.document.fileName, undefined],
642+
CurrentFile: [ate!.document.fileName, null],
643643
});
644644
}
645645
};

0 commit comments

Comments
 (0)