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

Add support for recognizing word locales in word operations (#50045) #203605

Merged
merged 7 commits into from
Mar 15, 2024

Conversation

yutotnh
Copy link
Contributor

@yutotnh yutotnh commented Jan 27, 2024

Corresponds to #50045 in Feature request.

This feature allows you to use Ctrl+Left or Ctrl+Right to navigate in languages that are not separated by spaces, such as Japanese or Chinese, with word separators.

If the user does not enter any settings, the system will continue to operate as before, so English speakers and others who do not need this feature will not be affected.

Since I am Japanese and often write Markdown and other Japanese text in VS Code, this feature was needed and desired by many people around me.

Example now: (use | as the cursor)

or if the setting is "editor.recognizeWordLocales": "" (default).

|これはサンプルの文字列です。
// Ctrl+Right
これはサンプルの文字です。|
|日本語とEnglishです。
// Ctrl+Right
日本語とEnglishです。|

Example of functionality enabled

The setting is "editor.recognizeWordLocales": "ja".

|これはサンプルの文字です。
// Ctrl+Right
これ|はサンプルの文字です。
// Ctrl+Right
これは|サンプルの文字です。
// Ctrl+Right
これはサンプル|の文字です。
// Ctrl+Right
これはサンプルの|文字です。
// Ctrl+Right
これはサンプルの|文字です。
// Ctrl+Right
これはサンプルの文字|です。
// Ctrl+Right
これはサンプルの文字です。|
|日本語とEnglishです。
// Ctrl+Right
日本語|とEnglishです。
// Ctrl+Right
日本語と|Englishです。
// Ctrl+Right
日本語とEnglish|です。
// Ctrl+Right
日本語とEnglishです。|

@fireattack
Copy link

fireattack commented Jan 27, 2024

In addition to word boundary inside Japanese/Chinese sentences, I think boundary between Japanese/Chinese character and Latin character should be considered as word boundary by default.

Like: 我喜欢在中文中夹杂English单词。 -- there should be a stop between 杂 and E, and between h and 单, when you navigate around, This is also the default behavior of almost every single text editor or any text input, even notepad.exe. VS Code is the only software I ever used that does not have this.

@rebornix rebornix assigned alexdima and unassigned rebornix Jan 29, 2024
@rebornix
Copy link
Member

@alexdima this is a very interesting improvement, assigning to you since you added the grapheme clusters support. let me know if you need anything from my side.

@alexdima alexdima added this to the March 2024 milestone Mar 15, 2024
@alexdima alexdima enabled auto-merge (squash) March 15, 2024 16:30
@alexdima
Copy link
Member

Thank you!

@alexdima alexdima merged commit 87d494b into microsoft:main Mar 15, 2024
6 checks passed
@yutotnh yutotnh deleted the recognize-words branch March 16, 2024 00:35
chen-ky pushed a commit to chen-ky/vscode that referenced this pull request Mar 18, 2024
…t#50045) (microsoft#203605)

* Add support for recognizing word locales in word operations (microsoft#50045)

* Move intlSegmenterLocales in the WordCharacterClassifier class

* Rerun compiler

* Renames

* Avoid duplicating code

---------

Co-authored-by: Alex Dima <alexdima@microsoft.com>
@microsoft microsoft locked and limited conversation to collaborators Jun 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants