Skip to content

Commit 46b9ad9

Browse files
committed
Merge branch 'main' into mcq-ui
2 parents 1c85379 + 93d9e4a commit 46b9ad9

File tree

10 files changed

+3602
-2269
lines changed

10 files changed

+3602
-2269
lines changed

.github/workflows/check.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
node-version: 20
1515
cache: yarn
1616
- name: Install dependencies
17-
run: yarn install --frozen-lockfile
17+
run: yarn install --immutable
1818
- name: Lint
1919
# TODO: Add proper linting command
2020
run: yarn format
@@ -31,6 +31,6 @@ jobs:
3131
node-version: 20
3232
cache: yarn
3333
- name: Install dependencies
34-
run: yarn install --frozen-lockfile
34+
run: yarn install --immutable
3535
- name: Test
3636
run: yarn test

.github/workflows/publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
node-version: 20
4242
cache: yarn
4343
- name: Install dependencies
44-
run: yarn install --frozen-lockfile
44+
run: yarn install --immutable
4545

4646
- name: Package
4747
run: yarn run package

.gitignore

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,27 @@
11
# Flakes
22
.direnv/
33

4-
# Node dependencies
5-
node_modules/
4+
# Yarn Berry
5+
.pnp.*
6+
.yarn/*
7+
!.yarn/patches
8+
!.yarn/plugins
9+
!.yarn/releases
10+
!.yarn/sdks
11+
!.yarn/versions
12+
13+
# Intermediate files
14+
syntaxes/source.tmLanguage.json
615

716
# Build artifacts
817
out/
918
*.vsix
10-
syntaxes/source.tmLanguage.json
1119

1220
# Logs
1321
yarn-error.log
1422

1523
# Misc
1624
.DS_Store
25+
26+
# No longer needed
27+
node_modules/

.yarnrc.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
nodeLinker: node-modules

flake.lock

Lines changed: 38 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 21 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,25 @@
11
{
2-
description = "Template for a direnv shell, with NodeJS";
2+
description = "nix-direnv shell for developing Source Academy's VS Code extension";
33

4-
inputs = {
5-
nixpkgs.url = "github:NixOS/nixpkgs/23.11";
6-
};
4+
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
5+
inputs.flake-utils.url = "github:numtide/flake-utils";
76

8-
outputs = { self, nixpkgs }:
9-
let
10-
system = "x86_64-linux";
11-
pkgs = import nixpkgs { inherit system; config.allowUnfree = true; };
12-
in
13-
{
14-
devShells.${system}.default = pkgs.mkShell {
15-
packages = with pkgs; [
16-
nodejs_20
17-
(yarn.override {
18-
nodejs = nodejs_20;
19-
})
20-
21-
# The following is only needed by js-slang, to remove in the future
22-
# Additional libs needed by yarn when installing
23-
pkg-config
24-
xorg.libX11
25-
xorg.libXi
26-
libGL
27-
28-
python310
29-
xorg.libXext
30-
31-
gcc11
32-
];
33-
};
34-
};
7+
outputs = {
8+
nixpkgs,
9+
flake-utils,
10+
...
11+
}:
12+
flake-utils.lib.eachDefaultSystem (
13+
system: let
14+
pkgs = nixpkgs.legacyPackages.${system};
15+
in {
16+
devShells.default = pkgs.mkShell {
17+
packages = with pkgs; [
18+
# For dev ease of use, follow NodeJS version in source-academy/frontend
19+
nodejs_20
20+
(yarn-berry.override {nodejs = nodejs_20;})
21+
];
22+
};
23+
}
24+
);
3525
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@
8585
"download-lsp": "node scripts/lsp.js",
8686
"format": "yarn prettier . --write",
8787
"vscode:prepublish": "yarn run download-lsp && yarn run build",
88-
"package": "vsce package",
88+
"package": "vsce package --no-dependencies",
8989
"test:syntax": "yarn run build:syntax && vscode-tmgrammar-test ./tests/syntaxes/*",
9090
"test": "yarn test:syntax"
9191
},

src/utils/messageHandler.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,7 @@ export class MessageHandler {
8585

8686
break;
8787
}
88-
case MessageTypeNames.MCQAnswer:
89-
console.log(`Received MCQ answer: ${message.choice}`);
90-
sendToFrontend(this.panel, message);
91-
break;
88+
9289
case MessageTypeNames.NewEditor:
9390
this.activeEditor = await Editor.create(
9491
message.workspaceLocation,

src/webview/components/McqPanel.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React, { useState } from "react";
22
import Messages, { sendToWebview } from "../../utils/messages";
3+
import { sendToFrontendWrapped } from "../../commands/showPanel";
34

45
export interface McqData {
56
assessmentName: string;
@@ -31,7 +32,7 @@ const McqPanel: React.FC<McqPanelProps> = ({ data, onAnswer }) => {
3132
checked={selected === idx}
3233
onChange={() => {
3334
setSelected(idx);
34-
onAnswer(idx);
35+
const wsLoc = data.workspaceLocation ?? "assessment";
3536
}}
3637
style={{ marginRight: "0.5rem" }}
3738
/>

0 commit comments

Comments
 (0)