It seems that \providecommand pollutes the preview rendered by Mathjax. This is related to @carmo-lucas' comment in 856
Consider
\documentclass[11pt]{article}
\usepackage{amsmath,amsfontsamssymb}
\usepackage[utf8]{inputenc}
\usepackage{t1enc}
\providecommand{\E}{{\mathbb E}}
\newcommand{\cf}{{\mathcal F}}
\begin{document}
$X$
\end{document}
Then preview yields

Replacing \providecommand by \newcommand yields the correct preview

There are two ways to handle this
\providecommand definitions\providecommand definitions into \newcommand definitions when sending the preamble to mathjaxAny comments?
Hmm. This is a tricky one. Personally I think the benefits from turning \providecommand into \newcommand outweigh the drawbacks.
I'm using someone else's .sty file so turning \providecommand to \newcommand could be problematic.
I fixed it by setting "latex-workshop.hover.preview.newcommand.parseTeXFile.enabled" to false.
Not a perfect solution but it works for what I need.
I was perhaps not clear. The translation from \providecommand to \newcommand would be achieved on the fly by the extension. In no way, would the .tex or any other included files be modified.
For reference: \providecommand acts as \newcommand but only creates a new alias if the alias doesn't already exist. So we should be able to achieve the same behaviour by simply passing all the providecommand's to MathJax first (as newcommand's). That way if there was a newcommand before the providecommand it will be the newcommand's definition that is used.
Most helpful comment
Hmm. This is a tricky one. Personally I think the benefits from turning
\providecommandinto\newcommandoutweigh the drawbacks.