I think opam environment is just not availabe from your visual studio code session.
An easy way to try is to start visual studio code from a terminal which is known to be correctly setup:
$ opam switch
# Normal output should be your switch name highlighted among other installed switches.
# If this is displayed:
# [WARNING] The environment is not in sync with the current switch.
# You should run: eval `opam config env`
# Run eval `opam config env` to fix it
$ which ocamlmerlin
/.../bin/ocamlmerlin
# merlin is in PATH
$ code
# Launch vscode from this environment.