# Add User Settings to a VS Code Extension

Yes. An agent adds a contributes.configuration section to your VS Code extension, reads the settings with the workspace API, reacts to changes and opens a PR.

[Run this on Rush](https://cloud.getrush.ai/run/add-extension-settings/vscode-extension/). Opens the console with this prompt ready to send, in a Project that has your repository.

## What the agent does

The agent reads the extension and the configuration sample that ships beside it. In an extension like `helloworld-sample` in microsoft/vscode-extension-samples, `package.json` declares `engines.vscode` `^1.100.0`, one contributed command `extension.helloWorld` titled `Hello World`, an empty `activationEvents` list because VS Code infers activation from the command, `main` at `./out/extension.js`, and scripts `compile` (`tsc -p ./`), `watch` and `lint` (`eslint` 9 with `typescript-eslint`). `tsconfig.json` compiles to CommonJS with `strict` on, and `src/extension.ts` registers the command and calls `vscode.window.showInformationMessage('Hello World!')` with the greeting as a literal. The same repository's `configuration-sample` shows the target shape: a `contributes.configuration` array with an `id`, a `title`, an `order` and typed `properties`, each with a `type`, a `default`, a `description` and a `scope` of `window`, `resource` or `language-overridable`; an `enum` setting with a default; an `object` setting with `additionalProperties: false`; code that reads with `vscode.workspace.getConfiguration().get(...)`, writes with `.update(key, value, vscode.ConfigurationTarget.Global)` or `Workspace`, and listens with `onDidChangeConfiguration` and `e.affectsConfiguration(...)`.

From that the agent adds a `helloworld` configuration section to `helloworld-sample`'s manifest with a title for the Settings editor and a small set of properties the prompt names: `helloworld.greeting`, a string whose default is the current literal `Hello World!` so behaviour does not change for anyone who has not touched settings; `helloworld.showAsModal`, a boolean defaulting to `false` that switches the message to a modal dialog; and `helloworld.enabled`, a boolean that lets the command be turned off. Each has a `description` or a `markdownDescription` where a link helps, and the scope is `window`, because a greeting cannot sensibly vary per folder; the pull request explains when `resource` would be the right choice instead.

In `src/extension.ts` the literal becomes a read of `vscode.workspace.getConfiguration('helloworld')` with typed getters, `get<string>('greeting', 'Hello World!')`, taken at command time rather than cached, so a changed setting applies on the next invocation without a reload. The `showInformationMessage` call gains the `modal` option from the boolean. Following `configuration-sample`, a second command, `extension.configureGreeting`, asks with `showInputBox` and writes the value with `update` to the Global target, or offers User and Workspace through `showQuickPick` when a workspace is open. An `onDidChangeConfiguration` listener filtered with `affectsConfiguration('helloworld')` is pushed to `context.subscriptions`, as the existing command disposable already is, so it is disposed on deactivation.

The checks are the repository's own scripts: `npm run compile` and `npm run lint` pass with the stricter `typescript-eslint` rules the sample configures, including `curly` and the semicolon rule. The README gains a settings table with each key, type, default and meaning, matching how `configuration-sample`'s README documents its manual testing steps. A headless extension test needs the `@vscode/test-cli` setup that `helloworld-test-cli-sample` in the same repository shows, plus `xvfb-run` on Linux, so the agent adds one only when the prompt asks and says so otherwise.

## Start it with one API call

`POST https://api.phoenix.so/o/{org}/sessions`

```json
{
  "agent": "claude",
  "input": "Add user settings to this VS Code extension. Read package.json, src/extension.ts, tsconfig.json, eslint.config.mjs and the README first, and use the configuration-sample in this repository as the model. Add a contributes.configuration section with a title and three properties: a string greeting whose default is the message the extension shows today, a boolean that shows the message as a modal dialog, and a boolean that disables the command. Give each a type, default, description and window scope. Read the settings at command time with workspace.getConfiguration and typed getters, add a command that updates the greeting through showInputBox and update with a configuration target picker when a workspace is open, and register an onDidChangeConfiguration listener filtered with affectsConfiguration that is pushed to context.subscriptions. Run npm run compile and npm run lint, document the settings in a README table, and open a pull request. Do not add a test harness unless asked; say so in the pull request.",
  "resources": [
    {
      "url": "https://github.com/your-org/your-app"
    }
  ]
}
```

1. **Get an API key.** In the console, open Settings, then API keys, and create a key for your org. Send it in the Authorization header as a Bearer token.
2. **Send the request.** POST the body in request.json to https://api.phoenix.so/o/{org}/sessions, with your repository as the resources URL. The run starts in its own cloud sandbox.
3. **Read what came back.** Follow the run on its live stream or wait for the run.completed webhook, then read the result and its trajectory.

## What comes back

What comes back is a pull request on its own branch with `package.json` (the `contributes.configuration` section and the second command under `contributes.commands`), the edited `src/extension.ts`, and the README table. `tsconfig.json`, `eslint.config.mjs` and the lockfile are untouched, because nothing new is installed.

The description lists each setting with its key, type, default and scope and why that scope, shows the compile and lint output, and names the manual steps a reviewer follows in the Extension Development Host: change `helloworld.greeting` in Settings, run the command, see the new text. The commands are in the transcript at `GET /o/{org}/sessions/{id}/messages`.

Before merging, a reviewer presses F5 with the repository's existing `Run Extension` launch configuration, tries the settings in both User and Workspace scope, and decides whether the settings keys match the publisher's naming convention for other extensions. A follow-up message to the same session adds a fourth setting with the same pattern.

## Run it on every Linear issue labelled settings

A team that tracks extension requests in Linear starts one run per issue from an automation with a `linear` trigger on a `settings` label. The automation adds the issue after this prompt, so the setting a user asked for, with its name and default from the issue, is what the agent adds, and the run starts in the repository the automation names.

Each run opens its own pull request from its own sandbox, and an automation run has its own `max_runs_per_hour` cap. The pull request links the issue and lists the keys it added, so review is a read of the manifest section and the getter calls.

## Why run it on Rush?

Settings touch three places that have to agree: the manifest schema, the code that reads it and the documentation. A key spelled differently in any one of them fails quietly, and the only test is to launch VS Code. The agent uses the repository's own sample as the pattern, keeps the default equal to today's behaviour, and runs the compiler and the linter in its own sandbox so the type of each getter matches the schema before anyone opens the Extension Development Host.

The pull request carries that proof in the transcript: compile and lint output sit beside the commands that produced them, and the limit, no headless UI test unless asked, is stated. Several extensions can be handled at once, each in its own sandbox, with one pull request each.

## Frequently asked questions

### Will existing users see a change?

No. The greeting setting defaults to the exact string the extension shows today, the modal option defaults to off and the command stays enabled, so an installation with no settings behaves as before. Only someone who changes a value in Settings sees anything new.

### Why window scope and not resource?

A `resource` setting can differ per workspace folder and must be read with the document's URI, as `configuration-sample` does for its empty-last-line setting. A greeting has no per-folder meaning, so `window` is correct and simpler. The pull request explains the choice and when the other scope applies.

### Does the setting apply without reloading the window?

Yes. The command reads the configuration each time it runs instead of caching a value at activation, and the `onDidChangeConfiguration` listener is there for any future state that does need refreshing. No reload prompt is needed.

### Can the agent add a test for the settings?

It can, using the `@vscode/test-cli` setup the `helloworld-test-cli-sample` in the same repository shows, which downloads VS Code and runs Mocha inside it under `xvfb-run` on Linux. That is a separate piece of setup, so the agent does it only when the prompt asks and otherwise relies on compile, lint and the manual steps.

## More VS Code Extension jobs

- [Set Up GitHub Actions CI for a VS Code Extension](https://getrush.ai/run/add-github-actions-ci/vscode-extension/)
- [Localize a VS Code Extension](https://getrush.ai/run/add-i18n/vscode-extension/)
- [Add Keyboard Shortcuts to a VS Code Extension](https://getrush.ai/run/add-keybindings/vscode-extension/)

## More jobs like this: Turn a Linear label into a PR

- [Add Feature Flags to a .NET API](https://getrush.ai/run/add-feature-flags/dotnet/)
- [Add Feed Exports to a Scrapy Project](https://getrush.ai/run/add-feed-exports/scrapy/)
- [Add Open and Save File Dialogs to an Electron App from a Linear Issue](https://getrush.ai/run/add-file-dialogs/electron/)

## Keep reading

- [How a Rush run works on your repository, from request to pull request](https://getrush.ai/cloud/)
- [Compare cloud agents, agent sandboxes and AI code review](https://getrush.ai/compare/)
- [Rush pricing: Free, Pro and Max](https://getrush.ai/pricing/)
