This extends highlighting in decompiler window for analyzed elements, e.g. having a method A in analyzer window a jump to a method listed under the UsedBy tree node will mark any reference to A.
To ensure this is also done when the jump changes the selection and asynchron decompilation starts, MainWindow.JumpToReference now takes an action which will be executed after decompilation finished (or immidiately if the selection did not change). There are other scenarios, that depend on this possibility: e.g. unfold and scroll to a specific line after JumpToReference.
Highlighting element referenced by analyzer tree nodes in code window
Merge branch 'master' into Highlighting
This will execute the one-shot action when the next decompilation finished - which might be a different one than the decompilation triggered by the jump. Decompilation runs can be cancelled, and a DecompiledFinished event is pretty much useless if it doesn't tell which decompilation has finished.
It would be better to pass the callback into the decompilation operation itself (so that it doesn't get called if the decompilation is cancelled), or provide a Task object that can be used to get notified when the decompilation completes.
Supply language and decompiled tree nodes in DecompileFinished event
You're right. I changed the code so that the callback is passed to the decompilation and only called if it succeeds (no exception occured). The DecompilationFinished event is now decorated with language and decompiled tree nodes.
By the way: The cancellation of the decompile process results in an exception stack trace being shown. I think there should be a special handling, perhaps like for OutputLengthExceededException or at least a simple message.
Apart from the DecompilationFinished problems (which I just fixed by adding a JumpToReferenceAsync method), this PR has another problem: it does not necessarily highlight the correct references. For example, if the referenced symbol is in another assembly, it is not highlighted.
This is because the MarkReferences implementation was written only for local variables; and does see a type reference and a type definition as equal even if they point to the same type.