Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>LLM Comment TranslatorNew to Visual Studio Code? Get it now.
LLM Comment Translator

LLM Comment Translator

duanduan

|
2 installs
| (0) | Free
Translate source-code comments with an OpenAI-compatible LLM while preserving comment markers and line breaks.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

LLM Comment Translator

Translate source-code comments with any OpenAI-compatible LLM, directly in VS Code.

Hover over a comment to view its translation, then replace the original when you are ready. The extension preserves comment markers and line layout so your code style remains intact.

Source repository: github.com/MIN202299/comment-translator

Features

  • Translate comments on Hover
  • Replace one translated comment without changing its comment syntax
  • Translate all comments in the active file, with an optional bulk replacement step
  • Preserve //, /* ... */, and # comment markers
  • Preserve comment line count and line breaks
  • Group consecutive // or # comment lines until source code appears between them
  • Support OpenAI-compatible Chat Completions providers, including DashScope-compatible endpoints
  • Configure the target language, timeout, model, and thinking mode

Configure an LLM provider

Open Settings (JSON) and add your provider configuration. The endpoint can be either a base URL or the full Chat Completions URL. When /chat/completions is omitted, the extension adds it automatically.

DashScope example

{
  "llmCommentTranslator.endpoint": "https://dashscope.aliyuncs.com/compatible-mode/v1",
  "llmCommentTranslator.apiKey": "ALI_AK",
  "llmCommentTranslator.model": "qwen3.6-flash",
  "llmCommentTranslator.targetLanguage": "简体中文",
  "llmCommentTranslator.enableThinking": false
}

OpenAI-compatible example

{
  "llmCommentTranslator.endpoint": "https://api.openai.com/v1",
  "llmCommentTranslator.apiKey": "OPENAI_API_KEY",
  "llmCommentTranslator.model": "gpt-4o-mini",
  "llmCommentTranslator.targetLanguage": "English"
}

enableThinking is disabled by default. Enable it only when your selected model and provider support the enable_thinking request parameter.

Use the extension

  1. Open a JavaScript, TypeScript, Python, or other supported source file.
  2. Hover over a comment. VS Code waits for your editor.hover.delay setting (about 300 ms by default), then the extension requests a translation.
  3. Review the translation in the Hover popup. Select Replace Original Comment to write it back.
  4. To translate every comment in the current file, run LLM Comments: Translate All Comments from the Command Palette. When processing finishes, choose whether to replace all comments.

Translated results are cached only for the current extension session. Restarting VS Code, reloading the window, or disabling the extension clears the cache.

Settings

Setting Default Description
llmCommentTranslator.endpoint https://api.openai.com/v1 OpenAI-compatible base URL or full endpoint
llmCommentTranslator.apiKey — API key, optionally from VARIABLE
llmCommentTranslator.model gpt-4o-mini Model sent to the provider
llmCommentTranslator.targetLanguage 简体中文 Translation target language
llmCommentTranslator.enableThinking false Send enable_thinking when supported by the provider
llmCommentTranslator.timeoutMs 30000 Request timeout in milliseconds
llmCommentTranslator.systemPrompt You translate source-code comments accurately... Additional translation instruction

Privacy and costs

The extension itself is free. Your configured LLM provider may charge for API calls.

Comment text is sent to the endpoint you configure. Do not use an endpoint that is not approved for the source code you are translating, and do not commit API keys to your repository.

Troubleshooting

  • 404 error: For DashScope, use https://dashscope.aliyuncs.com/compatible-mode/v1 or the full /chat/completions URL.
  • API key not found: Ensure the environment variable is available to the VS Code extension host. On macOS, fully quit VS Code and start it from a terminal where the variable has been exported.
  • 401/403 error: Check the API key, model name, provider region, and account permissions.
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft