RStudio, Rstudio Server hang with large sparse matrices

RStudio (both desktop and server) has been hanging frequently while working with large, sparse matrices. From the crash log, it appears that code completion tools might be trying to convert the sparse matrix into a dense one:

In .M2v(x) : sparse->dense coercion: allocating vector of size 27 GiB

I think somewhere someone called as.matrix(x) in some code completion tool that might be trying to convert a large, sparse matrix x into a dense matrix, and everything hangs. I checked the RAM usage by rsession increases to 99%, so that's probably it.