feat: add LexAI status bar and suggestion panel
Some checks failed
CI — Test & Build / Test & Build (push) Has been cancelled

- Implemented a status bar item for LexAI with dynamic status updates (ready, processing, notReady).
- Created a suggestion panel for displaying and interacting with AI-generated suggestions.
- Added functionality for accepting, regenerating, and discarding suggestions within the suggestion zone.
- Introduced configuration options for writing style, prompt patterns, personas, and formats.
- Integrated progress indicators for long-running tasks and improved user feedback.
- Established TypeScript configuration for the vscode package.
This commit is contained in:
john kevin asprec
2026-08-13 18:06:45 +08:00
parent fc19ead0a7
commit 8bc529ef2d
84 changed files with 10025 additions and 662 deletions

102
packages/vscode/README.md Normal file
View File

@@ -0,0 +1,102 @@
# LexAI — AI Writing & Code Assist
**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 this extension (Marketplace, Open VSX, 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 editors Secret Storage.
- Your text is sent only to the LLM provider you configure.
---
## Links
| | |
| --- | --- |
| **Chrome extension** | [Chrome Web Store](https://chromewebstore.google.com/detail/bagpcheidbkfgijnnmolnkgagibbjfnk) |
| **Source** | [LexAI repository](https://git.juankibin.space/kibin/LexAI) |
| **Publisher** | JuanKibin |