Skip to content
Open

Dev1 #110

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
28 changes: 2 additions & 26 deletions server/.cargo/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,31 +17,7 @@ TS_RS_EXPORT_DIR = { value = "../client/src/rust-types", relative = true }
# TypeScript's convention.
TS_RS_IMPORT_EXTENSION = "ts"

# Code coverage, the manual way:
#
# 1. Run `cargo install rustfilt` per the
# [code coverage docs](https://doc.rust-lang.org/rustc/instrument-coverage.html#building-the-demangler).
# 2. You must manually run `rustup component add llvm-tools-preview` following
# the
# [coverge docs](https://doc.rust-lang.org/rustc/instrument-coverage.html#installing-llvm-coverage-tools).
# Per some searching, also run `cargo install cargo-binutils` to put these
# tools in the path.
# 3. In Powershell, `$Env:RUSTFLAGS = "-C instrument-coverage"` then `cargo
# test`. When the tests run, record the name of the test binary.
# 4. `rust-profdata merge -sparse default_*.profraw -o default.profdata`.
# 5. `rust-cov show --Xdemangler=rustfilt
# target\debug\deps\code_chat_editor-4dbe5c7815a53cd9.exe
# --instr-profile=default.profdata --ignore-filename-regex=\\.cargo\\registry
# --format=html --output-dir=coverage`, replacing the binary path with the
# one recorded in step 3.
# 6. Open the file `coverage\index.html`.
#
# Or, `cargo install cargo-tarpaulin` then `cargo tarpaulin --ignore-panics
# --out=html --skip-clean`.

[build]
# Set these to match the output from `cargo tarpaulin --print-rust-flags` to
# avoid recompiles.
#
# This is commented out; for development, uncomment this.
##rustflags = ["-Cdebuginfo=2", "-Cstrip=none", "--cfg=tarpaulin", "-Cinstrument-coverage"]
# To check coverage, `cargo install cargo-tarpaulin` then `cargo tarpaulin
# --skip-clean --out=html --target-dir=tarpaulin`.
8 changes: 3 additions & 5 deletions server/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,12 @@
target/

# Output from profiling.
tarpaulin/
*.profraw
tarpaulin-report.html

# Copied files needed to `cargo publish`.
static/
# Other files.
hashLocations.json

config.json
*.log
.windows/

# CodeChat Editor lexer: python. See TODO.
20 changes: 19 additions & 1 deletion server/tests/overall_2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ async fn test_6_core(

// Perform edits.
body_content.send_keys("a").await.unwrap();
let client_id = INITIAL_CLIENT_MESSAGE_ID;
let mut client_id = INITIAL_CLIENT_MESSAGE_ID;
let msg = codechat_server.get_message_timeout(TIMEOUT).await.unwrap();
let client_version = get_version(&msg);
assert_eq!(
Expand Down Expand Up @@ -406,6 +406,24 @@ async fn test_6_core(
);
let version = client_version;
codechat_server.send_result(client_id, None).await.unwrap();
client_id += MESSAGE_ID_INCREMENT;

// Wait for a second update that's empty. Not sure why.
assert_eq!(
codechat_server.get_message_timeout(TIMEOUT).await.unwrap(),
EditorMessage {
id: client_id,
message: EditorMessageContents::Update(UpdateMessageContents {
file_path: path_str.clone(),
cursor_position: None,
includes_marker: false,
scroll_position: None,
is_re_translation: false,
contents: None,
})
}
);
codechat_server.send_result(client_id, None).await.unwrap();
//client_id += MESSAGE_ID_INCREMENT;

// Send new text, which turns into a diff.
Expand Down
1 change: 1 addition & 0 deletions server/tests/overall_common/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,7 @@ pub async fn goto_line(
&& update.contents.is_none()
&& update.cursor_position != Some(line)
{
codechat_server.send_result(*client_id, None).await.unwrap();
*client_id += MESSAGE_ID_INCREMENT;
msg = codechat_server.get_message_timeout(TIMEOUT).await.unwrap();
}
Expand Down
Loading