Enable xelatex in Latex Workshops for Visual Studio Code

I have a template, which defines all the typesetting recommendations for thesis, but it uses xelatex for compilation. I want to continue using VS Code with Latex Workshops, question is how to change compiler to xelatex from pdflatex. The last one cause next error log:

C:\Users\User\AppData\Local\Programs\MiKTeX 2.9\tex/latex/fontspec\fontspec.sty:45: Fatal Package fontspec Error: The 
fontspec package requires either XeTeX or
(fontspec)                      LuaTeX.
(fontspec)                      
(fontspec)                      You must change your typesetting engine to,
(fontspec)                      e.g., "xelatex" or "lualatex"instead of
(fontspec)                      "latex" or "pdflatex".

The simplest solution found in issues here, but in more common formulation:

Copying the content, simply go to PreferencesExtensionsLaTeX (meaning LaTeX is LaTeX workshops), find gear-wheel button with name Manage, then find in the list link to settings.json under any tag, open and type next:

"latex-workshop.latex.tools": [{
    "name": "latexmk",
    "command": "latexmk",
    "args": [
        "-xelatex",
        "-synctex=1",
        "-interaction=nonstopmode",
        "-file-line-error",
        "%DOC%"
    ]
}],

Reloading the VSCode may be needed.

Also setting.json file could be found in C:\Users\*\AppData\Roaming\Code\User\settings.json.


Use magic comments

add the following line to the beginning of your document.

% !TEX program = xelatex