Many programming languages (including LaTeX) have compiler directives–a type of pragma in the form of a specifically formatted comment.
For LaTeX, de facto directives are compatible with popular LaTeX editors including Atom and TeXstudio.
Specify LaTeX compiler
At the top of your main/root LaTeX document:
% !TeX TS-program = xelatex
or other compiler of your choice.
Specify root LaTeX file
Particularly for large or multi-chapter LaTeX documents, it is good practice to break up a large LaTeX file into multiple per-chapter files.
To help your LaTeX editor recognize which is the top-level master document, in the other .tex files you
\input, put at the top of each of those .tex files:
% !TEX root = thesis.tex
or whatever your main document filename is.
If you get error
%!TeX program used: xelatex Error: One command expansion invalid. Parent Command: compile Primary Command: compile