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
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,30 @@ View your app in AI Studio: https://ai.studio/apps/drive/12_bAVgqXJhSXFdrGuAlohv
2. Set the `GEMINI_API_KEY` in [.env.local](.env.local) to your Gemini API key
3. Run the app:
`npm run dev`

## Run as a VS Code Extension Locally

To test the extension locally:

1. **Install Dependencies:**
- Run `npm install` in the root directory.
- Run `npm install` in the `vscode-extension` directory.

2. **Build the React App:**
- Run `npm run build` from the root directory. This will build the webview and place it in `vscode-extension/webview-dist`.

3. **Compile the Extension:**
- In the `vscode-extension` directory, run `npm run compile`.

4. **Package the Extension:**
- In the `vscode-extension` directory, run `npm install -g vsce`.
- Run `vsce package`. This will create a `.vsix` file.

5. **Install the Extension:**
- In VS Code, go to the Extensions view.
- Click the "..." menu and select "Install from VSIX...".
- Select the `.vsix` file you just created.

6. **Run the Extension:**
- Open the Command Palette (`Cmd+Shift+P` or `Ctrl+Shift+P`).
- Run the "Annotate Image from Clipboard" command.
37 changes: 37 additions & 0 deletions TESTING_SUMMARY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Summary of VS Code Extension Testing Issues

This document summarizes the issues encountered while trying to set up and run tests for the Antigravity Annotator VS Code extension.

## Initial Setup

I started by following the official VS Code documentation for testing extensions. This involved:

1. Installing `mocha`, `@types/mocha`, `@vscode/test-electron`, `typescript`, `glob`, and `@types/glob`.
2. Creating a `test` script in `package.json`.
3. Creating a `src/test/runTest.ts` file to run the tests.
4. Creating a `src/test/suite/index.ts` file to configure Mocha and discover tests using `glob`.
5. Creating a `src/test/suite/extension.test.ts` file with a simple test case.
6. Creating a `.vscode/launch.json` file to run the tests from the VS Code UI.

## Compilation Errors

I immediately ran into a series of compilation errors related to the `mocha` and `glob` imports. The TypeScript compiler was unable to resolve the modules correctly. I tried the following solutions, none of which worked:

* **Different import syntaxes:** I tried `import * as ...`, `import ... from ...`, `import = require(...)`, and `import ... = require(...)`.
* **`tsconfig.json` modifications:** I tried changing the `module`, `target`, and `moduleResolution` options to various combinations, including `commonjs`, `es6`, `esnext`, `nodenext`, `node`, `umd`, `system`, and `amd`. I also tried enabling `esModuleInterop` and `skipLibCheck`.
* **Reinstalling dependencies:** I deleted the `node_modules` directory and the `package-lock.json` file and reinstalled all the dependencies.
* **Resetting the project:** I used `reset_all` to revert all the changes and start from scratch, strictly following the official documentation.

## Test Runner Errors

After finally getting the code to compile, I ran into a different set of errors related to the test runner itself. The `@vscode/test-electron` package downloads a full instance of VS Code to run the tests, and this was creating a large number of files that were not being ignored by `.gitignore`. This caused the tests to fail with a "too many files" error.

I tried the following solutions, none of which worked:

* **`.vscodeignore`:** I created a `.vscodeignore` file to exclude the `.vscode-test` directory.
* **`--files`, `--spec`, and `--reporter` options:** I tried using these options in the `test` script to limit the scope of the test runner.
* **Temporary directories:** I tried using different temporary directories for the VS Code instance, including `/tmp`, `/var/tmp`, and `~`.

## Current Status

I am still unable to run the tests successfully. The compilation errors have been resolved, but the test runner is still creating too many files. I have exhausted all the solutions I can think of, and I am currently blocked on this issue.
5 changes: 5 additions & 0 deletions vscode-extension/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
out
dist
node_modules
.vscode-test
.vscode-test-run
17 changes: 17 additions & 0 deletions vscode-extension/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Extension Tests",
"type": "extensionHost",
"request": "launch",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}",
"--extensionTestsPath=${workspaceFolder}/dist/test/suite"
],
"outFiles": [
"${workspaceFolder}/dist/test/**/*.js"
]
}
]
}
1 change: 1 addition & 0 deletions vscode-extension/.vscodeignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.vscode-test/
Loading