Skip to content

Commit d1cd577

Browse files
committed
[skip ci] test
1 parent 3011ca3 commit d1cd577

File tree

6 files changed

+147
-21
lines changed

6 files changed

+147
-21
lines changed

README.md

Lines changed: 47 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,58 @@
1-
# VS Code
1+
# Source Academy & VS Code
22

3-
Experimental project for running Source Academy within Visual Studio Code.
3+
<p align="center">
4+
<img src="./assets/icon.png" width="150">
5+
</p>
46

5-
## How to use
7+
A Visual Studio Code extension for integration with [Source Academy](https://about.sourceacademy.org), an online experiential environment for computational thinking.
68

7-
TODO: Add instructions
9+
It is available in the VS Code [Extension Marketplace](https://marketplace.visualstudio.com/items?itemName=source-academy.source-academy).
810

9-
## Notes to developers
11+
## Features
1012

11-
### Running the extension in dev mode
13+
- View, edit, and submit assessments
14+
- Syntax highlighting for Source
15+
- Integration with our [language server for Source](https://github.com/source-academy/source-lsp), which provides smart features such as:
16+
- Error checking
17+
- Code completion
18+
- Hover documentation
1219

13-
1. Setup the project
14-
```
15-
yarn
16-
```
17-
1. Compile
18-
```
19-
yarn compile
20-
```
21-
1. Run the extension in debug mode by opening the root folder a VSCode window, then "Start Debugging" (or press F5).
20+
## Installing
2221

23-
### Publishing the extension
22+
If you don't have VS Code installed yet, download it from [here](https://code.visualstudio.com/docs/setup/setup-overview) first.
2423

25-
For a new release, update the version in `package.json` and tag the commit. Push the commit and the tag to the repo,
26-
which will trigger GitHub Actions to build and publish the extension to Releases tab and the Marketplace.
24+
From within VS Code,
25+
26+
1. Click on the Extensions icon on the left sidebar or the `View: Show Extensions` command (`Ctrl+Shift+X`).
27+
2. Search for "Source Academy" and install it.
28+
29+
We'd recommend also installing the [Error Lens](https://marketplace.visualstudio.com/items?itemName=usernamehw.errorlens) extension
30+
to show diagnostic messages more prominently.
31+
32+
## Getting started
33+
34+
_If you don't have an existing Source Academy account, you can try out our public frontend. See section [Changing the frontend](#changing-the-frontend)._
35+
36+
After installing the extension,
37+
38+
1. Click on the newly-added Source Academy icon on the left sidebar.
39+
2. Launch the Source Academy panel.
40+
41+
<img src="./starting.png" width="600">
42+
43+
Alternatively, use the `Source Academy: Show the Source Academy Panel` command.
44+
45+
Once the panel loads, you'll be prompted to log in. Afterwards, begin coding by opening any assessment.
46+
47+
### Changing the frontend
48+
49+
To use a different Source Academy frontend, modify the Frontend Base URL setting:
50+
51+
1. Press `Ctrl + ,` to open VS Code's settings page, then search for `frontendBaseUrl`.
52+
2. Enter a valid URL.
53+
54+
Example value (public frontend):
2755

2856
```
29-
npm version (major|minor|patch)
30-
git push origin main --tags
57+
https://sourceacademy.org
3158
```

docs/README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
## Notes to developers
2+
3+
### Running the extension in dev mode
4+
5+
1. Setup the project
6+
```
7+
yarn
8+
```
9+
1. Compile
10+
```
11+
yarn compile
12+
```
13+
1. Run the extension in debug mode by opening the root folder a VSCode window, then "Start Debugging" (or press F5).
14+
15+
### Publishing the extension
16+
17+
For a new release, update the version in `package.json` and tag the commit. Push the commit and the tag to the repo,
18+
which will trigger GitHub Actions to build and publish the extension to Releases tab and the Marketplace.
19+
20+
```
21+
npm version (major|minor|patch)
22+
git push origin main --tags
23+
```

docs/developer-guide.md

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Developer Guide
2+
3+
We place developer-facing stuff here because the README.md in the root will be displayed on VS Code Marketplace.
4+
5+
## Setting up project locally
6+
1. Clone this repo
7+
2. Assume yarn installed. Assume node installed.
8+
9+
For Nix users, step 2
10+
- If you have nix-direnv installed, no need anything
11+
- Else, enter with nix develop
12+
13+
## Running the extension (in?)
14+
1. Setup the project
15+
```
16+
yarn
17+
```
18+
1. Compile
19+
```sh
20+
yarn compile
21+
```
22+
1. Run the extension in debug mode by opening the root folder in VS Code, then "Start Debugging" (or press F5). Under the hood, this is will compile the extension by running `yarn compile`.
23+
24+
Alternatively, install a compiled version of the extension.
25+
26+
```sh
27+
yarn compile
28+
code --profile "Default" --install-extension source-academy-*.vsix --force
29+
```
30+
31+
## Publishing the extension
32+
33+
For a new release, update the version in `package.json` and tag the commit. Push the commit and the tag to the repo,
34+
which will trigger GitHub Actions to build and publish the extension to Releases tab and the Marketplace.
35+
36+
```sh
37+
npm version (major|minor|patch)
38+
git push origin main --tags
39+
```
40+
41+
What else?
42+
- Key points from my FYP report, including architecture
43+
- For extension: tip to console.log, using debugger
44+
- Instructions for local frontend (tip: how to log), and for LSP (tip: how to log)
45+
- ensure vscode version
46+
```
47+
"engines": {
48+
"vscode": "^1.93.0"
49+
},
50+
```
51+
52+
it is my beleif that we should have good dev experience
53+
54+
note to developers: if following vscode debug setup doesn't work, this is a documentation bug. if you are sure you followed the steps correctl,y please raise an issue
55+
56+
it is my beleif that we should have good dev experience
57+
58+
iamge to readme, user facing
59+
60+
About debuggin in vscode is supported for VS Code, but not neovim.
61+
62+
add exrc for neovim
63+
64+
sugested extensions: both to user and to developer
65+
66+
## Archi
67+
Delegation to frontend
68+
js-slang in frontend
69+
Extension context and Webview context
70+
Drawing from STEPS

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@
55
"license": "Apache-2.0",
66
"displayName": "Source Academy",
77
"description": "VS Code extension for Source Academy",
8-
"repository": "https://github.com/source-academy/vscode",
8+
"repository": {
9+
"type": "git",
10+
"url": "https://github.com/source-academy/vscode"
11+
},
912
"categories": [
1013
"Programming Languages",
1114
"Education"

src/extension.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ export function activate(context: vscode.ExtensionContext) {
2727
// };
2828
const info = context.globalState.get("info") ?? {};
2929

30+
context.globalState.update("assessmentOverviews", undefined)
31+
context.globalState.update("courseId", undefined)
32+
3033
client.sendRequest("source/publishInfo", info);
3134

3235
SOURCE_ACADEMY_ICON_URI = vscode.Uri.joinPath(

starting.png

99.5 KB
Loading

0 commit comments

Comments
 (0)