9

I want to comment in visual studio in Persian (which is a right to left language) like this:

//.برای نگهداری مقدار اولیه ی کالا می باشد value_ متغیر 

But it seems the code editor does not support RTL languages and reorders the words so the result is:

 //متغیر _value برای نگهداری مقدار اولیه ی کالا می باشد.

That does not read as I expected!

Anybody have a solution for this problem?

Laurel
  • 5,522
  • 11
  • 26
  • 49
Hosein Masoomi
  • 107
  • 1
  • 9

4 Answers4

13

As Ahmad mentioned Microsoft does not support Right-to-left in its Visual Studio IDE (unfortunately), to copy and paste the comment form a RTL-supported editor also does not work (I test it with Notepad)

For this purpose, I have developed an extension for visual studio 2013 (VirtualRTLtext), it rearranges the words of a line of comment so that it will looks correct in Visual Studio code editor.

Rearranging words works well for usual comments but in case of XML comment it has some problems:

  1. When you want to make XML documentation from your comments
  2. When you want your comments in intellisense

For the first, i could find a partial solution but for the second, this algorithm does not work (because length of lines in intellisense and code editor is not equal).

To download it in Visual Studio go to TOOLS/extension and updates... and search VirtualRTLtext

Or get the vsix form Here.

After installation you could find it in VIEW/Other Windows

enter image description here

Ahmad
  • 6,124
  • 6
  • 49
  • 90
  • Hey Mohammad Fatemipour, could we have your source code ? I have vs2012 and I can't install it. I have Microsoft Visual Studio Ultimate 2012. I got this error : VSIXInstaller.NoApplicableSKUsException: This extension is not installable on any currently installed products. at VSIXInstaller.App.InitializeInstall() at System.Threading.Tasks.Task.InnerInvoke() at System.Threading.Tasks.Task.Execute() – Eqbal Sohrabi Aug 24 '16 at 10:48
2

I recently wrote an extension for vscode that allows you to leave comments from right to left. You can use the result that returns, in Visual Studio or any other program. "RTL Comment Support" do it for you.

1

According this support page from Microsfot website the right to left is not supported in Visual Studio IDE

Customers can use any Unicode character in any part of the product. So certainly Right-To-Left characters are allowed. However, the Visual Studio interface is still Left-To-Right therefore the RTL display may re-arrange the characters in an unwanted manner.

As a hack you can write your comment in another editor that supports RTL, then copy and paste it into the VS Editor.

Ahmad
  • 6,124
  • 6
  • 49
  • 90
1

You can simply put an RLE (RIGHT-TO-LEFT EMBEDDING, U+202B) character before your paragraph. This control character is also supported in browsers and most text editors.

Without RLE:

 // متغیر _value برای نگهداری مقدار اولیه ی کالا می باشد.

With RLE:

 //‫ متغیر _value برای نگهداری مقدار اولیه ی کالا می باشد.

I use this template for my RTL comments (you must press END button, not going between quotation marks):

// '‫'