TranslateCode/CLAUDE.md

45 lines
1.8 KiB
Markdown

# CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
## Project Overview
This is a VSCode extension plugin for translating between Chinese and English variable names. It translates selected Chinese text to English variable names and vice versa, with support for multiple naming conventions (camelCase, PascalCase, snake_case).
## Architecture
- **Core Extension**: `src/extension.ts` - Main VSCode extension entry point
- **Translation Service**: `src/translationService.ts` - Handles Google Translate and Baidu Translate API integrations
- **Naming Formatter**: `src/namingFormatter.ts` - Converts translated text to proper variable naming conventions
## Build Commands
- `npm run compile` - Compile TypeScript to JavaScript
- `npm run watch` - Watch mode for development
- `npm run vscode:prepublish` - Pre-publish compilation
## Development Setup
1. Install dependencies: `npm install`
2. Compile TypeScript: `npm run compile`
3. Press F5 in VSCode to launch Extension Development Host
4. Test commands: `Ctrl+Alt+E` (translate to English), `Ctrl+Alt+C` (translate to Chinese)
## Key Configuration Settings
- `translate.namingConvention`: Variable naming style (camelCase/PascalCase/snake_case)
- `translate.translationService`: Translation provider (google/baidu)
- `translate.baiduAppId`: Baidu API app ID
- `translate.baiduSecretKey`: Baidu API secret key
## Extension Commands
- `translate.toEnglish`: Translate selected Chinese text to English variable name
- `translate.toChinese`: Translate selected English text to Chinese
## File Structure
- `src/` - TypeScript source files
- `out/` - Compiled JavaScript output
- `docs/design.md` - Design documentation in Chinese
- `package.json` - Extension manifest with commands and configuration