I'm reading Shankar QM and in chapter 11.2 Eq. 11.2.7, he uses the projection operator (summed over infinity) to project the $|\psi\rangle$ state in the $x$-basis as follows:
$$ \int |x\rangle \langle x|\psi\rangle dx\,.$$
My confusion is perhaps from my misuse of the Dirac notation in the following assumptions:
On one hand the
$$ \int |x\rangle \langle x|\psi\rangle dx = I |\psi\rangle = |\psi\rangle\,,\tag{1}\label{1}$$
if we integrate over $dx$ first. But I think that this leaves ambiguity in the basis of $|\psi\rangle$ because the integral can also be reduced as:
$$ \int |x\rangle \langle x|\psi\rangle dx = \int \psi(x)|x\rangle dx\,,\tag{2}\label{2}$$
which leaves an integral over $dx$ basis vectors with coefficients of $\psi(x)$. I interpret this as $\psi(x)$ as well but that disagrees with Shankar's definition.
So, my question is: If $\langle x|\psi\rangle$ is $\psi(x)$, then what is $|x\rangle \langle x|\psi\rangle$? What is wrong with the assumptions/thinkings \eqref{1} and \eqref{2}?