Steps to reproduce:
Put this on gedit:
賲鬲賳
賲鬲賳
賲鬲賳
text
text
text
text

Now try the same with VSCode

Expected:
Easily achievable by adding dir=auto to div element and remove dir=ltr from the span, I just did it for the first line

Alternatively, you can put a switch (toggle-able with command switch, something like > Toggle Direction) and apply document direction switch to whole document and detect whether a document needs RTL direction behind the scene, if you don't like per paragraph direction setting.
(Experimental duplicate detection)
Thanks for submitting this issue. Please also check if it is already covered by an existing one, like:
@vscodebot not related
Thanks for assigning this :)
What I am requesting is entering this code,
$$('.mtk1[dir=ltr]').forEach(x => { x.removeAttribute('dir'); x.parentElement.parentElement.setAttribute('dir', 'auto'); })
Which turns

Into this,

The hard part however is to fix the issues afterward like incorrect assumption of text place,

So maybe you should do the direction detection in JavaScript so you will be in control of it and know what is its value.
So maybe you should do the direction detection in JavaScript so you will be in control of it and know what is its value.
You can also use dir=auto but detect the assigned direction using getComputedStyle I guess, better however be in control of direction detection algorithm I guess however as it is done somewhere else on the code already AFAIK.
Thank you for working on this! I would like my department at work (we correct translated HTML and work with Arabic and Hebrew) to start using VS Code but I know that the ability to view these RTL languages right-aligned will be a crucial requirement. We currently use Notepad++ which allows you to manually flip the entire file to be viewed as right-aligned but I like the implementation you are discussing which would only right-align lines that are in the RTL language. However, we edit English JSON files that have Arabic/Hebrew strings, so the beginning of the line is English but we would still need to view it RTL, so we would probably need a full-document right-align ability for it to be effective.
Please let me know if you need help implementing this, I'm not quite sure where to start but am willing to assist.
What's the status of this? I am also looking for this solution, and it looks like many people are looking for it as well.
I strongly support this request. Connected to this issue, also consider how punctuation behaves in this matter. Right now, VS Code will place a period at the end of a sentence to the very right of the Arabic text, like:
卮賷亍 賲賰鬲賵亘 賮賷 丕賱賱睾丞 丕賱毓乇亘賷丞. [WRONG]
Visibly different from:
.卮賷亍 賲賰鬲賵亘 賮賷 丕賱賱睾丞 丕賱毓乇亘賷丞 [CORRECT]
This can also mess up brackets, making them face the wrong way:
)佗伲( [WRONG]
Instead of:
(佗伲) [CORRECT]
馃憤 Please fix RTL layout! 馃檹
I am having the mentioned issue with brackets...

Thanks for the report. Let's not confuse the issues which is the case with #11770, you report should be fixed with #78867 which filed separately to avoid confusion. Thanks
@ebraminio I think the brackets problem arises because the paragraph direction is always set to LTR, as I've described here. Fixing the paragraph direction should fix the brackets issue.
Even the fact paragraph direction solves the issue for some of the cases but it doesn't always solve the issue where paragraph or document direction is not the same as the text, like the two above comments, bidi bracket is a separate matter http://www.unicode.org/notes/tn39/ which deserves to get fixed separately, like your analysis, let's don't mix that to this where is possible to keep them separate, mixing them makes just harder to vscode devs to know what is needed to get fixed.
@ebraminio Agreed.
Which comments are you referring to? This comment is independent of paragraph direction, but AFAICT this comment happens because of paragraph direction -- AFAICT a period within an Arabic text run should render on the left, instead of on the right. @lwcvl Can you confirm this?
Most helpful comment
What's the status of this? I am also looking for this solution, and it looks like many people are looking for it as well.