Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there better way to handle double click selection? #4

Open
tyru opened this issue Aug 7, 2019 · 6 comments
Open

Is there better way to handle double click selection? #4

tyru opened this issue Aug 7, 2019 · 6 comments

Comments

@tyru
Copy link

tyru commented Aug 7, 2019

This is question issue.

I want to fix selection range when double click.
I tried to fix this using registerHoverProvider() + onDidChangeTextEditorSelection().
https://github.com/sgryjp/japanese-word-handler/compare/master...tyru:handle-double-click?expand=1

But that has the problem:
registerHoverProvider() handler is not called so frequently, it doesn't update mouse position when moving mouse quickly.

And question is:
I wonder if event has a mouse position, or any other better workaround for this 🤔
Do you know that?

Screenshot

Screencast 2019-08-07 13 46 02

@sgryjp
Copy link
Owner

sgryjp commented Aug 9, 2019

Well, my honest short answer is: No

But actually I have never seriously investigated a way to resolve mouse selection problem since the first release. 2.5 years have been passed since then... I will take a look too so wait for a moment please.

@tyru
Copy link
Author

tyru commented Aug 10, 2019

thanks!
I want this by default, however this plugin provides natural multibyte support.
thanks for creating 🙏

@sgryjp
Copy link
Owner

sgryjp commented Aug 12, 2019

@tyru I investigated current API set but no luck to find a way around. But I found a new issue on VSCode's repository which is directly related to this problem:
microsoft/vscode#50045 (comment)
In the discussion, an insider clearly states that they are working on it. So, I think we should wait and see 🙂

@tyru
Copy link
Author

tyru commented Aug 12, 2019

Thanks for investigating! very glad to hear that 🙌

@tyru tyru changed the title Is there bettery way to handle double click selection? Is there better way to handle double click selection? Aug 12, 2019
@sgryjp
Copy link
Owner

sgryjp commented Jul 28, 2024

As of VSCode v1.91.1 (#203605), it silently (?) supports editor.wordSegmenterLocales setting which utilizes Web browser's word segmentation feature. Try setting ja-JP as the value and you can select a Japanese word by double clicking.

Note that editor.wordSegmenterLocales uses Intl.Segmenter JavaScript API for word segmentation so it separates words different position from Japanese Word Handler. You may feel the incompatibility is annoying... in that case, I recommend you to stop using Japanese Word Handler and rely solely on editor.wordSegmenterLocales.

@keisuke-nakata
Copy link

"editor.wordSegmenterLocales": "ja-JP" seems to contain the feature offered by the solution: https://qiita.com/aosho235/items/0e1f0a525c8e3e7027d9#%E8%A7%A3%E6%B1%BA%E7%AD%96 .
(double-clicking an alphabetical text next to a Japanese text without space selects the alphabetical text only.)

As sgryjp said, editor.wordSegmenterLocales separates Japanese text differently from Japanese Word Handler, but it does not matter in my usage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants