Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.3 VSCode Extension, Session Management #3

Open
wants to merge 8 commits into
base: socket
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 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
20 changes: 20 additions & 0 deletions dist/extension.js

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

2 changes: 1 addition & 1 deletion dist/extension.js.map

Large diffs are not rendered by default.

Binary file removed hatchways-live-interviewing-0.0.1.vsix
Binary file not shown.
10 changes: 7 additions & 3 deletions out/compiled/Sidebar.css

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

4 changes: 2 additions & 2 deletions out/compiled/Sidebar.css.map

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

69 changes: 51 additions & 18 deletions out/compiled/Sidebar.js

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

2 changes: 1 addition & 1 deletion out/compiled/Sidebar.js.map

Large diffs are not rendered by default.

31 changes: 31 additions & 0 deletions src/SidebarProvider.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { stateManager } from "./context";
import { USER_READY } from "./utils/constants";
import { getNonce } from "./utils/getNonce";
import { exec } from "child_process";
import { Socket } from "socket.io-client";
import * as vscode from "vscode";

Expand Down Expand Up @@ -46,8 +47,38 @@ export class SidebarProvider implements vscode.WebviewViewProvider {
vscode.commands.executeCommand(
"workbench.files.action.showActiveFileInExplorer"
);

// Run code to automatically install files in a folder
const workspace = vscode.workspace.workspaceFolders?.[0];
const currentWorkspacePath = workspace.uri.fsPath;
if (!process.env.RUN_COMMAND){
cassandrale179 marked this conversation as resolved.
Show resolved Hide resolved
return;
}
exec(
process.env.RUN_COMMAND,
{ cwd: currentWorkspacePath },
(error, stdout, stderr) => {
if (error) {
vscode.window.showErrorMessage(
`Error running npm install: ${error.message}`
cassandrale179 marked this conversation as resolved.
Show resolved Hide resolved
);
return;
}
vscode.window.showInformationMessage(
`Run ${process.env.RUN_COMMAND} with output ${stdout}`
);
}
);
}
break;
}

case "endInterview": {
vscode.window.showInformationMessage(
"Successfully ended your interview. You can leave this session."
);
// TODO:
// this is the part where we have to commit their code to GitHub.
break;
}
case "onError": {
Expand Down
14 changes: 14 additions & 0 deletions webviews/components/Sidebar.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,15 @@
tsvscode.postMessage({ type: 'inputName', value: name });
tsvscode.setState({ userName: name})
}}>Submit</button>


<div class="subheader">
Once your interview is finished, press End Interview to commit your code.
cassandrale179 marked this conversation as resolved.
Show resolved Hide resolved
<button on:click={() => {
tsvscode.postMessage({ type: 'endInterview', value: ''});
tsvscode.setState({ endInterview: true })
}}>End Interview</button>
</div>
</div>
<style>

Expand All @@ -16,9 +25,14 @@ input {
}
button {
margin-top: 5px;
margin-bottom: 5px;
}
.body {
margin-top: 10px;
}

.subheader {
margin-top: 20px;
}

</style>