Closed teto closed 5 years ago
how does the engine work ? I've tried to call the mapping on a visual range but it returns No range allowed
. Would be nice to support it :)
Thank you for testing this plugin! I have run into that problem before. But I tested it just now and found it was gone. Could you upgrade coc/coc-translator to the lastest version and test again?
As a coc's extension, its keymap was defined here https://github.com/voldikss/coc-translator/blob/e3c667d3150cefc3b6017ced91671003dbf958b0/src/index.ts#L19-L33
The engine classes was wrote in the translator.ts file. But currently I can't figure out how to define a visual keymap and make it workable. So I added it into the TODO
I was already using the latest coc-translator. I've bumped coc-nvim runtime (still using 0.72 for th binary though) but still gets the error :s
Hmmm, sorry I still can not reproduce this issue. It's weird somehow
no pb this kind of issue tends to go away with time, after several package updates; I will wait :)
btw I work with several different languages so I would like to specify the target/origin language when mapping. I feel like it's impossible right now ?
btw I work with several different languages so I would like to specify the target/origin language when mapping.
Hi @teto If you want to create various keymaps according to the languages, you can use vim-translate-me, which is developed using VimL. I just refine its command and make it easy to pass target language
argument.
e.g.
nmap <silent> <Leader>tf :TranslateW -e bing google -l fr<CR>
nmap <silent> <Leader>tj :TranslateW -e bing google -l ja<CR>
haha I used to use that one but I liked the idea of displaying the translation in floating windows, hence I switched to this one (as I already used the excellent coc)
That plugin also display the translation in floating windows(for nvim) or popup(for vim81). Moreover, viml is easier to handle some stuff such as keymap.
Yes, coc is super sexy.
got the same issue when
nmap <Leader>t <Plug>(coc-translator-p)
got below issue when
nmap <Leader>e <Plug>(coc-translator-e)
[coc.nvim] error: error on notification 'doKeymap': TypeError: Cannot read property 'query' of undefined
@perfectspr Could you give me the text under the cursor(so that I can reproduce that issue)?
still present (just ran on 店
)
CocInfo
## versions
vim version: NVIM v0.4.0-dev
node version: v10.16.0
coc.nvim version: 0.0.73-56825890dc
term: xterm-termite
platform: linux
## Messages
"content/nixos_testing_infra.md" 55L, 1613C
"content/restauration.md" 38L, 1166C
1 modification ; avant #1 ; il y a 1 seconde
"content/restauration.md" 38 lines --28%--
[coc.nvim] error: error on notification 'doKeymap': TypeError: Cannot read property 'index' of null
## Output channel: snippets
@teto I just located the bug and fixed it. I wasn't aware that you use Japanese before....
thanks ! it works. One strange thing is that google seems to return a character that can't be displayed ? This is the content of the floating window when trying to translate the kanji 店
@ 店内 @
--------- google ---------
🌀 À l'intérieur du magasin
the block/square on the last line is:
'🌀' U+1F300 Dec:127744 CYCLONE 🌀 /\%U1f300 "\U1f300"
. Shouldn't it display the same kanji ? or is that a network error ?
I will check it for you
so github displays correctly the cyclon
codepoint (but in my terminal, it was the glyph for unknown glyph). Anyway strange to use a cyclon instead of 店内.
Sorry I didn't figure out what the real problem is. Do you mean cyclon
isn't displayed correctly or the translation text À l'intérieur du magasin
is invalid? Could you take a screenshot for that?
The translation is correct, I just find it weird that my term is asked to display 'cyclon' instead of the kanji it was asked to translate:
Hmmm I am not aware that emoji may not be displayed correctly in some terminal. :neckbeard:
I tried to call coc-translator via the mapping
nmap <Leader>te <Plug>(coc-translator-p)
on some japanese text but it gives me:My coc config is :