internal/lsp: restore snapshot ID guard for published diagnostics
internal/lsp: restore snapshot ID guard for published diagnostics

A guard against publishing stale diagnostics was removed in CL 269677,
because the signficance of diagnoseDetached was overlooked. Restore it.

For golang/go#42837

Change-Id: I911c4707a9c18a632ce32e0c25c43ae2e92135b2
Reviewed-on: https://go-review.googlesource.com/c/tools/+/274241
Run-TryBot: Robert Findley <9179eee875d1ee628c37fb47d7e749e855ffd21f@google.com>
Trust: Robert Findley <9179eee875d1ee628c37fb47d7e749e855ffd21f@google.com>
gopls-CI: kokoro <2ac7b1f3fa578934c95181d4272be0d3bca00121@google.com>
TryBot-Result: Go Bot <66cb808b70d30c07676d5e946fee83fd561249e5@golang.org>
Reviewed-by: Rebecca Stambler <d7cf11e5f299d88ea8348366a9fc4f7c335c3afa@golang.org>

golang/tools,golang/tools,golang/tools,golang/tools,golang/tools