Recently, I had to reinstall windows 11 on my machine. So, after that, I had to install VSCode again (therefore, I have the most recent version of VSCode).
Now, whenever I select any Persian sentences (strings) in my code, the IDE shows a messed-up string that is far away from the correct one. I can not show the correct and incorrect sentences as texts here because copying and pasting results in the correct format. Therefore, I have to provide them as images. (Sorry for any inconvenience, in advance)
Correct Persian Sentence
Incorrect Persian Sentence (After selecting)
This might be a little bit tricky to understand for people who are not familiar with the Persian Language. The difference can be understood by looking at the first word after $creatorId
in both images.
This also might happen if we wanted to write in Arabic or other right-to-left languages.
It would be highly appreciated if you could suggest anything to avoid this.
CodePudding user response:
After searching a lot, I found the proper answer on one of the VScode repository's issues. The problem was with the way the new version of VSCode renders the whitespace. So, to solve this problem you need to follow the below steps:
- Open VSCode command pallete by CTRL SHIFT p
- Search for Open Settings (JSON) and click on it. It should open a JSON file named setting.
- In this JSON file, add a key named editor.renderWhitespace and assign on of the following values to it: boundary, trailing or none. Your json file should look something like this:
{
"editor.renderWhitespace":"boundary"
}
The problem is gone now.
Note
You can access and change the editor.renderWhitespace using the settings editor too. So, if you find the above-mentioned steps frustrating, just use the settings editor (you can open it using the setting icon at the right end of the VSCode window or even using CTRL ,) and search for editor.renderWhitespace. Then chose on of the three above-mentioned options.