Skip to content

Commit 8a5e579

Browse files
authored
Detect VSCode Remote-SSH when using --visualize (rust-lang#1292)
1 parent 4fdf604 commit 8a5e579

File tree

2 files changed

+19
-15
lines changed

2 files changed

+19
-15
lines changed

docs/src/cheat-sheets.md

+10-15
Original file line numberDiff line numberDiff line change
@@ -110,15 +110,6 @@ git submodule foreach --recursive git clean -xffd
110110
git submodule update --init
111111
```
112112

113-
```bash
114-
# Done with that PR, time for a new one?
115-
git switch main
116-
git pull origin
117-
git submodule update --init
118-
cd src/kani-compiler
119-
cargo build --workspace
120-
```
121-
122113
```bash
123114
# Need to update local branch (e.g. for an open pull request?)
124115
git fetch origin
@@ -134,16 +125,20 @@ git switch pr/$ID
134125
```
135126

136127
```bash
137-
# Search only git-tracked files
138-
git grep codegen_panic
128+
# Push to someone else's pull request
129+
git origin add $USER $GIR_URL_FOR_THAT_USER
130+
git push $USER $LOCAL_BRANCH:$THEIR_PR_BRANCH_NAME
139131
```
140132

141133
```bash
142-
# See all commits that are part of Kani, not part of Rust
143-
git log --graph --oneline origin/upstream-rustc..origin/main
134+
# Search only git-tracked files
135+
git grep codegen_panic
144136
```
145137

146138
```bash
147-
# See all files modified by Kani (compared to upstream Rust)
148-
git diff --stat origin/upstream-rustc..origin/main
139+
# Accidentally commit to main?
140+
# "Move" commit to a branch:
141+
git checkout -b my_branch
142+
# Fix main:
143+
git branch --force main origin/main
149144
```

kani-driver/src/call_cbmc_viewer.rs

+9
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,15 @@ impl KaniSession {
7070
// Let the user know
7171
if !self.args.quiet {
7272
println!("Report written to: {}/html/index.html", report_dir.to_string_lossy());
73+
// If using VS Code with Remote-SSH, suggest an option for remote viewing:
74+
if std::env::var("VSCODE_IPC_HOOK_CLI").is_ok()
75+
&& std::env::var("SSH_CONNECTION").is_ok()
76+
{
77+
println!(
78+
"VS Code automatically forwards ports for locally hosted servers. To view the report remotely,\nTry: python3 -m http.server --directory {}/html",
79+
report_dir.to_string_lossy()
80+
);
81+
}
7382
}
7483

7584
Ok(())

0 commit comments

Comments
 (0)