Enable open snippet file

In current version, actions such as open snippet file and open snippet file in other window does not work well.
I fixed it.

Moreover, I remove the unused variable and functions due to this change.