Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
32 changes: 21 additions & 11 deletions .github/workflows/lint_and_test.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,38 @@
name: Lint and Test
name: Run VSCode Extension Tests

on:
push:
branches:
- master
branches: [main]
pull_request:
branches:
- master
branches: [main]

jobs:
test:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [22.x]
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
- name: Setup Node.js environment
uses: actions/setup-node@v4
with:
node-version: "20"
node-version: ${{ matrix.node-version }}
cache: "npm"

- name: Install dependencies
run: npm ci
# Runs both the test and lint commands
- name: Run tests

- name: Compile
run: npm run compile

- name: Run tests (Linux)
run: xvfb-run -a npm test
if: runner.os == 'Linux'

- name: Run tests (Windows/Mac)
run: npm test
if: runner.os != 'Linux'
2 changes: 1 addition & 1 deletion .vscode-test.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { defineConfig } from '@vscode/test-cli';

export default defineConfig({
files: 'out/test/**/*.test.js',
files: 'out/test/**/*.test.js',
});
12 changes: 6 additions & 6 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
// See http://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": [
"dbaeumer.vscode-eslint",
"ms-vscode.extension-test-runner"
]
// See http://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": [
"dbaeumer.vscode-eslint",
"ms-vscode.extension-test-runner"
]
}
26 changes: 11 additions & 15 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,15 @@
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
{
"version": "0.2.0",
"configurations": [
{
"name": "Run Extension",
"type": "extensionHost",
"request": "launch",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}"
],
"outFiles": [
"${workspaceFolder}/out/**/*.js"
],
"preLaunchTask": "${defaultBuildTask}"
}
]
"version": "0.2.0",
"configurations": [
{
"name": "Run Extension",
"type": "extensionHost",
"request": "launch",
"args": ["--extensionDevelopmentPath=${workspaceFolder}"],
"outFiles": ["${workspaceFolder}/out/**/*.js"],
"preLaunchTask": "${defaultBuildTask}"
}
]
}
16 changes: 8 additions & 8 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// Place your settings in this file to overwrite default and user settings.
{
"files.exclude": {
"out": false // set this to true to hide the "out" folder with the compiled JS files
},
"search.exclude": {
"out": true // set this to false to include "out" folder in search results
},
// Turn off tsc task auto detection since we have the necessary tasks as npm scripts
"typescript.tsc.autoDetect": "off"
"files.exclude": {
"out": false // set this to true to hide the "out" folder with the compiled JS files
},
"search.exclude": {
"out": true // set this to false to include "out" folder in search results
},
// Turn off tsc task auto detection since we have the necessary tasks as npm scripts
"typescript.tsc.autoDetect": "off"
}
32 changes: 16 additions & 16 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
{
"version": "2.0.0",
"tasks": [
{
"type": "npm",
"script": "watch",
"problemMatcher": "$tsc-watch",
"isBackground": true,
"presentation": {
"reveal": "never"
},
"group": {
"kind": "build",
"isDefault": true
}
}
]
"version": "2.0.0",
"tasks": [
{
"type": "npm",
"script": "watch",
"problemMatcher": "$tsc-watch",
"isBackground": true,
"presentation": {
"reveal": "never"
},
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how

## [Unreleased]

- Initial release
- Initial release
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,25 @@
# Submitty Extension for VS Code

## Overview

The Submitty Extension for VS Code integrates the Submitty grading system directly into Visual Studio Code, allowing users to easily submit assignments, view grades, and interact with their courses without leaving the editor.

## Features

- **Assignment Submission**: Submit assignments directly from VS Code.
- **Grade Retrieval**: View grades and feedback within the editor.
- **Course Management**: Access course information and assignment details.
- **Error & Feedback Display**: Get inline feedback on submissions.

## Setup

1. Open the **Submitty Extension**.
2. Enter your **Submitty server URL**.
3. Authenticate using your **username and password**.
4. Select your **course** from the available list.

## Usage

- **Submit an Assignment**:
1. Open the relevant assignment file.
2. Click on the HW you want graded.
Expand All @@ -24,9 +28,11 @@ The Submitty Extension for VS Code integrates the Submitty grading system direct
- Open the Submitty panel to view assignment grades and instructor feedback.

## Requirements

- A valid Submitty account.

## Roadmap

- [ ] Allow users to access homeowrk
- [ ] Figure out a way to grade homework and display results back to users
- [ ] Display test results with feedback
Expand Down
21 changes: 14 additions & 7 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,15 @@ export default defineConfig([
// --- 1. Global Ignores ---
// Files and directories to ignore across the entire project
{
ignores: ['out/**', 'dist/**', '**/*.d.ts', 'node_modules/**', '.vscode-test/**', '.vscode-test.mjs', 'eslint.config.mjs'],
ignores: [
'out/**',
'dist/**',
'**/*.d.ts',
'node_modules/**',
'.vscode-test/**',
'.vscode-test.mjs',
'eslint.config.mjs',
],
},

// --- 2. Base Configurations (Applied to ALL files by default) ---
Expand All @@ -31,7 +39,7 @@ export default defineConfig([
parserOptions: {
projectService: true,
},
}
},
},

// --- 3. Configuration for VS Code Extension (Node.js/TypeScript) ---
Expand Down Expand Up @@ -66,10 +74,10 @@ export default defineConfig([
format: ['camelCase', 'PascalCase'],
},
],
'curly': 'warn', // Require curly braces for all control statements
'eqeqeq': 'warn', // Require the use of '===' and '!=='
curly: 'warn', // Require curly braces for all control statements
eqeqeq: 'warn', // Require the use of '===' and '!=='
'no-throw-literal': 'warn', // Disallow throwing literals as exceptions
'semi': 'off', // Let Prettier handle semicolons (or enforce no semicolons)
semi: 'off', // Let Prettier handle semicolons (or enforce no semicolons)
'@typescript-eslint/no-floating-promises': 'error', // Good for async operations
'@typescript-eslint/explicit-function-return-type': [
'warn',
Expand All @@ -90,5 +98,4 @@ export default defineConfig([
'@typescript-eslint/no-explicit-any': 'off', // Or 'warn' depending on your preference
},
},

]);
]);
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,4 @@
"axios": "^1.7.8",
"keytar": "^7.9.0"
}
}
}
61 changes: 54 additions & 7 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,63 @@
import { SidebarProvider } from './sidebarProvider';
import { ApiService } from './services/apiService';
import { TestingService } from './services/testingService';
import { GitService } from './services/gitService';
import { AuthService } from './services/authService';
import { CourseRepoResolver } from './services/courseRepoResolver';
import type { Gradable } from './interfaces/Gradables';

Check warning on line 8 in src/extension.ts

View workflow job for this annotation

GitHub Actions / test (22.x, macos-latest)

'Gradable' is defined but never used. Allowed unused vars must match /^_/u

Check warning on line 8 in src/extension.ts

View workflow job for this annotation

GitHub Actions / test (22.x, windows-latest)

'Gradable' is defined but never used. Allowed unused vars must match /^_/u

Check warning on line 8 in src/extension.ts

View workflow job for this annotation

GitHub Actions / test (22.x, ubuntu-latest)

'Gradable' is defined but never used. Allowed unused vars must match /^_/u

export function activate(context: vscode.ExtensionContext): void {
const apiService = ApiService.getInstance(context, '');
const testingService = new TestingService(context, apiService);
const sidebarProvider = new SidebarProvider(context, testingService);
const apiService = ApiService.getInstance(context, '');
const testingService = new TestingService(context, apiService);
const gitService = new GitService();
const authService = AuthService.getInstance(context);
const sidebarProvider = new SidebarProvider(
context,
testingService,
gitService
);

context.subscriptions.push(
vscode.window.registerWebviewViewProvider('submittyWebview', sidebarProvider)
);
context.subscriptions.push(
vscode.window.registerWebviewViewProvider(
'submittyWebview',
sidebarProvider
)
);

// Preload gradables into the Test Explorer when the workspace appears
// to be a course-tied repo.
void (async () => {
try {
await authService.initialize();
const resolver = new CourseRepoResolver(
apiService,
authService,
gitService
);
const courseContext = await resolver.resolveCourseContextFromRepo();
if (!courseContext) {
return;
}

const gradablesResponse = await apiService.fetchGradables(
courseContext.courseId,
courseContext.term
);
const gradables = Object.values(gradablesResponse.data);

for (const g of gradables) {
testingService.addGradeable(
courseContext.term,
courseContext.courseId,
g.id,
g.title || g.id
);
}
} catch (e) {
const err = e instanceof Error ? e.message : String(e);
console.warn(`Failed to preload gradables: ${err}`);
}
})();
}

export function deactivate() { }
export function deactivate() {}

Check warning on line 64 in src/extension.ts

View workflow job for this annotation

GitHub Actions / test (22.x, macos-latest)

Missing return type on function

Check warning on line 64 in src/extension.ts

View workflow job for this annotation

GitHub Actions / test (22.x, windows-latest)

Missing return type on function

Check warning on line 64 in src/extension.ts

View workflow job for this annotation

GitHub Actions / test (22.x, ubuntu-latest)

Missing return type on function
Loading
Loading