intellism / vscode-comment-translate Goto Github PK
View Code? Open in Web Editor NEWvscode 注释翻译插件, 不干扰正常代码,方便快速阅读源码。
Home Page: https://marketplace.visualstudio.com/items?itemName=intellsmi.comment-translate
License: MIT License
vscode 注释翻译插件, 不干扰正常代码,方便快速阅读源码。
Home Page: https://marketplace.visualstudio.com/items?itemName=intellsmi.comment-translate
License: MIT License
一般情况下,如果用户仅仅是将一种特定的语言翻译成另一种,而不会用到互转功能的话,那么状态栏的图标就显得多余了,所以建议增加一个设置选项,来让用户选择是否要保留状态栏的功能图标我想这是很棒的。
如果是状态栏非要保留的话,那就缩短一下状态栏的占用空间,毕竟一个状态栏的空间是有限的,如果用户存在多个用到状态栏的扩展,那么状态栏就会出现拥挤,造成的后果就是用户可能出现找不到某个扩展的状态栏图标,如果缩短状态栏的占用,比如只显示一个图标或者比如将"Chinese Simplified" 缩短成"zh-CN"也是一个不错的选择呢
问题如下
[Error - 下午12:21:20] Request textDocument/hover failed.
Message: Request textDocument/hover failed with message: The module '\\?\e:\js_workspace\vscode-translate\server\node_modules\oniguruma\build\Release\onig_scanner.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 64. This version of Node.js requires
NODE_MODULE_VERSION 73. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).
经了解后,知道vscode的环境是electron,不是node。
我尝试过使用electron-rebuild,
使用/node_modules/.bin/electron-rebuild -v 0.37.6
失败
这个东西 怎么用啊 为什么我装上了没有效果。是需要什么配置吗
你好, 我现在在学习你的项目, 并且尝试自己做一个插件,自己使用,
但是我现在在extension.js 中 使用 axios
或者 request
发送一个网络请求,都会被重定义到
127.0.0.1:8080
node 10.15.3
vsCode 1.36.1
macOS 10.14.5
extension.js
In this file, I make a network request:
axios.get(`https://www.google.com`)
.then((rep) => {
vscode.window.showInformationMessage('something');
});
and get a follow error:
in fact , no matter what URL i visit, it will all point to 127.0.0.1:8080
[Error - 下午1:43:10] Request textDocument/hover failed.
Message: Request textDocument/hover failed with message: Cannot read property 'map' of undefined
Code: -32603
Could you implement a Portuguese translation?
README_JA.md
There are untranslated lines.
Line 24: 设置选项
→ 設定オプション
谢谢开发者Thanks♪(・ω・)ノ
c:\Users\Administrator.vscode\extensions\intellsmi.comment-translate-1.0.0\server\out\util\request-promise.js:9
resolve(response.body);
^
TypeError: Cannot read property 'body' of undefined
at Request.request [as _callback] (c:\Users\Administrator.vscode\extensions\intellsmi.comment-translate-1.0.0\server\out\util\request-promise.js:9:30)
at self.callback (c:\Users\Administrator.vscode\extensions\intellsmi.comment-translate-1.0.0\server\node_modules\request\request.js:185:22)
at Request.emit (events.js:182:13)
at Timeout._onTimeout (c:\Users\Administrator.vscode\extensions\intellsmi.comment-translate-1.0.0\server\node_modules\request\request.js:852:16)
at ontimeout (timers.js:427:11)
at tryOnTimeout (timers.js:289:5)
at listOnTimeout (timers.js:252:5)
at Timer.processTimers (timers.js:212:10)
[Info - 上午12:24:29] Connection to server got closed. Server will restart.
[Error - 上午12:24:29] Request textDocument/hover failed.
Error: Connection got disposed.
at Object.dispose (c:\Users\Administrator.vscode\extensions\intellsmi.comment-translate-1.0.0\client\node_modules\vscode-jsonrpc\lib\main.js:825:25)
at Object.dispose (c:\Users\Administrator.vscode\extensions\intellsmi.comment-translate-1.0.0\client\node_modules\vscode-languageclient\lib\client.js:57:35)
at LanguageClient.handleConnectionClosed (c:\Users\Administrator.vscode\extensions\intellsmi.comment-translate-1.0.0\client\node_modules\vscode-languageclient\lib\client.js:1983:42)
at LanguageClient.handleConnectionClosed (c:\Users\Administrator.vscode\extensions\intellsmi.comment-translate-1.0.0\client\node_modules\vscode-languageclient\lib\main.js:126:15)
at closeHandler (c:\Users\Administrator.vscode\extensions\intellsmi.comment-translate-1.0.0\client\node_modules\vscode-languageclient\lib\client.js:1970:18)
at CallbackList.invoke (c:\Users\Administrator.vscode\extensions\intellsmi.comment-translate-1.0.0\client\node_modules\vscode-jsonrpc\lib\events.js:71:39)
at Emitter.fire (c:\Users\Administrator.vscode\extensions\intellsmi.comment-translate-1.0.0\client\node_modules\vscode-jsonrpc\lib\events.js:135:36)
at closeHandler (c:\Users\Administrator.vscode\extensions\intellsmi.comment-translate-1.0.0\client\node_modules\vscode-jsonrpc\lib\main.js:221:26)
at CallbackList.invoke (c:\Users\Administrator.vscode\extensions\intellsmi.comment-translate-1.0.0\client\node_modules\vscode-jsonrpc\lib\events.js:71:39)
at Emitter.fire (c:\Users\Administrator.vscode\extensions\intellsmi.comment-translate-1.0.0\client\node_modules\vscode-jsonrpc\lib\events.js:135:36)
at IPCMessageReader.AbstractMessageReader.fireClose (c:\Users\Administrator.vscode\extensions\intellsmi.comment-translate-1.0.0\client\node_modules\vscode-jsonrpc\lib\messageReader.js:135:27)
at ChildProcess. (c:\Users\Administrator.vscode\extensions\intellsmi.comment-translate-1.0.0\client\node_modules\vscode-jsonrpc\lib\messageReader.js:253:61)
at ChildProcess.emit (events.js:187:15)
at maybeClose (internal/child_process.js:961:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:248:5)
[Error - 上午12:24:29] Request textDocument/hover failed.
Error: Connection got disposed.
at Object.dispose (c:\Users\Administrator.vscode\extensions\intellsmi.comment-translate-1.0.0\client\node_modules\vscode-jsonrpc\lib\main.js:825:25)
at Object.dispose (c:\Users\Administrator.vscode\extensions\intellsmi.comment-translate-1.0.0\client\node_modules\vscode-languageclient\lib\client.js:57:35)
at LanguageClient.handleConnectionClosed (c:\Users\Administrator.vscode\extensions\intellsmi.comment-translate-1.0.0\client\node_modules\vscode-languageclient\lib\client.js:1983:42)
at LanguageClient.handleConnectionClosed (c:\Users\Administrator.vscode\extensions\intellsmi.comment-translate-1.0.0\client\node_modules\vscode-languageclient\lib\main.js:126:15)
at closeHandler (c:\Users\Administrator.vscode\extensions\intellsmi.comment-translate-1.0.0\client\node_modules\vscode-languageclient\lib\client.js:1970:18)
at CallbackList.invoke (c:\Users\Administrator.vscode\extensions\intellsmi.comment-translate-1.0.0\client\node_modules\vscode-jsonrpc\lib\events.js:71:39)
at Emitter.fire (c:\Users\Administrator.vscode\extensions\intellsmi.comment-translate-1.0.0\client\node_modules\vscode-jsonrpc\lib\events.js:135:36)
at closeHandler (c:\Users\Administrator.vscode\extensions\intellsmi.comment-translate-1.0.0\client\node_modules\vscode-jsonrpc\lib\main.js:221:26)
at CallbackList.invoke (c:\Users\Administrator.vscode\extensions\intellsmi.comment-translate-1.0.0\client\node_modules\vscode-jsonrpc\lib\events.js:71:39)
at Emitter.fire (c:\Users\Administrator.vscode\extensions\intellsmi.comment-translate-1.0.0\client\node_modules\vscode-jsonrpc\lib\events.js:135:36)
at IPCMessageReader.AbstractMessageReader.fireClose (c:\Users\Administrator.vscode\extensions\intellsmi.comment-translate-1.0.0\client\node_modules\vscode-jsonrpc\lib\messageReader.js:135:27)
at ChildProcess. (c:\Users\Administrator.vscode\extensions\intellsmi.comment-translate-1.0.0\client\node_modules\vscode-jsonrpc\lib\messageReader.js:253:61)
at ChildProcess.emit (events.js:187:15)
at maybeClose (internal/child_process.js:961:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:248:5)
[Error - 上午12:24:29] Request textDocument/hover failed.
Error: Connection got disposed.
at Object.dispose (c:\Users\Administrator.vscode\extensions\intellsmi.comment-translate-1.0.0\client\node_modules\vscode-jsonrpc\lib\main.js:825:25)
at Object.dispose (c:\Users\Administrator.vscode\extensions\intellsmi.comment-translate-1.0.0\client\node_modules\vscode-languageclient\lib\client.js:57:35)
at LanguageClient.handleConnectionClosed (c:\Users\Administrator.vscode\extensions\intellsmi.comment-translate-1.0.0\client\node_modules\vscode-languageclient\lib\client.js:1983:42)
at LanguageClient.handleConnectionClosed (c:\Users\Administrator.vscode\extensions\intellsmi.comment-translate-1.0.0\client\node_modules\vscode-languageclient\lib\main.js:126:15)
at closeHandler (c:\Users\Administrator.vscode\extensions\intellsmi.comment-translate-1.0.0\client\node_modules\vscode-languageclient\lib\client.js:1970:18)
at CallbackList.invoke (c:\Users\Administrator.vscode\extensions\intellsmi.comment-translate-1.0.0\client\node_modules\vscode-jsonrpc\lib\events.js:71:39)
at Emitter.fire (c:\Users\Administrator.vscode\extensions\intellsmi.comment-translate-1.0.0\client\node_modules\vscode-jsonrpc\lib\events.js:135:36)
at closeHandler (c:\Users\Administrator.vscode\extensions\intellsmi.comment-translate-1.0.0\client\node_modules\vscode-jsonrpc\lib\main.js:221:26)
at CallbackList.invoke (c:\Users\Administrator.vscode\extensions\intellsmi.comment-translate-1.0.0\client\node_modules\vscode-jsonrpc\lib\events.js:71:39)
at Emitter.fire (c:\Users\Administrator.vscode\extensions\intellsmi.comment-translate-1.0.0\client\node_modules\vscode-jsonrpc\lib\events.js:135:36)
at IPCMessageReader.AbstractMessageReader.fireClose (c:\Users\Administrator.vscode\extensions\intellsmi.comment-translate-1.0.0\client\node_modules\vscode-jsonrpc\lib\messageReader.js:135:27)
at ChildProcess. (c:\Users\Administrator.vscode\extensions\intellsmi.comment-translate-1.0.0\client\node_modules\vscode-jsonrpc\lib\messageReader.js:253:61)
at ChildProcess.emit (events.js:187:15)
at maybeClose (internal/child_process.js:961:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:248:5)
Overwriting grammar scope name to file mapping for scope source.json.
Old grammar file: c:\Users\Administrator\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\json\syntaxes\JSON.tmLanguage.json.
New grammar file: C:\Users\Administrator.vscode\extensions\htwx.json-and-jsonc-1.0.1\syntaxes\JSON.tmLanguage.json
c:\Users\Administrator.vscode\extensions\intellsmi.comment-translate-1.0.0\server\out\util\request-promise.js:9
resolve(response.body);
^
TypeError: Cannot read property 'body' of undefined
at Request.request [as _callback] (c:\Users\Administrator.vscode\extensions\intellsmi.comment-translate-1.0.0\server\out\util\request-promise.js:9:30)
at self.callback (c:\Users\Administrator.vscode\extensions\intellsmi.comment-translate-1.0.0\server\node_modules\request\request.js:185:22)
at Request.emit (events.js:182:13)
at Timeout._onTimeout (c:\Users\Administrator.vscode\extensions\intellsmi.comment-translate-1.0.0\server\node_modules\request\request.js:852:16)
at ontimeout (timers.js:427:11)
at tryOnTimeout (timers.js:289:5)
at listOnTimeout (timers.js:252:5)
at Timer.processTimers (timers.js:212:10)
[Info - 上午12:25:53] Connection to server got closed. Server will restart.
[Error - 上午12:25:53] Request textDocument/hover failed.
Error: Connection got disposed.
at Object.dispose (c:\Users\Administrator.vscode\extensions\intellsmi.comment-translate-1.0.0\client\node_modules\vscode-jsonrpc\lib\main.js:825:25)
at Object.dispose (c:\Users\Administrator.vscode\extensions\intellsmi.comment-translate-1.0.0\client\node_modules\vscode-languageclient\lib\client.js:57:35)
at LanguageClient.handleConnectionClosed (c:\Users\Administrator.vscode\extensions\intellsmi.comment-translate-1.0.0\client\node_modules\vscode-languageclient\lib\client.js:1983:42)
at LanguageClient.handleConnectionClosed (c:\Users\Administrator.vscode\extensions\intellsmi.comment-translate-1.0.0\client\node_modules\vscode-languageclient\lib\main.js:126:15)
at closeHandler (c:\Users\Administrator.vscode\extensions\intellsmi.comment-translate-1.0.0\client\node_modules\vscode-languageclient\lib\client.js:1970:18)
at CallbackList.invoke (c:\Users\Administrator.vscode\extensions\intellsmi.comment-translate-1.0.0\client\node_modules\vscode-jsonrpc\lib\events.js:71:39)
at Emitter.fire (c:\Users\Administrator.vscode\extensions\intellsmi.comment-translate-1.0.0\client\node_modules\vscode-jsonrpc\lib\events.js:135:36)
at closeHandler (c:\Users\Administrator.vscode\extensions\intellsmi.comment-translate-1.0.0\client\node_modules\vscode-jsonrpc\lib\main.js:221:26)
at CallbackList.invoke (c:\Users\Administrator.vscode\extensions\intellsmi.comment-translate-1.0.0\client\node_modules\vscode-jsonrpc\lib\events.js:71:39)
at Emitter.fire (c:\Users\Administrator.vscode\extensions\intellsmi.comment-translate-1.0.0\client\node_modules\vscode-jsonrpc\lib\events.js:135:36)
at IPCMessageReader.AbstractMessageReader.fireClose (c:\Users\Administrator.vscode\extensions\intellsmi.comment-translate-1.0.0\client\node_modules\vscode-jsonrpc\lib\messageReader.js:135:27)
at ChildProcess. (c:\Users\Administrator.vscode\extensions\intellsmi.comment-translate-1.0.0\client\node_modules\vscode-jsonrpc\lib\messageReader.js:253:61)
at ChildProcess.emit (events.js:187:15)
at maybeClose (internal/child_process.js:961:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:248:5)
Overwriting grammar scope name to file mapping for scope source.json.
Old grammar file: c:\Users\Administrator\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\json\syntaxes\JSON.tmLanguage.json.
New grammar file: C:\Users\Administrator.vscode\extensions\htwx.json-and-jsonc-1.0.1\syntaxes\JSON.tmLanguage.json
另外有单独的//
能否作为每块注释的分隔符。像go的官方源码中,有大量这样的注释出现:
图中代码示例:https://github.com/golang/go/blob/master/src/context/context.go
想把地址换成translate.google.com而不是translate.google.cn,设置里没有这个配置,我应该怎么做到呢?重新编译整个插件?
is there a way to translate the content inside other that source file but part of the project/workspace?
当VSCODE工作在远程模式下时,C代码不能翻译
Hello, when I hover over some comment block in the PHP language it doesn't seem to work and it shows me Request textDocument/hover failed.
In other languages like JS, CSS and HTML if it works correctly, the problem is specifically with the PHP language.
My extension configuration is:
"commentTranslate.targetLanguage": "es",
"commentTranslate.multiLineMerge": true,
"commentTranslate.concise": false,
如图,有的不显示,有的是好着的。
VSCode 版本:
Version: 1.44.2
Commit: ff915844119ce9485abfe8aa9076ec76b5300ddd
Date: 2020-04-16T17:50:03.709Z
Electron: 7.1.11
Chrome: 78.0.3904.130
Node.js: 12.8.1
V8: 7.8.279.23-electron.0
OS: Linux x64 5.3.0-28-generic
Ubuntu 18.04
代码内容(Python):
### Training
self.results_path = os.path.join(os.path.dirname(__file__), "../results", os.path.basename(__file__)[:-3], datetime.datetime.now().strftime("%Y-%m-%d--%H-%M-%S")) # Path to store the model weights and TensorBoard logs
self.training_steps = 50000 # Total number of training steps (ie weights update according to a batch)
self.batch_size = 512 # Number of parts of games to train on at each training step
self.checkpoint_interval = 10 # Number of training steps before using the model for sef-playing
self.value_loss_weight = 0.25 # Scale the value loss to avoid overfitting of the value function, paper recommends 0.25 (See paper appendix Reanalyze)
self.training_device = "cuda" if torch.cuda.is_available() else "cpu" # Train on GPU if available
鼠标放在注释上,不支持预览了,我知道出现了什么问题
IP address: 205.204.117.29
Time: 2018-10-26T08:32:12Z
URL: https://translate.google.com/translate_a/single?client=gtx&dt=t&dj=1&ie=UTF-8&sl=auto&tl=zh-CN&q=%2F%2F%20Does%20the%20client%20support%20the%20%60workspace%2Fconfiguration%60%20request%3F%0A%2F%2F%20If%20not%2C%20we%20will%20fall%20back%20using%20global%20settings
版本: 1.41.0-insider
提交: 27cd33d891eb23e370b672e751be9fe8b3748ac1
日期: 2019-11-08T19:11:22.061Z
Electron: 6.1.4
Chrome: 76.0.3809.146
Node.js: 12.4.0
V8: 7.6.303.31-electron.0
OS: Darwin x64 19.0.0
[Error - 9:26:13 AM] Request textDocument/hover failed.
Message: Request textDocument/hover failed with message: Cannot find module 'oniguruma'
Require stack:
新装的vscode和插件,mac上和win10上的稳定版和开发板 都报这个错,不知道算是vs问题还是插件问题
You can implement a setting that, when enabled, will translate if the Ctrl key is pressed
Hey, can you add polish language support :D?
也許這是Google API和限制的問題。
如何放置自定義api或實現繞過?
1.简洁模式下怎么启动翻译,没有找到快捷键设置或者方法介绍
2.翻译Makefile文件时,不能自动预览,也找不到主动翻译的方式。
3.如何切换翻译API?(望作者指教)
[Error - 4:30:35 PM] Request textDocument/hover failed.
Message: Request textDocument/hover failed with message: Cannot destructure property commentLines
of 'undefined' or 'null'.
Code: -32603
非常棒的扩展,非常感谢。
合并多行注释对python的 # 和“”“的多行注释似乎不支持。
国外发展了很多有价值的c++类库,这些类库大多都有非常丰富的学习文档,而且是和代码本身紧密相连的。对于国内的学习者而言,不乏有些吃力。希望在开源方面,也能出一份力。
比如最近在翻译一个有限元的类库,代码中不乏会嵌入很多注释,这块手动翻译非常棘手,我想到办法用正则提取翻译,https://github.com/jiaqiwang969/deal.II-translator。无意间发现你用vscode的一个实现,更是深受启发!
我想在您代码的基础上实现二次开发,目前您的功能可以选中然后翻译替代。
但是,还没办法满足批量精确翻译的能力,需要增加两个功能:
这是我目前的初次尝试遇到的问题:
尝试clone你的代码进行调试F5,但是一直出错,查阅后仍没办法解决(只好搁置了),光一开始的调试过程就进行不下去了。
F5调试错误:
Activating extension 'intellsmi.comment-translate' failed: Cannot find module '/Users/wjq_1/Downloads/vscode-comment-translate/client/out/extension' Require stack: - /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/loader.js - /Applications/Visual Studio Code.app/Contents/Resources/app/out/bootstrap-amd.js - /Applications/Visual Studio Code.app/Contents/Resources/app/out/bootstrap-fork.js.
在VS Code Insiders
下,在WSL环境下使用本插件遇到该问题。
操作系统是Win 10
。
当我使用了 Remote Development 这个插件后, 在其上这个插件就无法运行了, 只有一些文本文件可以运行,例如 proto 文件, go文件没有翻译
现在经常出现不可用的情况,希望能加入有道和百度翻译的切换功能。
[Google Translate]: request error
"Too Many Requests"
Try again in 5 minutes.
在第64到66行的GoogleTranslate.ts文件中,Google Chrome中收到的URI为https://translate.google.cn/#view%3Dhome%26op%3Dtranslate%26sl%3Dauto%26tl%3Dzh-CN%26text %3Dworkbench
它应该是https://translate.google.com/#view=home&op=translate&sl=auto&tl=en&text=workbench
“text = workbench”的值不会自动转换。
我为自己的写作道歉,并使用谷歌翻译将其翻译成中文。
谢谢你这么好的项目。
希望作者把这个插件移植到JetBrains平台上
我也不知道怎么复现
一报这个错,输出面板就弹出来,一直弹弹弹
[Error - 11:49:24 AM] Request textDocument/hover failed.
Message: Request textDocument/hover failed with message: Cannot destructure property `commentLines` of 'undefined' or 'null'.
Code: -32603
[Error - 11:50:42 AM] Request textDocument/hover failed.
Message: Request textDocument/hover failed with message: Cannot destructure property `commentLines` of 'undefined' or 'null'.
Code: -32603
[Error - 11:50:45 AM] Request textDocument/hover failed.
Message: Request textDocument/hover failed with message: Cannot destructure property `commentLines` of 'undefined' or 'null'.
Code: -32603
[Error - 11:50:49 AM] Request textDocument/hover failed.
Message: Request textDocument/hover failed with message: Cannot destructure property `commentLines` of 'undefined' or 'null'.
Code: -32603
[Error - 11:51:16 AM] Request textDocument/hover failed.
Message: Request textDocument/hover failed with message: Cannot destructure property `commentLines` of 'undefined' or 'null'.
Code: -32603
在想变量名、函数名时很有用。
至于怎么交互,我的想法是:
Ctrl + Shift + P
-> 选择交互式的翻译
-> 输入要翻译的内容 -> 返回结果
望采纳。
当前token翻译方法实现,需要重找方法。
如题 望修复
In order to maintain the size of the mouse hover panel, the translation of the css file should be excluded here.
互译功能:
现在只能选择目标语言 翻译再替换翻译,有时候希望可以实现互译, 例如中<->英
Idea support plz!
希望可以把翻译功能改为双语言互译
Output console Extension:
[Google Translate]: request error
"Too Many Requests"
Try again in 5 minutes.
is there any way to implement the external google api?
建议默认语言设置为zh-CN,方便开箱即用
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.