# LexAI for VS Code / Cursor Part of the [LexAI monorepo](../../README.md) (`packages/vscode`). Twin of the [Chrome extension](../chrome/README.md) and [CLI Prompt Builder](../cli/README.md). **Bring your own LLM key.** LexAI helps you write and work with code in VS Code / Cursor — no LexAI account, no subscription, no LexAI servers. Select text or code → run an action or ask in **Code Assist** → **Accept** / **Regenerate** / **Discard** in the editor. --- ## Also available for Chrome Use the same LexAI writing assistant on any webpage: **[LexAI — AI Writing Assistant (Chrome Web Store)](https://chromewebstore.google.com/detail/bagpcheidbkfgijnnmolnkgagibbjfnk)** On the web: select text → Fix / Rephrase / Shorten / Expand / Explain / Make Prompt → Replace or Copy. Same BYO-key idea as this VS Code extension. --- ## All features (VS Code / Cursor) ### Code Assist (workspace-aware) - Select code → **Code Assist** → type what you want in an **inline prompt** above the selection (Copilot-style zone), then **Ask LexAI**. - Examples: explain, refactor, add error handling, rewrite for clarity, review a function. - LexAI gathers **workspace context**: selected code, surrounding lines, import/require targets, and symbol definitions from **other files** (via the language server). - Result opens in the suggestion zone with Accept / Regenerate / Discard. - Available from CodeLens, editor context menu, Command Palette, and the Activity Bar sidebar. ### Writing actions | Action | What it does | | --- | --- | | **Fix Grammar** | Correct spelling, grammar, and punctuation | | **Rephrase** | Make text clearer / more professional | | **Shorten** | Cut fluff while keeping the message | | **Expand** | Add detail, context, and supporting points | | **Explain** | Break down complex text into plain language | | **Make Prompt** | Turn a rough idea into a structured AI prompt | ### Prompt Builder (Make Prompt) - Structural **patterns** (auto, zero-shot, role, few-shot, and more) - **Persona** presets, including custom persona text - Preferred **output format** - Optional **model override** for Make Prompt only - Adjust in Settings, or via **inline option chips** in the suggestion zone (click a chip to regenerate) ### Writing styles Apply to Fix / Rephrase / Shorten / Expand / Explain: **Default · Formal · Casual · Academic · Creative · Concise** Change in Settings or via option chips in the suggestion zone. ### Where you can start an action - **CodeLens** — select ≥10 characters; click **LexAI** on the first selected line to expand actions in place (Code Assist + writing actions) - **Editor context menu** — right-click selection → **LexAI** submenu - **Gutter / line-number context** — LexAI submenu when a selection is active - **Command Palette** — `LexAI: Fix Grammar`, Rephrase, Shorten, Expand, Explain, Make Prompt, Code Assist, Show Actions, … - **Activity Bar sidebar** — LexAI icon → Workspace panel: paste or type text, pick an action (including Code Assist), run, **Copy** or reuse as input; **Insert selection** pulls from the editor - **Status bar** — **✓ LexAI** ready · **⟳ LexAI** processing · **⚠ LexAI** not ready (click opens Settings) ### Suggestion UI - **In-editor zone** (default) — comment widget above the selection with Accept / Regenerate / Discard and option chips - **Side panel** — optional suggestion panel - Setting `lexai.suggestionUi`: `zone` | `panel` | `both` - `lexai.previewBeforeReplace` — preview before replacing the selection (default on) - `lexai.askOptionsBeforeGenerate` — optional Quick Picks for style / Prompt Builder before each run ### Settings & account-free setup - **LexAI: Open Settings** — branded settings UI for provider, model, writing style, Prompt Builder, and API key - **LexAI: Set API Key** / **Clear API Key** - **LexAI: Show Configuration Status** - Providers: **OpenAI · Anthropic · Groq · OpenRouter** - API key stored in **VS Code Secret Storage** (not plain settings) - Non-secret prefs use `lexai.*` settings --- ## Quick start 1. Install from the [VS Code Marketplace](https://marketplace.visualstudio.com/items?itemName=JuanKibin.lexai-vscode), or **Install from VSIX**. 2. Command Palette → **LexAI: Open Settings** → provider, model, API key. 3. Select text or code → click **LexAI** on the line → pick an action or **Code Assist**. 4. Review in the suggestion zone → Accept to replace the selection (or Copy from the sidebar / panel). Install / publish details: [DEPLOY.md](./DEPLOY.md). --- ## Privacy - No LexAI backend and no LexAI telemetry. - API key lives in the editor’s Secret Storage. - Your text is sent only to the LLM provider you configure. --- ## Links | | | | --- | --- | | **This extension** | [VS Code Marketplace](https://marketplace.visualstudio.com/items?itemName=JuanKibin.lexai-vscode) (`JuanKibin.lexai-vscode`) | | **Chrome extension** | [Chrome Web Store](https://chromewebstore.google.com/detail/bagpcheidbkfgijnnmolnkgagibbjfnk) | | **Source** | [LexAI repository](https://git.juankibin.space/kibin/LexAI) | | **Publisher** | JuanKibin |