While it's easy to get the syntax node you need in a DiagnosticAnalyzer
(because it get passed to you), it's not clear how you can get hold of syntax nodes in Roslyn in other contexts. E.g., how does the Roslyn syntax visualizer (for which the source doesn't appear to be available) get hold of the syntax node under the cursor?
What I want to do is implement a command that can make use of the Roslyn syntax tree for the location of the cursor at the point at which the command was invoked. I've not been able to find using Roslyn in this sort of way.