Skip to content

Commit

Permalink
Detect VSCode Remote-SSH when using --visualize (rust-lang#1292)
Browse files Browse the repository at this point in the history
  • Loading branch information
tedinski authored Jun 22, 2022
1 parent 4fdf604 commit 8a5e579
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 15 deletions.
25 changes: 10 additions & 15 deletions docs/src/cheat-sheets.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,15 +110,6 @@ git submodule foreach --recursive git clean -xffd
git submodule update --init
```

```bash
# Done with that PR, time for a new one?
git switch main
git pull origin
git submodule update --init
cd src/kani-compiler
cargo build --workspace
```

```bash
# Need to update local branch (e.g. for an open pull request?)
git fetch origin
Expand All @@ -134,16 +125,20 @@ git switch pr/$ID
```

```bash
# Search only git-tracked files
git grep codegen_panic
# Push to someone else's pull request
git origin add $USER $GIR_URL_FOR_THAT_USER
git push $USER $LOCAL_BRANCH:$THEIR_PR_BRANCH_NAME
```

```bash
# See all commits that are part of Kani, not part of Rust
git log --graph --oneline origin/upstream-rustc..origin/main
# Search only git-tracked files
git grep codegen_panic
```

```bash
# See all files modified by Kani (compared to upstream Rust)
git diff --stat origin/upstream-rustc..origin/main
# Accidentally commit to main?
# "Move" commit to a branch:
git checkout -b my_branch
# Fix main:
git branch --force main origin/main
```
9 changes: 9 additions & 0 deletions kani-driver/src/call_cbmc_viewer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,15 @@ impl KaniSession {
// Let the user know
if !self.args.quiet {
println!("Report written to: {}/html/index.html", report_dir.to_string_lossy());
// If using VS Code with Remote-SSH, suggest an option for remote viewing:
if std::env::var("VSCODE_IPC_HOOK_CLI").is_ok()
&& std::env::var("SSH_CONNECTION").is_ok()
{
println!(
"VS Code automatically forwards ports for locally hosted servers. To view the report remotely,\nTry: python3 -m http.server --directory {}/html",
report_dir.to_string_lossy()
);
}
}

Ok(())
Expand Down

0 comments on commit 8a5e579

Please sign in to comment.